netplan issue with Ubuntu 18.04.1 Server. No network connectivity (no routes either)

5,976

Solution 1

The subnet configured on the interface does not match your gateway address. You should try the “on-link” configuration which allows you to set up a default route.

network:
  version: 2
  renderer: networkd
  ethernets:
    addresses: [ "10.10.10.1/24" ]
    routes:
      - to: 0.0.0.0/0
        via: 9.9.9.9
        on-link: true

https://netplan.io/examples/

Solution 2

The gateway must be in your net- With the /32 mask, the gateway is outside your lan. You must configure, for example, a /16 mask. (255.255.0.0).

Share:
5,976

Related videos on Youtube

UbuntuUser0000
Author by

UbuntuUser0000

Updated on September 18, 2022

Comments

  • UbuntuUser0000
    UbuntuUser0000 over 1 year

    I've been using Ubuntu since inception and have recently found out about Ubuntu's switch to using netplan vs it's traditional/better /etc/network/interfaces method.

    I'm attempting to get this to work but it simply isn't working. Based on what I can tell, there is no default route, or possibly even a bad netplan (though ./netplan apply runs correctly). Below is what I'm doing:

    • Clean/brand new 18.04.1 install on ESXi
    • Interface is named ens160
    • My IP Address 247.235.60.161
    • My Gateway is 247.235.38.51
    • My subnet mask is 255.255.255.255

    /etc/netplan/01-netcfg.yaml:

    network:
      version: 2
      renderer: networkd
      ethernets:
              ens160:
                      dhcp4: no
                      addresses: [247.235.60.161/32]
                      gateway4: 247.235.38.51
                      nameservers:
                              addresses: [8.8.8.8,8.8.4.4]
    

    When I run "netplan apply" it completes successfully.

    If I ping 8.8.8.8 I get a "SIOCADDRT: Network is unreachable"

    If I do a "route" to view my routing table, it returns with nothing. No routing table. This definitely is an issue.

    If I do an "ifconfig -a" it displays my ens160 interface, correct IP, netmask of 255.255.255.255, no broadcast address, the mac/ether address is correct.

    With regards to the addressing/gw/sn, I can confirm that is correct (I have other hosts running with same/similar on this network)

    Something is definitely wrong with netplan. Any ideas?

    Thanks!

    • Doug Smythies
      Doug Smythies over 5 years
      Readers: Please see also the same question on Ubuntu forums.
    • slangasek
      slangasek over 5 years
      What is the corresponding /etc/network/interfaces that you would use to configure this? Because it is not correct to configure a route via a gateway that you do not have a route to, and you do not have a route to anything except your own host because that's what a netmask of 255.255.255.255 means. So it's ambiguous what you intend here, and it's correct that, given the provided config, netplan is not able to configure a default route.