How to set static ip on Ubuntu?

Setting a Static IP Address on Ubuntu

Ubuntu is a popular Linux distribution that offers a wide range of features and functionalities. One of the most important aspects of setting up a computer is the ability to configure its network settings. In this article, we will guide you through the process of setting a static IP address on Ubuntu.

Step 1: Update the Package List

Before we can configure the network settings, we need to update the package list. This will ensure that we have the latest packages available for our system.

  • Open a terminal and type the following command to update the package list:
    sudo apt update
  • This command will update the package list and install any necessary updates.

Step 2: Install the Network Manager

Ubuntu comes with a built-in network manager called Network Manager. This is a convenient way to manage our network settings.

  • Open a terminal and type the following command to install the Network Manager:
    sudo apt install network-manager
  • This command will install the Network Manager package and add it to our system.

Step 3: Configure the Network Manager

Now that we have installed the Network Manager, we can configure it to set our static IP address.

  • Open the Network Manager interface by typing the following command in the terminal:
    nmcli d wifi
  • This command will open the Network Manager interface, where we can configure our network settings.

Step 4: Set the Static IP Address

To set a static IP address, we need to configure the Network Manager to use a static IP address.

  • In the Network Manager interface, click on the "Edit" button next to the "Network" section.
  • In the "Edit" window, click on the "IP" tab.
  • In the "IP" tab, click on the "Static" button.
  • In the "Static" window, enter the following information:

    • IP Address: Enter the IP address you want to use (e.g. 192.168.1.100).
    • Netmask: Enter the netmask (e.g. 255.255.255.0).
    • Gateway: Enter the gateway address (e.g. 192.168.1.1).
    • DNS Servers: Enter the DNS servers (e.g. 8.8.8.8 and 8.8.4.4).
  • Click on the "Apply" button to save the changes.

Step 5: Restart the Network Manager

To apply the changes, we need to restart the Network Manager.

  • In the Network Manager interface, click on the "Restart" button.
  • This command will restart the Network Manager and apply the changes.

Step 6: Verify the Static IP Address

To verify that the static IP address has been set correctly, we can use the following command:

  • Open a terminal and type the following command to check the network settings:
    ip addr show
  • This command will display the network settings, including the IP address, netmask, gateway, and DNS servers.

Troubleshooting Tips

  • If you encounter any issues setting a static IP address, try restarting the Network Manager and then restarting your computer.
  • If you are using a virtual network interface, try disabling it and then re-enabling it.
  • If you are using a static IP address with a dynamic DNS (DDNS) service, try disabling DDNS and then re-enabling it.

Conclusion

Setting a static IP address on Ubuntu is a straightforward process that can be completed in a few steps. By following the steps outlined in this article, you can ensure that your computer is connected to the internet using a static IP address. Remember to verify that the static IP address has been set correctly by using the ip addr show command. If you encounter any issues, try restarting the Network Manager and then restarting your computer.

Unlock the Future: Watch Our Essential Tech Videos!


Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top