I am using netplan to configure the interfaces on Ubuntu 18.04, but there are a few issues. First, the metric does not seem to be working as it is set to 0. Second, once I use networkd the whole network seems to be down!

The set up is like:

                                  Internet                     Internet 
     (local-link)                    /                         /           
 Dev1               |-----|        |-----|      |-----|                   - Dev11 (
    ----------------| eno |        | tun |      | usb | ---- (AP) -------|
 Dev2               |_____|        |_____|      |_____|   - Dev12 (
                |------------------PC ------------------|

The YAML file is:

  version: 2
  renderer: networkd
        macaddress: 3b:2d:x:x:x
      addresses: []
      dhcp4: no
      optional: true
      set-name: usb
        addresses: [,]
      mtu: 8192  
       - to:
         metric: 50
         table: 101
       - from:
         table: 101

I was hoping to use NetworkManager but it does seem that non-default routes are not supported. I then run

sudo netplan generate
sudo netplan apply
sudo service systemd-networkd restart

but route -n gives:

Destination   Gateway      Genmask         Flags     Metric  Ref   Use   Iface          UG        0       0    0      usb          UG       20000    0    0      wlan    U         0       0    0      tun    U         600     0    0      wlan    U         0       0    0      eno    U         0       0    0      usb

and then the host (PC) becomes unreachable (remotely connected via ssh).

Why the metric is not set, since it is defined in YAML file? I want the Devs connected to the AP to have access to internet via the AP, hence I try ping -w 1 -I usb which results to 100% packet loss.

  • Looks like you're trying to set a static IP address to enp60s1. In the usual case you don't need to set all these fields. Have you tried the usual minimal configuration? netplan.io/examples – Stephen Boston Jun 15 at 17:59
  • @StephenBoston I tried to have it as minimal as possible. First, with networkd the metric is not shown, as it does when NetworkManager is applied (up to mtu line). Also, I have two interfaces with two gateways, where packets from subnet 192.168 should reach the internet through the, and all others through a different interface. Now, it seems that forwards packets to tun interface (lower metric), which is not desirable. – lainos88 Jun 16 at 12:59

You are setting both:



   - to:
     metric: 50
     table: 101

gateway4 is shorthand for a default route. You should not combine the two. This is almost certainly why your metric is being clobbered, because the gateway4 setting is overriding. A metric of 0 is not actually a problem since a metric of 0 has an even higher priority than one of 50, but all of your routing table settings would also be clobbered which is likely more the issue.

| improve this answer | |
  • Ok, the gateway4 has been removed. But still the usb interface has no internet access. The traffic from the Dev11, Dev12 should be forwarded to internet only through the AP. Shouldn't the routing-policy: be responsible for this (or should I update the route rules)? – lainos88 Jun 16 at 9:38
  • I have managed somehow to replicate it locally. I have connected two routers on diff interf (i.e. eno1 and usb1), both connected to internet. I tried with renderer: NetworkManager up to the mtu line, and from route -n and ip r I could see that there were two default gateways with 100 and 101 metric. ping Google worked through the interfaces, but when I traceroute it seems that the traffic from the usb1 goes though the gateway in eno1 and reaches the final dest. traceroute on eno1 goes up to 1 hop and then no information. With networkd the metric isnt shown. – lainos88 Jun 16 at 12:05
  • 101 as a metric? The yaml in your question doesn't show a metric of 101 anywhere, only a routing table id of 101. Please make sure you're showing the full config that corresponds to the output you're describing. – slangasek Jun 17 at 16:11

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.