Skip to content

Config network using Netplan

systemd-networkd

#check if networkd manager the network

networkctl

IDX LINK    TYPE     OPERATIONAL SETUP    
  1 lo      loopback carrier     unmanaged
  2 l4tbr0  bridge   off         unmanaged
  3 usb0    gadget   no-carrier  unmanaged
  5 can0    can      off         unmanaged
  6 eth0    ether    routable    unmanaged
systemd-networkd
1
2
3
4
# start and enabled
sudo systemctl unmask systemd-networkd
sudo systemctl enable systemd-networkd
sudo systemctl start systemd-networkd
NetworkManager
1
2
3
4
# stop and disabled
sudo systemctl stop NetworkManager
sudo systemctl disable NetworkManager
sudo systemctl mask NetworkManager

netplan

sudo apt install netplan.io
netplan config example
network:
    version: 2
    renderer: networkd
    ethernets:
        enp3s0:
            dhcp4: true
            dhcp6: true
    wifis:
        wlp2s0b1:
            dhcp4: yes
            dhcp6: yes
            access-points:
                "network_ssid_name":
                    password: "**********"

edit /etc/netplan/config.yaml file

static
network: 
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: false
      dhcp6: false
      addresses:
      - 10.0.0.4/24
      routes:
      - to: default
        via: 10.0.0.1
      nameservers:
       addresses: [8.8.8.8,8.8.4.4]

check and apply

apply configuration
1
2
3
4
# set permission
sudo chmod 600 /etc/netplan/config.yaml
# apply
sudo netplan apply
1
2
3
4
5
6
7
8
9
networkctl 
IDX LINK    TYPE     OPERATIONAL SETUP     
  1 lo      loopback carrier     unmanaged
  2 l4tbr0  bridge   off         unmanaged
  3 usb0    gadget   no-carrier  unmanaged
  4 usb1    gadget   no-carrier  unmanaged
  5 can0    can      off         unmanaged
  6 eth0    ether    routable    configured
  7 docker0 bridge   no-carrier  unmanaged