Initial Settings : Network Settings2021/04/28 |
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@localhost:~# mv /etc/netplan/00-installer-config.yaml /etc/netplan/00-installer-config.yaml.org
root@localhost:~#
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,10.0.0.11] dhcp6: no version: 2 # apply changes root@localhost:~# netplan apply
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:37:5a:11 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:fe37:5a11/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@localhost:~# echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf
root@localhost:~#
root@localhost:~# sysctl -p net.ipv6.conf.all.disable_ipv6 = 1 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:37:5a:11 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 |
Sponsored Link |
|