Ubuntu 20.04
Sponsored Link

Initial Settings : Network Settings2020/04/24

 
Change to static IP addres if you use Ubuntu as a server.
[1] The interface name [enp1s0] is different on each environment, replace it to your own one.
# rename to disable default setting

root@dlp:~#
mv /etc/netplan/00-installer-config.yaml /etc/netplan/00-installer-config.yaml.org

root@dlp:~#
vi /etc/netplan/01-netcfg.yaml
# create new

network:
  ethernets:
    # interface name
    enp1s0:
      dhcp4: no
      # IP address/subnet mask
      addresses: [10.0.0.30/24]
      # default gateway
      gateway4: 10.0.0.1
      nameservers:
        # name server to bind
        addresses: [10.0.0.10]
      dhcp6: no
  version: 2

# apply settings

root@dlp:~#
netplan apply
root@dlp:~#
ip addr

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: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:ac:8f:06 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.30/24 brd 10.0.0.255 scope global enp1s0
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:feac:8f06/64 scope link
       valid_lft forever preferred_lft forever
[2] If you don't need IPv6, it's possible to disable it like follows.
root@dlp:~#
echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf

root@dlp:~#
sysctl -p

net.ipv6.conf.all.disable_ipv6 = 1
root@dlp:~#
ip addr

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: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:ac:8f:06 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.30/24 brd 10.0.0.255 scope global enp1s0
       valid_lft forever preferred_lft forever
Matched Content