[lug] Ubuntu 18.04 Route Metric

Bear Giles bgiles at coyotesong.com
Thu May 20 19:01:01 MDT 2021


I don't recall if netplan was supported in 18.04. It's taken a bit of time
to get the hang of it(*) but the basics aren't too bad - it sounds like you
want to set static values so it should be pretty straightforward.

Part of one of my files is:

# Let NetworkManager manage all devices on this system
network:
   version: 2
   renderer: NetworkManager
   ethernets:
     # onboard-NIC
     enp0s31f6:
       dhcp4: false
       addresses:
        - 192.168.1.3/24
        - 10.0.10.3/24
        - 10.0.20.3/24
        - 10.0.90.3/24
       # gateway4: 192.168.1.1
       nameservers:
         search:
          - lan
         addresses:
          - 10.0.20.15
          - 10.0.10.10
          - 8.8.8.8
       routes:
         - to: 0.0.0.0/0
           via: 192.168.1.1
           metric: 100
         # home GW to work VPN
         - to: 172.27.0.0/16
           via: 192.168.1.200
           metric: 10

It has additional stanzas for the 10 Gbps(!) NICs. A system with wifi
connectivity has

# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager

  wifis:
       # all-wlans:

       wlp3s0:
           match: {}
           access-points:
             homewifi:
               password: 'password'
           dhcp4: false
           addresses:
              - 192.168.1.9/24
              - 10.0.10.9/24
           gateway4: 192.168.1.1
           nameservers:
              search:
                - lan
              addresses:
                - 10.0.10.15
                - 10.0.10.10


FWIW I've tried to match on MAC address - it would be nice because I could
have one configuration file that I could deploy to all systems instead of
needing to customize them, but I haven't been able to get them to work.
Here's one attempt:

  wifis:
    wlx9cefd5fcd82b:
      match:
        name: wlx9cefd5fcd82b
       macaddress: "9c:ef:d5:fc:d8:2b"

but I don't recall what had as the name. (That's the system's device name
based on the MAC address.) Hmm... maybe I should have tried 'all-wans'.

Bear

On Thu, May 20, 2021 at 9:54 AM Zan Lynx <zlynx at acm.org> wrote:

> On 5/20/21 8:34 AM, D. Stimits wrote:
> > Does anyone here know how to force my Ubuntu 18.04 to completely
> > leave out a default route for my private router? Or to permanently
> > set that route to a low priority, or to permanently set my public
> > interface to metric of 1?
>
> You must be using DHCP or this would not apply.
>
> Change your DHCP on your private network so that it does not apply any
> default route. Then each DHCP client will only have routes to the
> networks controlled by the private router.
>
> --
>                  Knowledge is Power -- Power Corrupts
>                          Study Hard -- Be Evil
>
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: irc.hackingsociety.org port=6667 channel=#hackingsociety
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20210520/0fb2df11/attachment.html>


More information about the LUG mailing list