5

I am trying to set a static IP for my ubuntu server by creating a yaml file on /etc/netplan/ as follows:

network:
    version: 2
    renderer: networkd        
    ethernets:
        enp0s3:
            dhcp4: no
            addresses: [10.10.21.08/24]
            gateway4: 10.10.21.100

But sudo netplan apply returns an error:

Error in network definition /etc/netplan/01-netcfg.yaml line 6 column 23: Malformed Address '10.10.21.08/24',  must be X.X.X.X/NN or ... ".
  • 1
    Have you tried "[10.10.21.8/24]" (without the leading zero before the 8)? – ejjl Apr 5 at 20:19
5

The error code indicates that there is a "Malformed Address" in "10.10.21.08/24".

Try leaving out the leading zero in the fourth octet (i.e. write '10.10.21.8/24').

  • 4
    FYI the reason for this is for most integer to strong converters if you prefix a decimal number with 0 it attempts to parse the following as an octal number, and 8 is not a valid octal digit. – Joel C Apr 6 at 1:56

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.