0

In my Ubuntu server I have 5 NICs for five different subnet. There are some default kernel level routing which needs to be modified. The problem is NIC's ip and destination network is different.

For instance one NIC ip is 10.172.89.2 and this NIC is supposed to transmit traffic to 10.214.7.35. If I try adding route like:

route add -network 10.214.7.35 mask 255.255.255.255 gw 10.172.89.2 dev eth0 

then kernel does not accept this route saying destination network unreachable. Can anyone help giving idea please?

heemayl
  • 91,753

1 Answers1

0

You need to use -host because your giving an network with netmask for only one host. Also I think the syntax is -network 10.214.7.35/32. Also I recommend to do it with the ip command, route is a bit rusty.

heemayl
  • 91,753
ddio
  • 48
  • 5
  • I tried to give an example ddio!! I have routes like 10.172.60.0/29 too and I get same prompt. I think command is not issue but its two different network, i dont know!! meaning NIC IP and destination network IP different!!! – Rafiqul Islam Jan 31 '16 at 09:13
  • ok, please give the output of "ip a" and "ip r" and example you would like to get to work. It's no problem that destination network is not the network your nic is in. It would be an problem if another nic is in the destination network... – ddio Jan 31 '16 at 09:18
  • /etc/network/interfaces Auto em1 Iface em1 inet static Address 10.172.48.2 Netmask 255.255.255.248 Network 10.172.48.0 Broadcast 10.172.48.7

    Auto em2 Iface em2 inet static Address 10.172.67.2 Netmask 255.255.255.240 Network 10.172.48.0 Broadcast 10.172.48.15

    – Rafiqul Islam Jan 31 '16 at 09:31
  • Netstat -rn Net 0.0.0.0 gw 10.172.67.2 mask 0.0.0.0 iface em4. Net 10.172.48.0 gw 0.0.0.0 mask 29 iface em1 Net 10.172.66.0 gw 0.0.0.0 mask 29 iface em2 Net 10.172.67.0 gw 0.0.0.0 mask 28 iface em4 Net 10.172.241.0 gw 0.0.0.0 mask 29 iface em3 Net 10.172.186.0 gw 0.0.0.0 mask 29 iface em49. similarly 3 more. I dont have servers access now to run command. – Rafiqul Islam Jan 31 '16 at 09:31
  • Given the quality, this should be a comment, not an answer.. – heemayl Feb 02 '16 at 03:45
  • -host and -network 10.214.7.35/32 syntax worked for me. thx – Rafiqul Islam Feb 07 '16 at 10:14