Configure static IP address in Ubuntu Server 22.04
Open the terminal window on your Ubuntu Server.
Type the following command to edit the network interface configuration file:
sudo nano /etc/netplan/01-netcfg.yaml
Change the file to include the following network configuration:network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: no
addresses: [192.168.1.100/24]
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
NOTE: In the above configuration, replace "enp0s3" with your network interface name.
Save the configuration file by pressing Ctrl + O, and then exit the editor by pressing Ctrl + X.
Apply the changes by running the following command:
sudo netplan apply
Verify your IP address by running the following command:
ip addr show enp0s3
NOTE: In the above command, replace "enp0s3" with your network interface name.
That's it. You have successfully configured a static IP address on Ubuntu Server 22.04.
Comments
Post a Comment