setup DHCP and static IP for ubuntu.
find IP address, can use the ip
command which is part of the iproute2
package that is usually installed by default.
ip addr show
This command displays a list of all network interfaces on your system along with their IP addresses and other information.
xenial
Type the following command to edit the network configuration file:
sudo vim /etc/network/interfaces
blow is DHCP setting:
auto ens160
iface ens160 inet dhcp
blow is static IP setting:
|
|
Apply the changes by running the following command:
sudo /etc/init.d/networking restart
bionic & focal
Type the following command to edit the network configuration file:
sudo /etc/netplan/00-installer-config.yaml
blow is DHCP setting:
|
|
blow is static IP setting:
|
|
Apply the changes by running the following command:
sudo netplan apply
jammy
Type the following command to edit the network configuration file:
sudo vim /etc/netplan/00-installer-config.yaml
blow is DHCP setting:
|
|
blow is static IP setting:
|
|
Apply the changes by running the following command:
sudo netplan apply