LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   routing from one subnet to another (http://www.linuxquestions.org/questions/linux-networking-3/routing-from-one-subnet-to-another-191876/)

NetAX 06-10-2004 06:53 AM

routing from one subnet to another
 
Hi , I know that this may have been asked before several times. But I could not find a definite answer.

First of all, I recently divided my network with two subnets from my DHCP server.

subnets: 172.16.4.0, 172.16.31.0
eth0 eth1

I want to be able to give internet access to the subnet 172.16.31.0.


I have a crossover connected. to my subnet interface 172.16.31.0 such as this:

COMP<-CROSSOVER--172.16.31.0 subnet-eth1--><SERVER--><-172.16.4.0-subnet-eth0->outsideworld/external router.


Both subnets work as there supposed to .(assigning IP's, etc.)
My 172.16.4.0 subnet can fully access the internet through another router 172.16.4.7, so that doesnt have to be configured for routing.

I have tried using the command "route add" but i cant seem to get it to work properly.

#route -n
Kernel IP routing table
Destination Gateway Genmask Flags Use Iface
172.16.31.255 172.16.4.253 255.255.255.255 UGH 0 eth0
172.16.4.253 172.16.4.7 255.255.255.255 UGH 0 eth1
172.16.4.253 172.16.31.255 255.255.255.255 UGH 0 eth1
127.0.0.1 127.0.0.1 255.255.255.255 UGH 0 lo
172.16.4.0 172.16.4.253 255.255.255.0 UG 0 eth0
172.16.31.0 172.16.31.255 255.255.255.0 UG 0 eth1
224.0.0.0 172.16.31.255 240.0.0.0 UG 0 eth1
224.0.0.0 172.16.4.253 240.0.0.0 UG 0 eth0
0.0.0.0 172.16.4.7 0.0.0.0 UG 0 eth0


Any help would be greatly appreciated.

chort 06-10-2004 05:28 PM

You need to enable IP forwarding on the box that is in the middle. On the machine labeled COMP in your diagram, you need to add a route to 172.16.4.0/?? (you don't mention what bitmask/netmask you're using) with the gateway being the IP of eth1 on SERVER.

Which ever machine is doing the NAT to the outside world needs a route to 172.16.31.0/?? (again, bitmask/netmask???) and gateway will be the IP of eth0 on your SERVER machine.

Without all three of those things, it won't work.

NetAX 06-16-2004 08:10 AM

I did enable IP forwarding with YaST(I'm using SuSE pro 9.0).

Using the route command I am not able to add bitmask, I am only able to add the netmask (which is 255.255.255.0 by the way).

The only route that is working is the default route which i set to point to 172.16.4.7(Router).

On the 172.16.31.0 subnet I tried doing an NSLOOKUP and was able to receive the IP addresses of yahoo.com in my test.

example:

nslookup yahoo.com

Non-authoritative answer:
Name: yahoo.com
Addresses: 66.218.71.198, 66.94.234.13, 216.109.127.28, 216.109.127.29
216.109.127.30



But when i do ping yahoo.com it comes up as:

ping yahoo.com [216.109.127.28] <--It somehow knows what IP address to ping.


Request timed out.
Request timed out.
Request timed out.
Request timed out.


Doing this on the other subnet gives no problems. Maybe my routing table is wrong? Any help?


All times are GMT -5. The time now is 10:29 AM.