Skip to main content
gamedev.net
🔒 Locked

Networking Programming

Started by Esap1 4 replies 400+ views
Original Post
Esap1
Esap1
Ive been playin with network programming, which I will later use for my game. Well I have a problem. I have DSL, and I have a Linux computer with 2xEthernet Cards, one connected to the DSL modem, one connected to a hub, its using IP Mascuarading(bad speller), and I our internel network is connected to that hub. My internel IP is 192.168.0.3, but how would a computer accross the internet, connect with my computer, becuse we only have one Real IP. did that make sence? thanks a lot,
Shannon Barber
Shannon Barber
How does your computer connect to the internet?

If you''re using some sorta proxy on the linux machine, it probably wont ever work.

IP Masquerading? is that another name for network address translation?

In order for a machine on the internet to connect to your computer (ip 192.168.0.3) the linux box needs to act as a NAT router. I don;t have much experience this linux, so I don;t know what program(s) you need or even if it comes with it.

For it to work:
The linux machine binds two (or more) ip address''s to the dsl connected netcard and then translates inbound packets to the second ip address your computer''s internal network address and sends them on - the opposite occurs on the way back out, your internal address (192.168.03) gets converted to the second ip address, 216.59.51.x (what ever it happens to be). Often you have to pay for this extra address. Unlike cable, dsl network packets are efficiently routed, so you cant just go and take an address - unless they use DHCP, in which case you could ping around, find an empty slot and fill it ;p this is against most service agreements and you could probably get into some legal trouble if you get caught, its kinda like getting hbo for free.

Dynamic NAT only works one way (i think this is masquerading), many internal computers can use the same outgoing ip address, but they use different come-back ports and the NAT software (masquerading software) builds a map between the internal ip addresses and outgoing ports. Connections into your network through dynamic nat are not possible (without highly specialized software on both ends and on the NAT box, ie proxy servers & enabled clients)

Buy a second address and look up NAT configuration stuff for linux. Of course, if you have a second address, you can use the uplink port on your hub to go to the dsl, and just assign two real internet ip addresses to each of your machines. (If you use the uplink, you need a straight through cable, the cable from you dsl to the netcard in the linux machine is a crossover cable. Use the crossover cable to go from the dsl to a non-uplink hub port if you have no uplink, or no other cables )

Most NAT software also allows port blocked and various other rules based upon connections ip''s (this is a firewall, which is a handy thing to have, like block port 21 & 23 on the linux machine from ip addresses other than 192.168.0.0x255.255.255.0, unless you want other people to upload files and telnet into your server.)
The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
FordPrefect
FordPrefect
You might be able to set it up that way, but the easiest thing to do would be to buy a router. Linksys makes a DSL/Cable modem router that uses DHCP to let a network share the same internet connection and IP address.
Darrell
Darrell
Read the Linux Howto''s. What your looking for is port forwarding.

Basically when a request is made to your gateway machine (the 1 connected via DSL) you need to forward requests on desired ports to the internal machine you want.

i.e. I want to connect to your game server. Your game server is on a machine (192.168.x.x) in your internal network. Have your linux box forward any requests on port X, on IP (Your internet IP) to (192.168.x.x) port X.

I''ve never set this up, but it is possible.


Esap1
Esap1
Thanks Magmai Kai Holmlor and Darrell.

FordPrefect: What I was describing in my post was my current setup, and it works fine


Magmai Kai Holmlor: Was it just chance that u said 216.59 as the first two numbers in my IP, or was it because I have DSL?
iwasbiggs
iwasbiggs
I think you could set up the network and if you installed IPX on each of the machines correctly (this uses MAC Addresses) you could run games between the hub and still access the outside world via TCP
___________________________Freeware development:ruinedsoft.com

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.