Score:0

How to set Ubuntu 2 interface to LAN and Proxy Internet

ma flag

I have 2 interface ens3-192.168.100.10 and ens8-10.100.0.10. Both get via dhcp. ens3 is for lan access and ens8 is for proxy to internet and to run apt update. Problem is now I have to 2 default routes and both have same metric 100 but it make both networks not stable. I tried changed so that Lan/ens3 will be default by making ens3 higher metric. The ens3 network stable but I could not access internet and made any apt update/install. I can ping my proxy using source -I ens8. How to change the route, please advise and help further. Thank you for your attention and great help.


Updated1: I did set static of each interface and the route become something like below; default via 10.100.0.1 dev ens8 proto static default via 192.168.100.1 dev ens3 proto static

  ---Now I can access internet and update apt but I cannot reach my 
  lan. Still no idea.

Updated2: This is the routes

  default via 10.100.0.1 dev ens8 proto static metric 200
  10.100.0.0/24 dev ens8 proto kernel scope link src 10.100.0.10
  192.168.100.0/24 dev ens3 proto kernel scope link src 
  192.168.0.10

internet/update works and from the server and i can ping to lan. The problem now from my lan cannot reach (ssh) to this server.

mpboden avatar
do flag
What version of Ubuntu are you using? Server or Desktop? How are you configuring the interfaces? Via Netplan? If so, please update question with YAML file. You have the concept of metric values inversed. A lower metric takes priority.
chenoi avatar
ma flag
ubuntu 20.04...using netplan
Score:0
us flag

It sounds like your dhcp server on ens3 is misconfigured, if it is offering a default route but should not be used for the Internet.

However, netplan has a complete set of options for overriding wrong dhcp settings. If the only network you need to reach on the LAN interface is a single directly-connected subnet, you can use the following to ignore all dhcp-provided routes (including the default route):

network:
  version: 2
  ethernets:
    ens3:
      dhcp4: true
      dhcp4-overrides:
        use-routes: false
    ens8:
      dhcp4: true

If you have other routes you need on ens3, you can instead give them a higher metric, so that the default route from ens8 will be used in preference over the one on ens3:

network:
  version: 2
  ethernets:
    ens3:
      dhcp4: true
      dhcp4-overrides:
        route-metric: 300
    ens8:
      dhcp4: true

https://netplan.readthedocs.io/en/stable/netplan-yaml/#dhcp-overrides

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.