sudo vi /etc/netplan/01-netcfg.yaml
# This file describes the network interfaces available on your system # For more information, see netplan(5). network: version: 2 renderer: networkd ethernets: ens3: dhcp4: no # IP address/subnet mask addresses: [10.0.0.30/24] # default gateway gateway4: 10.0.0.1 nameservers: # name server this host refers addresses: [10.0.0.10,10.0.0.11] dhcp6: no
This is if you have a static IP address.
ens3 in the example may be different on your system; replace it to your own one.
If bridged mode is needed, do something like:
# Let NetworkManager manage all devices on this system network: version: 2 # renderer: NetworkManager renderer: networkd ethernets: enp3s0: dhcp4: no # disable existing configuration for ethernet #addresses: [192.168.1.69/24] #gateway4: 192.168.1.1 #nameservers: #addresses: [192.168.1.1] dhcp6: no # add configuration for bridge interface bridges: br0: interfaces: [enp3s0] dhcp4: no addresses: [192.168.1.69/24] gateway4: 192.168.1.1 nameservers: addresses: [192.168.1.2,192.168.1.1,1.1.1.1] parameters: stp: false dhcp6: no
netplan apply
sudo ip addr
returns:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 52:54:00:19:e8:09 brd ff:ff:ff:ff:ff:ff inet 10.0.0.30/24 brd 10.0.0.255 scope global ens3 valid_lft forever preferred_lft forever inet6 fe80::5054:ff:fe19:e809/64 scope link valid_lft forever preferred_lft forever
If you don't need IPv6, disable it.
echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf
sudo sysctl -p
returns:
net.ipv6.conf.all.disable_ipv6 = 1
sudo ip addr
returns:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever 2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 52:54:00:19:e8:09 brd ff:ff:ff:ff:ff:ff inet 10.0.0.30/24 brd 10.0.0.255 scope global ens3 valid_lft forever preferred_lft forever