How to set static ip Ubuntu?

Setting a Static IP Address on Ubuntu

Introduction

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 Ubuntu system is configuring the network settings. A static IP address is a crucial component of a network setup, as it provides a fixed IP address for your device to connect to the internet. In this article, we will guide you through the process of setting a static IP address on Ubuntu.

Step 1: Update the System

Before you can set a static IP address, you need to ensure that your Ubuntu system is up-to-date. Open a terminal and type the following command to update the system:

sudo apt update

This command will update the package list and ensure that you have the latest available packages.

Step 2: Install the Network Manager

The Network Manager is a built-in tool in Ubuntu that allows you to manage your network settings. To set a static IP address, you need to install the Network Manager. Open a terminal and type the following command:

sudo apt install network-manager

Step 3: Configure the Network Manager

Once the Network Manager is installed, you need to configure it to set a static IP address. Open the Network Manager settings by typing:

nmcli d wifi

This command will open the Network Manager settings. You can then select the network interface you want to configure (e.g. eth0).

Step 4: Set the IP Address

To set a static IP address, you need to enter the IP address, subnet mask, gateway, and DNS server addresses. Here is a table summarizing the settings you need to enter:

Setting Value
IP Address
Subnet Mask
Gateway
DNS Server

Step 5: Save and Restart the Network Manager

Once you have entered the IP address, subnet mask, gateway, and DNS server addresses, you need to save and restart the Network Manager. To do this, type the following command:

sudo nmcli d wifi save
sudo service network-manager restart

Step 6: Verify the Static IP Address

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

ip addr show

This command will display the IP address, subnet mask, gateway, and DNS server addresses for your network interface.

Step 7: Test Your Internet Connection

To test your internet connection, you can use the following command:

ping google.com

This command will attempt to ping the Google website and display the result.

Tips and Variations

  • To set a static IP address with a specific subnet mask, you can use the following command:
    sudo nmcli d wifi set <interface> ip-address <insert IP address> subnet-mask <insert subnet mask>
  • To set a static IP address with a specific gateway, you can use the following command:
    sudo nmcli d wifi set <interface> ip-address <insert IP address> gateway <insert gateway>
  • To set a static IP address with a specific DNS server, you can use the following command:
    sudo nmcli d wifi set <interface> ip-address <insert IP address> dns-server <insert DNS server>

Conclusion

Setting a static IP address on Ubuntu is a straightforward process that requires minimal technical expertise. By following the steps outlined in this article, you can set a static IP address and ensure that your Ubuntu system is connected to the internet. Remember to save and restart the Network Manager after setting the static IP address to ensure that the changes take effect.

Additional Resources

By following these steps and tips, you can set a static IP address on Ubuntu and ensure that your system is connected to the internet.

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