3
ens4:
        dhcp4: false
        addresses: [192.168.8.4/24]
        nameservers:
            addresses: [1.1.1.1,8.8.8.8]
        set-name: ens4
        match:
            macaddress: xx:xx:xx:xx:xx:xx

I read a few guides and most of them had /24 as the allocation. I tried putting /32 and im not clear on why /24 works and /32 doesn't? In ubuntu 16.04 I only have to put the single address.

ozzieisaacs
  • 203
  • 3
  • 5

1 Answers1

1

Before (with /etc/network/interfaces) you had to put the netmask as a separate entry. With netplan they decided to merge the IP address and netmask value into one, so you have to specify the netmask as part of the IP address. Putting /24 would correspond to a netmask value of 255.255.255.0. Putting /32 would not make sense as it would reduce the size of the network to just the address itself.

You can read more about this here: Ubuntu 17.10 Server static IP netplan - how to set netmask

Sebastian Stark
  • 6,052
  • 17
  • 47
  • Thanks for the explanation. It previously set the netmask and gateway for me so I didn't even realize it was missing but this makes perfect sense. – ozzieisaacs May 11 '18 at 19:56
  • 1
    /32 reduces the network to itself or 1. – Terrance May 11 '18 at 20:14
  • @Terrance you are right, edited. – Sebastian Stark May 11 '18 at 20:15
  • 1
    Definitely got my +1 =) Here is a tool that I love to use everyday at my job. Takes a lot of guess work out of subnetting. I have the link going to the CIDR notation right now: http://www.subnet-calculator.com/cidr.php – Terrance May 11 '18 at 20:26