0

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.

gasparmenendez
  • 63
  • 1
  • 2
  • 6

2 Answers2

1

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 netmask 255.255.255.0 covers only addresses from 192.168.61.1 to 192.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.

Tero Kilkanen
  • 36,796
  • 3
  • 41
  • 63
  • I understand perfectly what you're saying, but in Windows I'm using the same mask. The thing is that each network (192.168.61.0/24 and 192.168.60.0/24) are connected to different interfaces of my Firewall (Cisco ASA). One ASA interface has IP address 192.168.61.254 and the other has 192.168.60.254. The PC with IP address 192.168.0.170 is connected to the second interface. The ASA is making the routing, that's why in Windows works fine. Sorry for my English, I hope you understand what tried to expalin. Any more ideas?? – gasparmenendez Jul 18 '17 at 22:09
  • Then you should use the `192.168.61.254` address as the default gateway. Windows does all kinds of other odd things too, that's why it might work. – Tero Kilkanen Jul 19 '17 at 08:17
  • thanks @Tero Kilkanen, I'm already using 192.168.61.254 as default gateway (please check the output of the commands in my question) but still no luck. What's driving me crazy is why it is so simple in Windows and in Debian I can't make it work. I really need to solve this issue ASAP... – gasparmenendez Jul 19 '17 at 14:42
  • @gasparmenendez The question refers, in different places, to both `192.168.60.254` and `192.168.61.254` being used as default gw. Can you clarify what is what and ensure that all the output (incl. the error) is actually valid for the problem at hand. What gw address is used on the Windows machine, which addresses actually exist on the interfaces of the router? – Håkan Lindqvist Jul 19 '17 at 15:12
  • sorry @Tero Kilkanen, maybe I got lost in translation...Windows machine has ip 192.168.61.100 mask 255.255.255.0 and gw 192.168.61.254 and when I add: route add -p 192.168.0.0 mask 255.255.255.0 192.168.60.254 from cmd every thing works fine!! (192.168.60.254 is the ip address of an ASA's interface). Please let me know if you need any more information – gasparmenendez Jul 19 '17 at 15:56
  • Why do you even want to add the other route? When you have ASA as the default gateway, ASA will route the packets forward correctly. – Tero Kilkanen Jul 19 '17 at 16:07
  • already solved my friend @Tero Kilkanen, the gw for Windows is different from gw for Debian, don't ask me why cause I don't have a clue...For Debian the gw is the vlan's ip address (192.168.61.253). Anyway the problem is solved. Thank you so much for your help!!!! – gasparmenendez Jul 19 '17 at 20:39
0

Something is a little bit strange about your routes, and it appears that this is exactly what the error message reflects.

Ie, I would think that SIOCADDRT: Network is unreachable is specifically about the gateway address, and how there is no route (link local) that can reach that address.

Is the network actually supposed to be a /23 (192.168.60.0/23, ie 192.168.60.0-192.168.61.255) rather than the configured /24? Or why are machines in 192.168.61.0/24 supposed to use something outside of their network as their gateway address?

You may very well be able to coerce route or ip route into doing the same thing that Windows route apparently did assuming they actually have the same netmask (implicitly pretend that there is a route saying that 192.168.61.254 is link local) or if not, just add this route first, but to me it seems that you may want to address the more fundamental oddness directly.

Håkan Lindqvist
  • 35,011
  • 5
  • 69
  • 94
  • hi @Håkan Lindqvist, I forgot to mention that both network are connected to different Firewall interfaces, that's why there should be communication between them and that's why I think is working in Windows. The problem is with Debian, don't know why. What do you think?? – gasparmenendez Jul 18 '17 at 22:21
  • @gasparmenendez Based on what you wrote in the question, the error seems to make sense (as I outlined in my answer). Can you elaborate on why you think it should work and what happens if you add the route that would be required for the setup to really make sense? – Håkan Lindqvist Jul 19 '17 at 14:55
  • hi @Håkan Lindqvist, sorry but what do you mean with **add route that would be required for the setup to really make sense?** what's that route??? About why I think it should work is very simple: it works fine and simple in Windows PC and in Debian doesn't.... so I think I'm missing something in Debian. Please let me know if you need any more information. Thanks!! – gasparmenendez Jul 19 '17 at 15:46
  • @gasparmenendez That was based on how it says `192.168.60.254` as the gateway address (which you have no route to reach), but if that is incorrect (as indicated in other comments?) it may be irrelevant. – Håkan Lindqvist Jul 19 '17 at 19:02
  • already solved my friend @Håkan Lindqvist, the gw for Windows is different from gw for Debian, don't ask me why cause I don't have a clue...For Debian the gw is the vlan's ip address (192.168.61.253). Anyway the problem is solved. Thank you so much for your help!!!! – gasparmenendez Jul 19 '17 at 20:37
  • @gasparmenendez Glad to hear it. Please post the solution, if it makes sense, as an answer to the question (and accept it if it is the best answer) or the site will forever consider your question to be in need of an answer. – Håkan Lindqvist Jul 20 '17 at 13:59
  • I already posted the solution in my previous comment, I used as gw the vlan's ip address (192.168.61.253) so the command to add the static route in Debian stayed as **root@satv:/home/satv# route add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.61.253**. Thanks!!! – gasparmenendez Jul 21 '17 at 15:00