I'm on Ubuntu 18.04 and I try to learn more on netplan.

When I'm in school's network I need to access to the LAN but I don't want my internet traffic goes by their gateway. I can connect to network by both ethernet ( enp0s25 ) and wifi ( wlp2s0 ). I can identify school's network by domain ( school.example ) and the gateway IP never changes. Does it exist a way to automatically delete the default route when system detects the school's network ?

Thanks for your help!



There s a setting in the network setup, that the connection uses only local resources:

enter image description here

If you check the box enabling the option, then connection specified should not try to route packets to the internet. Assuming then that your second connection (either wired or wireless) is connected, that interface will be used to contact the internet.

This setting will need to be changed for both ipv4 and ipv6 protocols.

Please note that this will not help you if both connections are to your school's network - bypassing their gateway does require the use of an alternate gateway, which would generally mean using a different network.

  • Yeah it can be a solution. The goal was also to do it automatically but i keep it in mind. Thanks. – Nonot Jan 6 at 17:00
  • If it is a wireless connection, then the settings should be remembered. – Charles Green Jan 7 at 14:04

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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