Ubuntu HowTo: IPv6 EUI-64, how to activate privacy extension on Ubuntu Server 20.04

Original Source Link

In my home network I have dual IPv4 + IPv6 stack. IPv4 runs DHCP whereas IPv6 depends on SLAAC.

On my Ubuntu Server 20.04 the /etc/netplan/00-installer-config.yaml file looks like this:

network:
    ethernets:
        eth0:
            addresses:
            - 10.0.4.43/24
            dhcp6: false
            accept-ra: true
            gateway4: 10.0.4.1
            nameservers:
                addresses:
                - 10.0.6.3
                search:
                - example.com
    version: 2

It works fine however the IPv6 address that Ubuntu generates is standard EUI64, which allows you to read network adapter’s MAC address. For comparison, Windows operating system generates a new randomised IPv6 address (or at least last 64 bits) every 24 hours that does not depends on network adapter’s MAC address.

My question: Is it possible for Ubuntu to generate temporary IPv6 address like Windows does?

As documented on https://netplan.io/reference, you can specify ipv6-privacy: true to enable IPV6 privacy extensions.

Tagged : /

Ubuntu HowTo: netplan gre tunnel+quagga

Original Source Link

After installing new router with ubuntu 18.04 on it i’m got a problem with working ospf via gre tunnel to my older routers.
All configured simular, but from new router i got ospf state Init/DROther. Older routers (without netplan) dont see any neighbor.
Tunnels work fine with static routing.

I found solution and fix problem manually. I found that netplan make tunnel with ‘ttl inherit’ (on other routers ttl 255).

tunnel1: gre/ip remote 1.1.1.1 local 2.2.2.2 ttl inherit

After ip tunnel change tunnel1 ttl 255 command execution ospf starts to work.

How can I add to netplan ttl and pointopoint parameters to tunnel intarface?
How to set commands like below to netplan file?

ifconfig tunnel1 pointopoint 10.2.2.1
ip tunnel change tunnel1 ttl 255

netplan currently lacks the ability to configure the ttl / hoplimit of a tunnel. This issue has been brought up in its issue tracker (bug #1846783), however its developers seem to have not paid attention to this.

Meanwhile you can configure the tunnel using connection managers that support setting this field such as systemd-networkd and NetworkManager, or try to run a script that calls ip tunnel after the tunnel has been brought up by netplan.

You might also be interested in the workaround described in the original feature request for supporting IP tunnels in bug #1799487, or elsewhere on this site

Tagged : /

Ubuntu HowTo: How to set default route with netplan, Ubuntu 18.04 server, 2 NIC

Original Source Link

I have two NIC, both is controled over DHCP. One have public IP, second private.

Both interfaces have static IP reserved in DHCP and both interfaces get right IP, but somethimes when reboot server I can’t access from public, because default route is from private NIC.

How can I set permanently this with netplan ?

Public NIC ens18 (IP: 213.133.xxx.xxx)
Private NIC ens19 (IP: 10.10.10.xxx)

My netplan config is:

network:
  version: 2
  renderer: networkd
  ethernets:
    ens18:
      dhcp4: yes
      dhcp6: no
      nameservers:
        addresses: [8.8.8.8,8.8.4.4]
  ethernets:
    ens19:
      dhcp4: yes
      dhcp6: no

The issue is that networkd will bring up both networks, and both will have a default gateway set, and both will be at the same metric.

Netplan does not currently allow you to skip setting the route on one interface, but you can configure networkd separately to tell it to do this, by basing the config on what netplan has already generated.

I have copied the commands below. Here I am assuming that ens19 is the “secondary” interface for which you do not want a default gateway set — note that to do this successfully, it also needs to happen before rebooting with the new interface (or you can copy part of the config, omit the MACAddress= line, etc. so that it’s generic enough that a new interface will be matched).

sudo cp /run/systemd/network/10-netplan-ens19.network /etc/systemd/network
sudo vi /etc/systemd/network/10-netplan-ens19.network

Then add under [DHCP]:

UseRoutes=false            # if you don't want to apply any routes from DHCP

RouteMetric=200        # any number above 100 if you want the routes applied, but that they are less preferred.

If you don’t have the file yet (ie. you have not attached the interface yet) then you could copy the contents of another interface set for DHCP, and remove MACAddress=.

In general, the file should look something like this:

[Match]
Name=interfacename

[Network]
DHCP=ipv4

[DHCP]
UseMTU=true
RouteMetric=200    # or UseRoutes=false, as you prefer.

For static interfaces just skipping gateway4 (or gateway6) config option causes netplan to NOT create default route for that interface.
Then, if you need extra routing using routes element (array of dicts)

For DHCP interfaces you can do:

dhcp4-overrides:
    route-metric: 100

Just increase metric for subsequent interfaces and you should be good.

(See: https://netplan.io/examples)

To stop a dhcp interface in netplan from setting a default route, just set use-routes in dhcp4-overrides to false.

eth2:
    dhcp4: true
    dhcp4-overrides:
        use-routes: false

Also it may be better to not edit /etc/netplan/50-cloud-init.yaml directly but instead:

  • Change the source into /etc/cloud/cloud.cfg.d/50-curtin-networking.cfg.
  • Run cloud-init clean -r to reboot. (this propagates the changes in the cloud config to the netplan config)

Using two NIC is trick. I would prefer a static configuration and define the routing table here are some hints:

  • it is necessary to define the gateways of each NIC, unless, both
    share the same gateway
  • even with multiple gateways the for some systems (ie. Ubuntu) only
    ONE default default gateway is allowed (took some time to learn
    this), but there are some Linux distros that allowe multiple default
    gateways
  • always test inbound, outbound pings for/from each NIC (ping -I google.com)
  • if only some ranges are properly connect it is possible to have connection
    among those, but not to other networks (get and send pings across
    know addresses, but incapable to ping 8.8.8.8
  • ip r get 8.8.8.8 will help to understand how the system reach and outside address
  • set MAC address for each network, as the adapter name may change upon reboot

In the example below, notice that each NIC has its own gateway and eno2 has the default gateway of the system, if you want to have a failsafe behaviour, take a look in the interfaces bonding or manually via iproute2 (readmore)

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      addresses: [ 88.88.24.26/29, "8888.ffff:1:20::c02/64"  ]
      routes:
          - to: 0.0.0.0/0
            via: 88.88.24.25
            metric: 40
            table: 400
      routing-policy:
          - from: 88.88.24.26/29
            table: 400
      match:
          macaddress: 0c:c4:7b:0b:7b:eb
      set-name: mainInf
      gateway6: "8888.ffff:1:20:0:0:0:1"
      nameservers:
          search: [ mydomain.com ]
          addresses:
              - 8.8.8.8
              - 1.1.1.1
              - "2606:4700:4700::1111"
    eno2:
      addresses: [ 88.88.51.44/29, "8888.ffff:1:20::fa02/64" ]
      gateway4: 88.88.51.41
      routes:
          - to: 0.0.0.0/0
            via: 88.88.51.41
            metric: 40
            table: 200
      routing-policy:
          - from: 88.88.51.41/29
            table: 200
      match:
          macaddress: 0c:c4:7b:0b:7b:bb
      set-name: support
      gateway6: "8888.ffff:1:20:0:0:0:1"
      nameservers:
          search: [ mydomain.com ]
          addresses:
              - 8.8.8.8
              - 1.1.1.1
              - "2606:4700:4700::1111"

I install server Ubuntu Server 18.04.1 LTS

$ uname -a
Linux srv02 4.15.0-34-generic #37-Ubuntu SMP Mon Aug 27 15:21:48 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

.

# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        eth0:
            addresses: []
            dhcp4: true
            dhcp6: false
            nameservers:
                addresses:
                - 10.99.0.1
                search: []
    version: 2

Need change IP

$ sudo nano /etc/netplan/50-cloud-init.yaml

network:
    ethernets:
        eth0:
            addresses: [10.99.0.6/23]
            gateway4: 10.99.0.5
            dhcp4: false
            dhcp6: false
            nameservers:
                addresses:
                - 10.99.0.5
                search: []
    version: 2

  $ sudo netplan apply
  Invalid YAML at //etc/netplan/50-cloud-init.yaml line 9 column 0: found character that cannot start any token 9 column - addresses: [10.99.0.6/23]

Tagged : / / /

Ubuntu HowTo: Netplan in Ubuntu Server 18.04. How to restart network fully?

Original Source Link

Ubuntu 18.04 LTS use netplan and systemd-networkd as default network config tool.

In earlier release, we can use service networking restart, or just ifdown & ifup to fully restart the network or an interface.

In 18.04, netplan tells just change the yaml file and use netplan apply .

When I change a bonding interface, just like hash policy, mtu, the netplan apply command doesn’t make the new configuration effective.

Oh by the way, netplan shows render is networkd.

I search the whole internet to find a way to restart the network, but failed.

What I can do is reboot the server. This will make the new mtu and hash policy effective.

But just changing a network parameter, why i must reboot the whole server! Even a unstable windows server is not like this!

So, anyone can tell me what should I do?

List of methods I’ve already tried and failed:

  • systemctl restart systemd-networkd : restarted but mtu and policy not change

netplan apply does the job.

In some cases you have to reboot.

Tagged : / /

Ubuntu HowTo: How to get Asus XG-C100C 10G ethernet card working on Ubuntu 18.04

Original Source Link

Is there anything you need to do to get this network card working in 18.04? It was working fine in 16.04 with the “atlantic” driver built from sources provided by Asus. After upgrading to 18.04, I can see that driver now seems to be included in Ubuntu, and I can see the card using lshw -class network, but syslog shows the ethernet link is down.

There were bigger issues with networking. It wouldn’t work with the built in gigabit ethernet port either. I had to setup netplan to get that working. However, for the 10G card, running “networkctl” it shows “no-carrier” / “configuring” for this interface, even if the ethernet cable is connected.

So I’m not sure if [email protected] missing something? Are there more steps to take to get it working? or is there a bug in the 18.04 atlantic driver?

Also, do I now need to remove any packages to get rid of the old style “ifup / ifdown” and avoid any conflicts with netplan?

cheers


Edit: I tried a fresh install of Ubuntu 18.04 Server, and the installer has the same problem (i.e. shows ‘no-link’ for this NIC).

As pointed out in the comments below by @binaryanomaly, there’s a bug in the kernel supplied with 18.04 for this NIC. It’s fixed in kernel 4.16.6.


Edit: added the /etc/netplan/01-network-manager-all.yaml file

# Let NetworkManager manage all devices on this system
network:
  version: 2
#  renderer: NetworkManager
  renderer: networkd
  ethernets:
    enp1s0:
      dhcp4: no
      dhcp6: no
      addresses: [192.168.0.12/24]
      gateway4: 192.168.0.1
      nameservers:
        addresses: [192.168.0.2,192.168.0.1]
    enp5s0:
      dhcp4: no
      dhcp6: no
      addresses: [192.168.0.11/24]
      gateway4: 192.168.0.1
      nameservers:
        addresses: [192.168.0.2,192.168.0.1]

You do not need to remove any packages to eliminate ifup and ifdown from your system. These commands will only have an effect for network interfaces configured in /etc/network/interfaces. You can even have some interfaces managed through /etc/network/interfaces and some managed through netplan on the same system.

If your interface is showing as “no carrier”, this is most likely a driver issue, not a netplan issue. You can rule out netplan by removing the interface from your yaml and attempting to configure it directly using ifconfig or ip.

Musaul had good information

in Kernel 4.15 and 14.16 you may encounter instability due to Debian kernel incompatibility with dirty wake WOL feature in the firmware of XG-C100C.

Details in comment 41 of kernel bug #199177

Workaround might be included with Kernel 4.16.6 in release app june 2018, so make sure you avoid kernel between 4.15.16 and 4.16.5 with your network card.

Tagged : / / /

Linux HowTo: Why does networkd forget the bridge configuration then complains about invalid gateway?

Original Source Link

I use 2 of the 4 ethernet sockets as a bridge, which I configure with netplan:

network:
  version: 2
  renderer: networkd
  ethernets:
    eno1:
      dhcp4: no
    eno2:
      dhcp4: no
    eno3:
      dhcp4: no
      dhcp6: no
      addresses: [192.168.0.23/24]
    eno4:
      dhcp4: no
      dhcp6: no
      addresses: [192.168.0.24/24]

  bridges:
    br0:
      interfaces: [eno1, eno2]
      addresses: [192.168.0.4/24]
      gateway4: 192.168.0.1
      link-local: []
      nameservers:
        search: []
        addresses: [8.8.8.8]

There is no problem when I run sudo netplan apply, but the connection is lost when I reboot (eno1 is linked to the internet router, eno2 to another server without internet access, eno3 and eno4 are not plugged). It works again after I run sudo netplan apply.

I set the SYSTEMD_LOG_LEVEL=debug environment variable and found these puzzling entries:

May 24 19:08:00 dave systemd-networkd[2900]: eno2: Joined netdev
May 24 19:08:00 dave systemd-networkd[2900]: eno2: Bringing link up
May 24 19:08:01 dave systemd-networkd[2900]: eno1: rtnl: received neighbor message with invalid family '7', ignoring.
May 24 19:08:01 dave systemd-networkd[2900]: eno1: rtnl: received neighbor message with invalid family '7', ignoring.
May 24 19:08:01 dave systemd-networkd[2900]: br0: MAC address: 00:22:19:cc:db:0c
May 24 19:08:01 dave systemd-networkd[2900]: eno1: Joined netdev
May 24 19:08:01 dave systemd-networkd[2900]: eno1: Bringing link up
May 24 19:08:01 dave systemd-networkd[2900]: br0: Remembering updated address: 192.168.0.4/24 (valid forever)
May 24 19:08:01 dave systemd-networkd[2900]: br0: Addresses set
May 24 19:08:01 dave systemd-networkd[2900]: br0: Configuring route: dst: n/a, src: n/a, gw: 192.168.0.1, prefsrc: n/a, scope: global, table: main, proto: static, type: unicast
May 24 19:08:01 dave systemd-networkd[2900]: br0: Setting routes
May 24 19:08:01 dave systemd-networkd[2900]: br0: Forgetting address: 192.168.0.4/24 (valid forever)
May 24 19:08:01 dave systemd-networkd[2900]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/network1/link/_36 interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=25 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
May 24 19:08:01 dave systemd-networkd[2900]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/network1 interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=26 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
May 24 19:08:01 dave systemd-networkd[2900]: br0: Forgetting route: dst: 192.168.0.0/24, src: n/a, gw: n/a, prefsrc: 192.168.0.4, scope: link, table: main, proto: kernel, type: unicast
May 24 19:08:01 dave systemd-networkd[2900]: br0: Forgetting route: dst: 192.168.0.255/32, src: n/a, gw: n/a, prefsrc: 192.168.0.4, scope: link, table: local, proto: kernel, type: broadcast
May 24 19:08:01 dave systemd-networkd[2900]: br0: Forgetting route: dst: 192.168.0.0/32, src: n/a, gw: n/a, prefsrc: 192.168.0.4, scope: link, table: local, proto: kernel, type: broadcast
May 24 19:08:01 dave systemd-networkd[2900]: br0: Forgetting route: dst: 192.168.0.4/32, src: n/a, gw: n/a, prefsrc: 192.168.0.4, scope: host, table: local, proto: kernel, type: local
May 24 19:08:01 dave systemd-networkd[2900]: eno2: Flags change: +UP +RUNNING
May 24 19:08:01 dave systemd-networkd[2900]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/network1/link/_33 interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=27 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
May 24 19:08:01 dave systemd-networkd[2900]: eno2: Link UP
May 24 19:08:01 dave systemd-networkd[2900]: LLDP: Started LLDP client
May 24 19:08:01 dave systemd-networkd[2900]: eno2: Started LLDP.
May 24 19:08:01 dave systemd-networkd[2900]: eno1: Flags change: +UP +RUNNING
May 24 19:08:01 dave systemd-networkd[2900]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/network1/link/_32 interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=28 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
May 24 19:08:01 dave systemd-networkd[2900]: eno1: Link UP
May 24 19:08:01 dave systemd-networkd[2900]: LLDP: Started LLDP client
May 24 19:08:01 dave systemd-networkd[2900]: eno1: Started LLDP.
May 24 19:08:01 dave systemd-networkd[2900]: br0: Could not set route: Nexthop has invalid gateway. Network is unreachable
May 24 19:08:01 dave systemd-networkd[2900]: br0: Failed
May 24 19:08:01 dave systemd-networkd[2900]: br0: State changed: configuring -> failed

What I get from these logs is that networkd remembers the correct configuration of the bridge (192.168.0.4/24), then forgets it, then complains about the gateway (192.168.0.1) not being accessible… Any idea why networkd forgets the configuration, or how to fix this ?

I haven’t tried a work around like calling netplan apply at boot.

Not exactly an answer, but a workaround worked for me:

sudo crontab -e
@reboot /usr/sbin/netplan apply

Tagged : / / /

Ubuntu HowTo: multiple NICs under ubuntu 18.04

Original Source Link

How to translate what we had to do to have 2 independent stream of traffic on 2 or more NIC interfaces with the new netplan.io + systemd-networkd?

auto ens2
iface ens2 inet static
address 192.168.5.100
netmask 255.255.255.0
gateway 192.168.5.1
dns-nameservers 1.1.1.1

auto ens3
iface ens3 inet static
address 192.168.3.15
netmask 255.255.255.0


up ip route add default table 102 dev ens3 via 192.168.3.1
up ip rule add from 192.168.3.0/24 lookup 102
down ip rule del from 192.168.3.0/24
down ip route del default table 102 via 192.168.3.1

network:
  version: 2
  renderer: networkd
  ethernets:
    ens3:
      addresses: [192.168.3.15/24]
      dhcp4: no 
      routes:
       - to: 0.0.0.0/0
         via: 192.168.3.1
         metric: 100
         table: 101
      routing-policy:
       - from: 192.168.3.0/24
         table: 101
    ens2:
      addresses: [192.168.5.100/24]
      dhcp4: no
      gateway4: 192.168.5.1
      nameservers:
        addresses: [1.1.1.1]

This has been confirmed by ‘cyphermox’ on IRC, lead developer on netplan.io.
Check with ip route and ip rule if systemd has created everything needed and if not restart it -> sudo service systemd-networkd restart

Tagged : / / /

Making Game: Why does networkd forget the bridge configuration then complains about invalid gateway?

Original Source Link

I use 2 of the 4 ethernet sockets as a bridge, which I configure with netplan:

network:
  version: 2
  renderer: networkd
  ethernets:
    eno1:
      dhcp4: no
    eno2:
      dhcp4: no
    eno3:
      dhcp4: no
      dhcp6: no
      addresses: [192.168.0.23/24]
    eno4:
      dhcp4: no
      dhcp6: no
      addresses: [192.168.0.24/24]

  bridges:
    br0:
      interfaces: [eno1, eno2]
      addresses: [192.168.0.4/24]
      gateway4: 192.168.0.1
      link-local: []
      nameservers:
        search: []
        addresses: [8.8.8.8]

There is no problem when I run sudo netplan apply, but the connection is lost when I reboot (eno1 is linked to the internet router, eno2 to another server without internet access, eno3 and eno4 are not plugged). It works again after I run sudo netplan apply.

I set the SYSTEMD_LOG_LEVEL=debug environment variable and found these puzzling entries:

May 24 19:08:00 dave systemd-networkd[2900]: eno2: Joined netdev
May 24 19:08:00 dave systemd-networkd[2900]: eno2: Bringing link up
May 24 19:08:01 dave systemd-networkd[2900]: eno1: rtnl: received neighbor message with invalid family '7', ignoring.
May 24 19:08:01 dave systemd-networkd[2900]: eno1: rtnl: received neighbor message with invalid family '7', ignoring.
May 24 19:08:01 dave systemd-networkd[2900]: br0: MAC address: 00:22:19:cc:db:0c
May 24 19:08:01 dave systemd-networkd[2900]: eno1: Joined netdev
May 24 19:08:01 dave systemd-networkd[2900]: eno1: Bringing link up
May 24 19:08:01 dave systemd-networkd[2900]: br0: Remembering updated address: 192.168.0.4/24 (valid forever)
May 24 19:08:01 dave systemd-networkd[2900]: br0: Addresses set
May 24 19:08:01 dave systemd-networkd[2900]: br0: Configuring route: dst: n/a, src: n/a, gw: 192.168.0.1, prefsrc: n/a, scope: global, table: main, proto: static, type: unicast
May 24 19:08:01 dave systemd-networkd[2900]: br0: Setting routes
May 24 19:08:01 dave systemd-networkd[2900]: br0: Forgetting address: 192.168.0.4/24 (valid forever)
May 24 19:08:01 dave systemd-networkd[2900]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/network1/link/_36 interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=25 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
May 24 19:08:01 dave systemd-networkd[2900]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/network1 interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=26 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
May 24 19:08:01 dave systemd-networkd[2900]: br0: Forgetting route: dst: 192.168.0.0/24, src: n/a, gw: n/a, prefsrc: 192.168.0.4, scope: link, table: main, proto: kernel, type: unicast
May 24 19:08:01 dave systemd-networkd[2900]: br0: Forgetting route: dst: 192.168.0.255/32, src: n/a, gw: n/a, prefsrc: 192.168.0.4, scope: link, table: local, proto: kernel, type: broadcast
May 24 19:08:01 dave systemd-networkd[2900]: br0: Forgetting route: dst: 192.168.0.0/32, src: n/a, gw: n/a, prefsrc: 192.168.0.4, scope: link, table: local, proto: kernel, type: broadcast
May 24 19:08:01 dave systemd-networkd[2900]: br0: Forgetting route: dst: 192.168.0.4/32, src: n/a, gw: n/a, prefsrc: 192.168.0.4, scope: host, table: local, proto: kernel, type: local
May 24 19:08:01 dave systemd-networkd[2900]: eno2: Flags change: +UP +RUNNING
May 24 19:08:01 dave systemd-networkd[2900]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/network1/link/_33 interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=27 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
May 24 19:08:01 dave systemd-networkd[2900]: eno2: Link UP
May 24 19:08:01 dave systemd-networkd[2900]: LLDP: Started LLDP client
May 24 19:08:01 dave systemd-networkd[2900]: eno2: Started LLDP.
May 24 19:08:01 dave systemd-networkd[2900]: eno1: Flags change: +UP +RUNNING
May 24 19:08:01 dave systemd-networkd[2900]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/network1/link/_32 interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=28 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
May 24 19:08:01 dave systemd-networkd[2900]: eno1: Link UP
May 24 19:08:01 dave systemd-networkd[2900]: LLDP: Started LLDP client
May 24 19:08:01 dave systemd-networkd[2900]: eno1: Started LLDP.
May 24 19:08:01 dave systemd-networkd[2900]: br0: Could not set route: Nexthop has invalid gateway. Network is unreachable
May 24 19:08:01 dave systemd-networkd[2900]: br0: Failed
May 24 19:08:01 dave systemd-networkd[2900]: br0: State changed: configuring -> failed

What I get from these logs is that networkd remembers the correct configuration of the bridge (192.168.0.4/24), then forgets it, then complains about the gateway (192.168.0.1) not being accessible… Any idea why networkd forgets the configuration, or how to fix this ?

I haven’t tried a work around like calling netplan apply at boot.

Not exactly an answer, but a workaround worked for me:

sudo crontab -e
@reboot /usr/sbin/netplan apply

Tagged : / / /

Ubuntu HowTo: Cannot use apt/curl/wget/git but can Ping

Original Source Link

I have a raspberry pi running ubuntu server 20 and cannot connect to the internet, but can use ping. This question has been asked by many before, however the solutions provided in those questions do not solve my issue.

I can ping www.ubuntu.com

64 bytes from cactuar.canonical.com (91.189.88.180): icmp_seq=3 ttl=45 time=118 ms

but I cannot use sudo apt update

Could not connect to ports.ubuntu.com:80 (91.189.88.150), connection timed out

I get similar errors when using curl. I have checked my iptables and i dont see anything

Chain INPUT (policy ACCEPT 113 packets, 8043 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 71 packets, 7411 bytes)
 pkts bytes target     prot opt in     out     source               destination

I have UFW disabled (ufw status):

Status: inactive

I set a static IP via netplan and the file is below (cat /etc/netplan/netconf.yaml) and created the /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg file:

network:
  version: 2
  ethernets:
    eth0:
      dhcp4: no
      addresses: [100.65.225.70/24]
      gateway4: 100.65.225.1
      nameservers:
        addresses: [8.8.8.8, 8.8.4.4]

The ouput of ip addr show is:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether b8:27:eb:01:4f:8d brd ff:ff:ff:ff:ff:ff
    inet 100.65.225.70/24 brd 100.65.225.255 scope global eth0
       valid_lft forever preferred_lft forever
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether b8:27:eb:54:1a:d8 brd ff:ff:ff:ff:ff:ff

I have read that something could be blocking port 80, but I am not seeing anything doing so. Can someone please let me know what else could cause this issue?

Can you try to download

wget https://cpan.metacpan.org/authors/id/S/SY/SYP/Net-Curl-0.44.tar.gz

Does this download?

Are there any rules in iptables?

ip6tables -nxvL
iptables -nxvL

Are you behind any other external firewall?

Can you remove all files in /etc/netplan and set a file 00-installer-config.yaml in place.

# network config
network:
  ethernets:
    eth0:
      dhcp4: true
  version: 2

This will enable dhcp and see if wget download is working now.
Also would be interesting to see output of

ip addr

Tagged : / / / /

Ubuntu HowTo: How to properly add two network interfaces with Netplan?

Original Source Link

Problem

Please check the picture here first, a visualization of my network plan.

Network plan diagram

I’m trying to add two networks on same Ubuntu 18 server, one of them is vlan tagged. When I add the second network, internal users can’t access to this server from public IP. But anyone outside can access from public IP without any problem.

What I want to do

  • I have default network 192.168.10.0/24 and a VLAN 300 tagged network 192.168.30.0/24.
  • I want to add both 10.x and 30.x networks to one server, because I want it to access both networks.
  • This server must be able to access both 192.168.10.0/24 and 192.168.30.0/24 networks.
  • This server must be reachable from everywhere via its public IP.

Step by step what I do

  • All wifi users are connect to 192.168.10.0/24 network.
  • All servers are using VLAN 300 network 192.168.30.0/24.
  • These servers are reachable via their Public IPs from internet. Internal wifi users can also access via these public IPs.
  • When I add a second network to this ubuntu server, users can’t access server via its public IP.

I tried many different things with netplan, and checked all the examples on netplan.io.

Here is my current simplest configuration:

network:
    ethernets:
        ens18: # this one is vlan tagged on Proxmox. So it can get 30.x IP.
            dhcp4: false
            addresses: [192.168.30.101/24]
            gateway4: 192.168.30.1
            routes:
              - to: 192.168.30.0/24
                via: 192.168.30.1
            nameservers:
                addresses: [1.1.1.1, 8.8.8.8]
        ens19:
            dhcp4: false
            addresses: [192.168.10.101/24]
            # gateway4: 192.168.10.1
            routes:
              - to: 192.168.10.0/24
                via: 192.168.10.1
            nameservers:
                addresses: [1.1.1.1, 8.8.8.8]
    version: 2

I also tried things using vlans:

network:
    ethernets:
        ens18:
            addresses: [192.168.10.101/24]
            # gateway4: 192.168.10.1
            routes:
              - to: 192.168.10.0/24
                via: 192.168.10.101
                table: 5
              - to: 0.0.0.0/0
                via: 192.168.10.1
                table: 5
            routing-policy:
              - to: 192.168.10.0/24
                table: 5
            nameservers:
              addresses: [1.1.1.1, 8.8.8.8]
    vlans:
        vlan30:
            id: 300
            link: ens18
            gateway4: 192.168.30.1
            addresses: [192.168.30.101/24]
            routes:
              - to: 192.168.30.0/24
                via: 192.168.30.101
                table: 6
              - to: 0.0.0.0/0
                via: 192.168.30.1
                table: 6
            routing-policy:
              - to: 192.168.30.0/24
                table: 6
            nameservers:
              addresses: [1.1.1.1, 8.8.8.8]
    version: 2
    renderer: networkd

Tagged :