Ubuntu: how to add kernel level routing?



Question:

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?


Solution:1

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.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »