I've been trying to solve this out by myself but is nearly impossible…the thing is that I have to PCs on the same network, one is running Windows (192.168.61.100) and the other one is running Debian (192.168.61.200). I added a static route to the one running W (route add -p 192.168.0.0 mask 255.255.255.0 192.168.60.254) and I perfectly can ping a PC with IP address 192.168.0.170 and viceversa from 192.168.61.100. The problem comes when I try to add the same static route to the one running Debian, when I try to do it I get:
root@satv:/home/satv# route add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.60.254
SIOCADDRT: Network is unreachable Here are some useful things:
ifconfig
eth0 Link encap:Ethernet HWaddr 1c:1b:0d:c0:a8:89
inet addr:192.168.61.200 Bcast:192.168.61.255 Mask:255.255.255.0
inet6 addr: fe80::1e1b:dff:fec0:a889/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2965 errors:0 dropped:165 overruns:0 frame:0
TX packets:1389 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:234251 (228.7 KiB) TX bytes:131929 (128.8 KiB)
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:65536 Metric:1
RX packets:2 errors:0 dropped:0 overruns:0 frame:0
TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:172 (172.0 B) TX bytes:172 (172.0 B)
route -n
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.61.254 0.0.0.0 UG 0 0 0 eth0
192.168.61.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
ip route list
default via 192.168.61.254 dev eth0
192.168.61.0/24 dev eth0 proto kernel scope link src 192.168.61.200
netstat -anr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.61.254 0.0.0.0 UG 0 0 0 eth0
192.168.61.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
Obviously I need to ping 192.168.0.170 from 192.168.61.200 and viceversa. Can anybody please helpme??? I've been working on this for days and I'm very desperate…Thanks a lot in advance.
Best Answer
The next hop you are trying to add in the route is not in the same subnet as the computer you are trying to configure the route in.
That is,
192.168.61.200
netmask255.255.255.0
covers only addresses from192.168.61.1
to192.168.61.254
, and you have to use an address in that network for your next hop.Maybe your Windows computer has a different netmask which also covers the
192.168.16.0/24
network.