I have a linux Fedora -16 machine that has two interfaces -
em1 Link encap:Ethernet HWaddr B8:CA:3A:89:EE:F1
inet addr:136.170.195.17 Bcast:136.170.195.255 Mask:255.255.252.0
inet6 addr: fec0::f:baca:3aff:fe89:eef1/64 Scope:Site
inet6 addr: 2002:88aa:c268:f:baca:3aff:fe89:eef1/64 Scope:Global
inet6 addr: fe80::baca:3aff:fe89:eef1/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6363373 errors:0 dropped:2 overruns:0 frame:0
TX packets:1571017 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4502189587 (4.1 GiB) TX bytes:175801460 (167.6 MiB)
Interrupt:20 Memory:f7f00000-f7f20000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:765 errors:0 dropped:0 overruns:0 frame:0
TX packets:765 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:85089 (83.0 KiB) TX bytes:85089 (83.0 KiB)
p3p1 Link encap:Ethernet HWaddr 14:D6:4D:1F:F3:F8
inet addr:10.240.100.110 Bcast:10.240.100.255 Mask:255.255.255.0
inet6 addr: fe80::16d6:4dff:fe1f:f3f8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2615351 errors:0 dropped:0 overruns:0 frame:0
TX packets:2868133 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1081785835 (1.0 GiB) TX bytes:1577912608 (1.4 GiB)
On the interface p3p1, I am running a dhcp server. My embedded device, which runs on a NFS, gets the IP address from p3p1. The p3p1 interface is connected to my embedded device - Point to Point.
Now, from the embedded box ( a linux based system), I want to ping/access the address - 136.170.195.17.
I cannot do the following because, the gw doesn't know how to route the packets for 136.170.0.0 subnet. So, I get an error -
# ping 136.170.195.17
PING 136.170.195.17 (136.170.195.17): 56 data bytes
ping: sendto: Network is unreachable
Since the communication is on the different network, I need to add the route in the device. So, what I have done is enabled the packet forwarding in my linux machine. Next, I have add the route like this.
# /sbin/route add net 136.170.192.0 netmask 255.255.252.0 gw 10.240.100.110
route: resolving net
I am getting the above error. I think that my understanding of network is not in-correct. What is the reason that I am getting the following error? Actually, I am baffled with the above error. In my opinion, there is nothing wrong in my concepts like - enabling packet forwarding and adding the route for the packet destined for the different subnet. Because for the same subnet, the route doesn't come into the picture - it is just based on ARP. How can I fix this issue? Is there any problem in my understanding?
Here is the box routing table -
# netstat -anr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
10.240.100.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
Here is my PC routing table -
$ netstat -arn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 136.170.192.2 0.0.0.0 UG 0 0 0 em1
10.240.100.0 0.0.0.0 255.255.255.0 U 0 0 0 p3p1
136.170.192.0 0.0.0.0 255.255.252.0 U 0 0 0 em1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 p3p1
Try
route add -net ...
. I suspect that error message comes when your embedded device tries to resolve the namenet
to an address or network range.