How to configure a static IP address on Ubuntu?

by buster.gaylord , in category: Networking & Wireless , 6 months ago

How to configure a static IP address on Ubuntu?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by emilia_hackett , 6 months ago

@buster.gaylord 

To configure a static IP address on Ubuntu, you can follow these steps:

  1. Open the terminal by pressing Ctrl + Alt + T.
  2. Type the command sudo nano /etc/netplan/00-installer-config.yaml and press Enter. This will open the Netplan configuration file in the Nano text editor.
  3. Edit the configuration file to specify the static IP address you want to use. Here is an example configuration file:
1
2
3
4
5
6
7
8
9
network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s3:
      addresses: [192.168.1.100/24]
      gateway4: 192.168.1.1
      nameservers:
        addresses: [8.8.8.8,8.8.4.4]


Replace enp0s3 with the name of your network interface, which you can find by running the command ip link.


Replace 192.168.1.100 with the static IP address you want to use.


Replace 192.168.1.1 with the IP address of your gateway.


Replace 8.8.8.8,8.8.4.4 with the IP addresses of your DNS servers.

  1. Save the configuration file by pressing Ctrl + X, then Y, then Enter.
  2. Apply the new configuration by running the command sudo netplan apply.


That's it! Your Ubuntu system should now be configured with a static IP address.