0

I am routing virtual machine's IP through the host (I have my reasons).

ip a a 172.16.0.50/32 dev ens3 (VM's main IP)

I add routes for routing packets to the host's main IP (which acts as a router):

ip route add 192.168.50.10/32 dev ens3 (Specifying that host IP is reachable from interface)
ip route add default via 192.168.50.10 dev ens3 (Specifying that host IP is the gateway)

Now everything works correctly like this, however, after reboot I have to add these routes to "rc.local" for them to be run. Is it possible to set up routes on netplan without specifying the gateway address on "via" option since I use the interface as a gateway? If I restart the network service I have to re-run "rc.local".

I am talking about this command, in particular, being in netplan:

ip route add 192.168.50.10/32 dev ens3
1
  • Ubuntu 20? There is no such release. Ubuntu uses yy.mm format (year.month of release) for all server & desktop releases, the yy being used only for IoT and specialist appliance/devices or cloud use releases than can use snap packages only. Please clarify you release – guiverc Jan 22 at 11:59
0

The netplan syntax you're looking for is on-link: true.

1
  • Excellent. Thank you. Apparently, it is also acceptable to use scope: link – A. Smith Jan 25 at 7:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.