-   Linux - Networking (
-   -   Help with Subnet Routing (

xatmes 04-26-2004 10:08 PM

Help with Subnet Routing
Ok I have a linux gateway with 3 interfaces.

eth0 -> internet
eth1 ->
eth3 -> ( wireless card in ad-hoc mode connected to )

Basically, all I want to be able to do is ping from behind the subnet ...say, from and be able to hit the IP behind the subnet, and of course vice versa ( -> )

Is this a routing issue or an IPtables issue?

Any help would be greatly appreciated!

My routing table looks like this:

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface * U 0 0 0 eth0 * U 0 0 0 eth3 * U 0 0 0 eth1
loopback * U 0 0 0 lo
default c-67-161-xxx-x. UG 0 0 0 eth0

My forwarding rules look like this...

# Shut off all forwarding to the outside world
/usr/sbin/iptables -P FORWARD DROP
/usr/sbin/iptables -A FORWARD -s -j ACCEPT
/usr/sbin/iptables -A FORWARD -d -j ACCEPT
/usr/sbin/iptables -A FORWARD -s -j ACCEPT
/usr/sbin/iptables -A FORWARD -d -j ACCEPT

mritch 04-26-2004 10:39 PM

got quite a similar layout (but other routing):

router setup:
eth0 takes (my private) and eth1 takes a internal lan ( with a connection to the www.

i tell my kernel/ethers how to route:
(ip) route add -net 192.168."1".0 netmask 255.255."255".0 eth0 ..
route add -net 192.168."2".0 netmask 255.255."255".0 eth1 ..
route add default gw (the gate to www somewhere in the lan).

when i now say to a client (somewhere in 192.168.1/2.x) that the router is the default gateway, the client sends his packet there. the router decides where to put the packet and sends it out over the right interface. he knows, that he can reach 192.168.1.x on eth0 and 192.168.2.x on eth1.

i think you have to give the ethers other IP-ranges (like above .1.0&.2.0). netmask should be on both eth1 and eth3.

hope i could help a bit. bye ritch.

xatmes 04-26-2004 11:30 PM

Thanks for the reply...I changed the netmasks for the interfaces back to

What I am confused about is your suggestion for default route....are you saying to add a default route for the interface on the gateway? It doesn't seem to behave well with more than one default route...? Thanks

mritch 04-27-2004 12:03 AM

well, "your" default route would be eth0 - everthing not matching 192.168.1.x (eth1) and not matching 192.168.2.x (eth3) will go to the internet. i don't know how to set this up if you have a dynamic IP-address, but information is somewhere out there. if it's fix ..use:

add default gw 67.161.232.x <-- this is the number you got from your isp.

else.. read the HOWTO's. ritch.

xatmes 04-27-2004 12:16 AM

Well I understand about the default route to the internet...that's all set up probably. Both subnets can get to the internet but the subnets are invisible to eachother.....I look at the tcpdump of interface and it gives arp requests..."arp who-has tell"....but the interfaces don't seem to want to communicate with eachother. I know I'm missing something really simple here, any ideas? Thanks again :)

xatmes 04-27-2004 12:49 AM

Ok....I feel like an idiot....just had to add routes to the subnet via the gw to each machine. Thanks for the help though!

mritch 04-27-2004 12:52 AM

your "route -n" should say something like that: U 0 0 0 eth1 U 0 0 0 eth3
something something for internet eth0 something UG 0 0 0 eth0

now. if i ping from it "should" work (i have to tell to take the default gateway "route add default gw" to reach the 2nd net).

your eth1 is and eth3 is
what's about eth2? how's your setup?

All times are GMT -5. The time now is 11:25 AM.