Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Networking problem, possible solution?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
MLS100
n00b
n00b


Joined: 10 Jan 2004
Posts: 38

PostPosted: Sun Feb 29, 2004 9:23 am    Post subject: Networking problem, possible solution? Reply with quote

Ok, heres what I want done:

I have 4 computers in my house, I have 5 IPs available from my ISP, I do NOT want to NAT a single IP for all 4 computers. I have cablemodem>Linux>Switch>3 other computers. I want my external interface on Linux, lets call it eth0, to grab 4 IPs via DHCP, eth0 grabs one IP, that one will only go to Linux itself, eth0:0 grabs another and 1:1 NATs to computer 1, ie 192.168.0.2, then eth0:1 grabs another and 1:1 NATs to computer 2, etc. This way I have 4 unique IPs, so I can connect to outside the lan game servers with no NAT issues (because the comps are actually different WAN ips). I should also be able to have a server running on comp 1 and comp 2 on the same port with no issues. This is my theoretical setup. Is this possible and will it work? and if so... Does anyone know how to set this up via iptables? Do I need to hire a professional? :)

/MLS
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54831
Location: 56N 3W

PostPosted: Sun Feb 29, 2004 4:36 pm    Post subject: Reply with quote

MLS100,

Since you want all ports open (no firewall) the easiest way to do this is to buy a switch and plug all the PCs and your upstream link into the switch.

If you really want to do this in software, you need to look into aliasing, but I'm not aware of a way to get multiple addresses allocated using DHCP.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
grimshaw
Tux's lil' helper
Tux's lil' helper


Joined: 07 Aug 2003
Posts: 101
Location: Greensboro, NC 27403, USA, Earth

PostPosted: Sun Feb 29, 2004 5:02 pm    Post subject: it is possible... Reply with quote

I agree with Neddy that the simplest solution is get a crossover cable and plumb the switch into the cable modem.

It is possible to do this through the linux box using iptable forward statements and prerouting.

IN_IFACE="eth1"
OUT_IFACE="eth0"
LOCALNET="192.168.0.0/24"
REALIP1="x.10.10.10"
INSIDEPC1="192.168.0.10"

iptables -I FORWARD -i $IN_IFACE -s $LOCALNET -j ACCEPT
iptables -I FORWARD -i $OUT_IFACE -d $LOCALNET -j ACCEPT
iptables -t nat -D PREROUTING -i $OUT_IFACE -d $REALIP1 -j DNAT --to $INSIDEPC1

Just add lines for the remaining IP addresses.

However, if gaming is your goal though and you have some games using UPNP (Rainbow six3: raven shield and dungeon siege both use UPNP), it starts to get complicated.

Cheers.

- John
_________________
All that is necessary for the triumph of evil is that good men do nothing.
-- Edmund Burke (1729-1797)
Back to top
View user's profile Send private message
grimshaw
Tux's lil' helper
Tux's lil' helper


Joined: 07 Aug 2003
Posts: 101
Location: Greensboro, NC 27403, USA, Earth

PostPosted: Sun Feb 29, 2004 5:12 pm    Post subject: Reply with quote

Oh and you will need to make virtual interfaces on the external NIC with the other real IPs so the router upstream can find you.

- John
_________________
All that is necessary for the triumph of evil is that good men do nothing.
-- Edmund Burke (1729-1797)
Back to top
View user's profile Send private message
MLS100
n00b
n00b


Joined: 10 Jan 2004
Posts: 38

PostPosted: Sun Feb 29, 2004 10:13 pm    Post subject: Reply with quote

That is what I have currently setup (cable modem>switch>4 computers), however I have problems using windows file sharing if all the machines don't have the same gateway, and I'd rather not share through the comcast router anyways. This way I can keep LAN traffic internal, no?

/MLS
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54831
Location: 56N 3W

PostPosted: Sun Feb 29, 2004 10:40 pm    Post subject: Reply with quote

MLS100,

If you are using a switch (not a hub) packets only go where they are needed, so its not a problem
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
MLS100
n00b
n00b


Joined: 10 Jan 2004
Posts: 38

PostPosted: Sun Feb 29, 2004 10:43 pm    Post subject: Reply with quote

Well it must be a crappy switch then, because if the computer running samba is not on the same gateway as one of my windows ones, the windows one can't reach the samba server. Are you saying I need a better switch? I figured this was normal. For reference its a Linksys EZXS55W. http://www.linksys.com/products/product.asp?prid=149&scid=31

/MLS
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54831
Location: 56N 3W

PostPosted: Mon Mar 01, 2004 6:02 pm    Post subject: Reply with quote

MLS100,

That switch should be fine.

It sounds like a routing problem.
Explain the network setup that doesn't work and post the routing table
and ifconfig (or windows equivelent) from the two PCs that should communicate but don't.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
MLS100
n00b
n00b


Joined: 10 Jan 2004
Posts: 38

PostPosted: Tue Mar 02, 2004 3:25 am    Post subject: Reply with quote

Current network setup is as follows:

Linux: 24.100.0.5 Gateway: 24.100.0.1
Computer2: 24.200.0.5 Gateway: 24.200.0.1
Computer3: 24.100.0.70 Gateway: 24.100.0.1
Computer4: 24.50.0.5 Gateway: 24.50.0.1

All IPs grabbed via DHCP. Now Computer 3 can connect to and use windows file sharing just fine on Linux, however computer 2 and 4 cannot. If I release my ip on either 2 or 4 (or both) and get an IP on the same gateway as Linux, then it works fine. Physical setup is:

Cablemodem>Switch>4 Computers like Neddy suggested.

What would totally solve this problem is if Samba had IPX support, but oh well when its free you can't complain (too much).

/MLS
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54831
Location: 56N 3W

PostPosted: Tue Mar 02, 2004 7:06 pm    Post subject: Reply with quote

MLS100,

Computers 1 (linux) and 3 are on the same subnet, therefore have no problems passing packets backwards and forwards

Computers 2 and 4 are on unique (to you) subnets.

You need to tell computers 2 and 4 how to reach computer 1 and computer 1 how to reach 2 and 4, so that you can pass packets in both directions. Both ends have to be right for ping to work

You need to add a route on computer 2, that in linux would be
Code:
/sbin/route add -net 24.100.0.0 netmask 255.255.255.0 eth0

[windows will have something similar in a GUI way in Settinings>ControlPanel>Network]
On computer 1 you need to add
Code:
/sbin/route add -net 24.200.0.0 netmask 255.255.255.0 eth0
/sbin/route add -net 24.50.0.0 netmask 255.255.255.0 eth0
to tell 1 how reach 2 and 4. Use your real netmask and network addresses.

If those IP addresses are dynamic its more of a problem.

If you only have single IP adresses (not a range) use this instead
Code:
/sbin/route add -host 24.200.0.5 eth0
/sbin/route add -host 24.50.0.5 eth0

A netmask of 255.255.255.255 is implied, as a route to a single host is being specified. Without those route commands, Packets between PC 1 and 2 would go out onto the internet and back to you, (provided your ISP had updated his routing tables everywhere) because they will be routed using the default routes. It would work but be really slooooooow.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
MLS100
n00b
n00b


Joined: 10 Jan 2004
Posts: 38

PostPosted: Wed Mar 03, 2004 4:56 am    Post subject: Reply with quote

NeddySeagoon wrote:
It would work but be really slooooooow.


Not really ideal, I would rather setup what I first mentioned to avoid all of that. I want the speed, I transfer a lot of stuff between computers and they are big files.

/MLS
Back to top
View user's profile Send private message
kashani
Advocate
Advocate


Joined: 02 Sep 2002
Posts: 2032
Location: San Francisco

PostPosted: Wed Mar 03, 2004 10:27 am    Post subject: Reply with quote

Nah it's much easier to assign all machines a secondary static IP from non routable IP space.

Code:

machine    wan dhcp IP     private static IP
comp#1     24.0.0.10/24    10.10.10.11/24
comp#2     24.1.0.24/24    10.10.10.12/24
comp#3     24.2.0.77/24    10.10.10.13/24


and so on. Add a bit of local DNS or host names and file transfers between machines are staying on the local switch instead of being routed through the gateway at the cable head end.

kashani
_________________
Will personally fix your server in exchange for motorcycle related shop tools in good shape.
Back to top
View user's profile Send private message
MLS100
n00b
n00b


Joined: 10 Jan 2004
Posts: 38

PostPosted: Wed Mar 03, 2004 10:36 am    Post subject: Reply with quote

Whoa, that works?! I will try that tomorrow. Thanks! Does it require any setup beyond assigning the IPs? Can you be more specific please :)

/MLS
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54831
Location: 56N 3W

PostPosted: Wed Mar 03, 2004 6:31 pm    Post subject: Reply with quote

MLS100,

The routes I posted should work and keep the traffic local. Your current set up should work too but the data goes up and down your DSL link.

The secondary IP addresses will work too. If you don't have DHCP running to allocate the secondary addresses, you can either use the IP addresses to navigate the network or populate the /etc/hosts file on each PC to allow you to use names.

Follow the format of the existing entry in /etc/hosts. That entry is key to normal operation, so don't mess with it.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
kashani
Advocate
Advocate


Joined: 02 Sep 2002
Posts: 2032
Location: San Francisco

PostPosted: Wed Mar 03, 2004 7:02 pm    Post subject: Reply with quote

MLS100 wrote:
Whoa, that works?! I will try that tomorrow. Thanks! Does it require any setup beyond assigning the IPs? Can you be more specific please :)

/MLS


Double checked it in XP. It looks like you static IP has to be primary and your secondaey can be the the dhcp, but it works the same way. Also you avoid the whole static route thing since your public IP's could change occasionally requiring you to redo the routes.

I can think of any other setup. WINS should actually work better since all the machines are on the same subnet now and can see each others broadcasts so you might not need DNS or host files.

kashani
_________________
Will personally fix your server in exchange for motorcycle related shop tools in good shape.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum