Setting a Static IP on Ubuntu
Setting a Static IP on Ubuntu
Setting a Static IP on Ubuntu
Identify your network interface name
1
ip addr
Look for the active interface, typically named eth0 or ens33.
Edit the netplan configuration file
1
sudo nano /etc/netplan/01-netcfg.yaml
Example configuration
1
2
3
4
5
6
7
8
9
10
11
12
13
network:
version: 2
renderer: networkd
ethernets:
eth0: # Replace with your interface name
dhcp4: no
addresses:
- 192.168.1.100/24 # Replace with your desired static IP
gateway4: 192.168.1.1 # Replace with your gateway
nameservers:
addresses:
- 8.8.8.8 # Replace with your preferred DNS servers
- 8.8.4.4
Apply the changes
1
sudo netplan apply
Verify the static IP
1
ip addr
This post is licensed under CC BY 4.0 by the author.