ubuntu server change ip address code example
Example 1: change ubuntu ip address command line
network:
version: 2
renderer: networkd
ethernets:
eth0:
addresses: [10.10.10.2/24]
gateway4: 10.10.10.1
nameservers:
search: [mydomain, otherdomain]
addresses: [9.9.9.9, 1.1.1.1]
Example 2: ubuntu server change ip address
sudo nano /etc/netplan/01-netcfg.yaml
network:
version: 2
ethernets:
eth0:
dhcp4: no
addresses:
- 192.168.31.16/24
wifis:
wlan0:
addresses:
- 192.168.31.16/24
sudo netplan apply
Example 3: change ip of ubuntu
sudo ip link set dev eth0 up
sudo dhclient -v eth0