change ip ubuntu server code example
Example 1: change ubuntu ip address command line
#/etc/netplan/99_config.yaml
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: change ip of ubuntu
sudo ip link set dev eth0 up
sudo dhclient -v eth0