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:
    392
    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,279
    Location:
    Canberra
    Do you need a renderer line in there? It looks like it is using NetworkManager networkd
     
    Last edited: Mar 17, 2019 at 12:00 PM
    mrjayviper likes this.
  3. OP
    OP
    mrjayviper

    mrjayviper Member

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

    eixt Member

    Joined:
    Apr 9, 2003
    Messages:
    1,279
    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]
    
     

Share This Page