Help with Subnet Routing
Ok I have a linux gateway with 3 interfaces.
eth0 -> internet
eth1 -> 192.168.1.1
eth3 -> 192.168.2.1 ( wireless card in ad-hoc mode connected to 192.168.2.2 )
Basically, all I want to be able to do is ping from behind the 192.168.1.0/24 subnet ...say, from 192.168.1.3 and be able to hit the IP behind the 192.168.2.0/24 subnet, and of course vice versa ( 192.168.2.2 -> 192.168.1.3 )
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
220.127.116.11 * 255.255.255.128 U 0 0 0 eth0
192.168.0.0 * 255.255.0.0 U 0 0 0 eth3
192.168.0.0 * 255.255.0.0 U 0 0 0 eth1
loopback * 255.0.0.0 U 0 0 0 lo
default c-67-161-xxx-x. 0.0.0.0 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 192.168.1.0/24 -j ACCEPT
/usr/sbin/iptables -A FORWARD -d 192.168.1.0/24 -j ACCEPT
/usr/sbin/iptables -A FORWARD -s 192.168.2.0/24 -j ACCEPT
/usr/sbin/iptables -A FORWARD -d 192.168.2.0/24 -j ACCEPT
got quite a similar layout (but other routing):
eth0 takes 192.168.1.0/24 (my private) and eth1 takes a internal lan (192.168.2.0/24) 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 192.168.2.1 (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 255.255.255.0 on both eth1 and eth3.
hope i could help a bit. bye ritch.
Thanks for the reply...I changed the netmasks for the interfaces back to 255.255.255.0.
What I am confused about is your suggestion for default route....are you saying to add a default route for the 192.168.2.0/24 interface on the gateway? It doesn't seem to behave well with more than one default route...? Thanks
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.
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 192.168.1.0/24 interface and it gives arp requests..."arp who-has 192.168.2.2 tell 192.168.1.3"....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 :)
Ok....I feel like an idiot....just had to add routes to the 192.168.2.0/24 subnet via the 192.168.1.1 gw to each machine. Thanks for the help though!
your "route -n" should say something like that:
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth3
something something for internet eth0
0.0.0.0 something 0.0.0.0 UG 0 0 0 eth0
now. if i ping 192.168.2.23 from 192.168.1.55 it "should" work (i have to tell 192.168.1.55 to take the default gateway 192.168.1.1 "route add default gw 192.168.1.1" to reach the 2nd net).
your eth1 is 192.168.1.1 and eth3 is 192.168.2.1?
what's about eth2? how's your setup?
|All times are GMT -5. The time now is 02:33 AM.|