Managing IP Addresses on Ubuntu Linux

Nowadays, everything is on the Internet. This is not to say that “the Internet has become the main necessity of our life.” And the Internet is a network of networks interconnected. To surf the Internet, you need to know the basics of the network, how to connect your local network to the Internet. The first and most important thing when connecting to the Internet is the IP address. An IP address is your identity on the Internet, such as a phone number, SSN, etc. To use the Internet, you need an IP address. At a time when the network is down or down, the user should be able to debug what causes the problem. To identify a problem, you need to be familiar with the basics of networking. The Linux network stack provides greater flexibility in managing the network using a graphical user interface and command line interface. In this tutorial we will see how to manage, debug, fix network problems using the Linux graphical interface, as well as the command line interface.

How to statically assign an IP address

When you connect to the network, the first thing your machine does is get the IP address from the network router. There are two ways to assign an IP address. One is static and the other is dynamic. In this section, we will look at how to assign an IP address statically through the GUI, as well as through the command line interface.

Step 1: First of all, open a terminal. After opening the terminal, you will have the following screen:

Open Terminal

Step 2: To come in “Show IP address“, To see the available network adapter for which you want to change the IP address, and click” Run. ” In this lesson, we focus oneth0“. The output will be like this:

Managing IP Addresses on Ubuntu LinuxGet network adapter

Step 3: Use “ip addr add X.X.X.X / 24 dev eth0Command to change the IP address. In our example, the address is X.X.X.X 10.0.2.16.

Add IP address to network adapter

Step 4: Run the above command and the IP address has been successfully changed. You can check using “Show IP addressCommand.

Show IP

How to change a static IP address

To change the static IP address assigned to our machine, follow these steps:

Step 1: First of all, open a terminal. To come in “Show IP address“, To see the available network adapter for which you want to change the IP address, and click” Run. ” In this lesson, we focus oneth0“. The output will be like this:

Show IP

Step 2: Use “sudo ifconfig eth0 X.X.X.X netmask 255.255.255.0Command to change the IP address. In our example, the address is X.X.X.X 10.0.2.17.

Change Static IP

Step 3: Run the above command and the IP address has been successfully changed. You can check using “Show IP addressCommand.

The DNS server is one of the key components of the network. The goal of the DNS server is to translate the domain name or URL into the IP address that the network will use to communicate with the server. If the DNS server is not configured properly or has stopped working, then the user will not be able to access the Internet. To change the DNS IP address:

Step 1: First of all, open a terminal. Back up the existing network configuration file before changing the DNS server. To do this, run this command “Sudo cp /etc/resolv.conf /etc/resolv.orig“.

Backing up resolv.conf file

Step 2: Enter the command “sudo rm /etc/resolv.confRemove resolv.conf file.

Delete the old resolv.conf file

Step 3: Enter the command “Sudo hit”To get superuser privileges.

Get root privileges

Step 4: Enter the command “Sudo echo nameserver 8.8.8.8 ″> /etc/resolv.conf“. In this example, 8.8.8.8 is the address of the DNS server.

Set a new name server address

After executing the above commands, the DNS server address was successfully updated. To check, run this command “cat /etc/resolv.conf“.

Nameserver has been installed

How to assign an IP address to a gateway

The gateway, also known as the default gateway, is a very important component in the network. This is usually a border router that is used when a computer wants to send information to another network via the Internet. To change the IP address of the gateway, follow these steps:

Step 1: Open terminal. Enter the command “sudo route add default gw X.X.X.X eth0“. In this example, 10.0.1.1 is the gateway address.

Set Gateway IP

After executing the above commands, the gateway address was successfully updated.

Conclusion

In this tutorial, we discussed commands for managing and debugging a network. This tutorial has been divided into two parts and shows the same thing using the command line interface and using the graphical user interface. The user can choose any of the above methods in accordance with their requirements.

Managing IP Addresses on Ubuntu Linux

Sidebar