How to set a static IP using netplan? (running Ubuntu Bionic server)

Discussion in 'Other Operating Systems' started by mrjayviper, Mar 14, 2019.

  1. mrjayviper

    mrjayviper Member

    Joined:
    Jul 18, 2012
    Messages:
    395
    I've followed/looked at several guides (like this one) on how to do the above.

    My problem is that no static IP is getting assigned to the built-in ethernet port. I have run
    Code:
    netplan apply
    several times. I've also rebooted the PC and still no luck.

    I am sure the ethernet port works as I was previously using it on Ubuntu 16.04 just before I decided to fresh install 18.04.2.

    Any ideas what I could be doing wrong? I am going to use the ethernet port to connect my main PC to the Ubuntu server via a crossover cable.

    If I set the ethernet port to use
    Code:
    dchp4:true
    and connect an ethernet cable from it to my modem/router and disable my WiFi card (by removing the netplan config), the PC can connect to the net without any issues.

    Thanks

    Edit: I had a look at /run/systemd/network/config-file-here and it looks correct to me. At the very least representative of the contents of the YAML file. /run/systemd/network folder was mentioned in the netplan website troubleshooting page.
    ---------------------------

    This is the output of
    Code:
    netplan --debug apply
    which also shows the contents of my YAML files. I have tried with and without dhcp4/dchp6/gateway4/renderer.

    [​IMG]
     
    Last edited: Mar 14, 2019
  2. eixt

    eixt Member

    Joined:
    Apr 9, 2003
    Messages:
    1,281
    Location:
    Canberra
    Do you need a renderer line in there? It looks like it is using NetworkManager networkd
     
    Last edited: Mar 17, 2019
    mrjayviper likes this.
  3. OP
    OP
    mrjayviper

    mrjayviper Member

    Joined:
    Jul 18, 2012
    Messages:
    395
    I tried with and without renderer (set to network) and still doesn't work.
     
  4. eixt

    eixt Member

    Joined:
    Apr 9, 2003
    Messages:
    1,281
    Location:
    Canberra
    does this work, append your name servers then the wifi at the bottom
    remove all the bond and vlan stuff

    Code:
    network:
      version: 2
      renderer: networkd
      ethernets:
       enp3s0:
         dhcp4: no
         dhcp6: no
         addresses: [192.168.2.1/24]
         gateway4: 192.168.2.254
         nameservers:
             search: [mydomain, otherdomain]
             addresses: [10.10.10.1, 1.1.1.1]
    
     
  5. OP
    OP
    mrjayviper

    mrjayviper Member

    Joined:
    Jul 18, 2012
    Messages:
    395
    Thanks for the assistance.

    I finally got it to work. It seems "ip a" or "ifconfig" will NOT display any IP unless the port is connected to another port.

    This is VERY different from my experience with Ubuntu 16.04.x and FreeBSD 1x.x.
     
  6. flu!d

    flu!d Ubuntu Mate 16.04 LTS

    Joined:
    Jun 27, 2001
    Messages:
    13,039
    I don't know whether I'm a fan of Netplan, perhaps I just don't like change...?
     
  7. GumbyNoTalent

    GumbyNoTalent Member

    Joined:
    Jan 8, 2003
    Messages:
    7,001
    Location:
    Briz Vegas
    You don't understand, SystemD is better.. ;)
     
    flu!d likes this.
  8. Quadbox

    Quadbox Member

    Joined:
    Jun 27, 2001
    Messages:
    6,157
    Location:
    Brisbane
    In 2040 they'll be asking how the first internet world war started
     
    GumbyNoTalent likes this.
  9. GumbyNoTalent

    GumbyNoTalent Member

    Joined:
    Jan 8, 2003
    Messages:
    7,001
    Location:
    Briz Vegas
    YAML will be to blame.
     
  10. Quadbox

    Quadbox Member

    Joined:
    Jun 27, 2001
    Messages:
    6,157
    Location:
    Brisbane
    *markdowns this post*
     

Share This Page