1

I have a VM with two interface one interface is for management purpose and another is for sending the traffic to the internet.

eth0 10.50.243.141/24 --> Management

eth1 10.50.240.141/24 gw 10.50.240.57

I will be managing the VM from subnet 10.50.140.0/24 so I want to add one permanent route for the subnet 10.50.140.0/24 such that traffic goes through eth0. For that I have added on route in the /etc/network/

up route add -net 10.50.140.0/24 gw 10.50.243.75 dev eth0

But this is not working

If I add a route normally on the terminal it works.

route add -net 10.50.140.0/24 gw 10.50.243.75 dev eth0

2 Answers2

1

you can try by adding to /etc/network/interfaces

post-up /sbin/route add -net 10.50.140.0 netmask 255.255.255.0 gw 10.50.243.75 dev eth0

you can take help from another askubuntu question How to set static routes in Ubuntu Server?

pl_rock
  • 11,715
0

you can edit your /etc/network/interfaces and add lines like

up route add -net  10.50.140.0/24 gw 10.50.243.75 dev eth0

to your static ip definition as described for example here.