I have a question.

I have a ubuntu 18.04 Server there need to connect to two networks ( My network and my neighbors network ).

The main network there shall be the default gateway is ( My network ) and the other network is ( Neighbors network ).

The issue is then that it need to have a dynamic dhcp lease from my neighbors router because there is no way to set static leases in their router ( its a isp router ) and they don't want to buy another one. Also last time I tried to just static assign the server to a unused ip on their network then it ended a couple of days after with a ip confict.

How do I set netplan up so I make sure that it always uses my network as default gateway and only uses their as a lan ( hope that made sense )

  • 1
    No promises, but edit your question and show me sudo lshw -C network and cat /etc/netplan/*.yaml. Are both connections hard-wired? – heynnema Apr 19 at 14:19

Sorry for the late update I have been have contact to a netplan maintainer here this afternoon and we got it to work with the version there is in Bionic-proposed repo because some of the functions are not backported to Ubuntu 18.04 yet.

Btw this fix is not for everyone exept you are okay by using testing software there could breake any time

Had to install netplan.io 0.96-0ubuntu0.18.04.3 from https://launchpad.net/ubuntu/+source/netplan.io/0.96-0ubuntu0.18.04.1

After that then he guided me to use dhcp4-overrides sections in the config to change the metric of the interfaces and in the end ended I with this configuration https://pastebin.com/jfkuSzZ0

Just because heynnema asked so here is the lshw -C network to show all interfaces including the two hard-wired interfaces ( mac addresses are removed because of else ipv6 could be guessed ) https://pastebin.com/PAqimGK5

and with those changes then it works. The default gateway route is only added for the interface there is for my network and dns settings is also only from my network.

But I have to say its again the backport to get dhcp4-overrides and dhcp6-overrides to work in 18.04 is still only in testing so it could breake at next update so as always use this at own risk

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.