Nowadays everything is on the internet. It is not wrong to say that “Internet has become the basic necessity of our life”. And the internet is a network of networks interconnected with each other. To surf the internet, one should know the basics of a network that how to connect your local network to the internet. First and the most important thing in connecting to the internet is the IP address. The IP address is your identity over the internet like your phone number, SSN etc. To surf the internet, one needs an IP address. At the time when the network is down or not working so the user should be able to debug what is causing an issue. To identify the issue, one should be familiar with the basics of networking. Linux Network stack provides a lot of flexibility in managing a network using GUI and command line interface. In this tutorial we are going to see how to manage, debug, fix the network issue using Linux GUI interface and also the command line interface.
How to statically assign an IP address
When you connect to the network, the first thing your machine does is to get the IP address from the network router. There are two ways of assigning an IP address. One is static and the other one is dynamic. In this section, we are going to see, how to assign IP address statically via GUI and also via command line interface.
Step 1: First of all, open Terminal. Once the terminal is opened, you will have a screen like this:
Step 2: Enter “ip addr show” command to see the available network adapter whom you want to change the IP address and press execute. In this tutorial, we are focusing on “eth0”. The output will be like this:
Step 3: Use “ip addr add X.X.X.X/24 dev eth0” command to change the IP address. In our example X.X.X.X address is 10.0.2.16.
Step 4: Execute the above command and IP address has been changed successfully. You can verify by using “ip addr show” command.
How to change a static IP address
To change the static IP address assigned to our machine, perform the following steps:
Step 1: First of all, open Terminal. Enter “ip addr show” command to see the available network adapter whom you want to change the IP address and press execute. In this tutorial we are focusing on “eth0”. The output will be like this:
Step 2: Use “sudo ifconfig eth0 X.X.X.X netmask 255.255.255.0” command to change the IP address. In our example X.X.X.X address is 10.0.2.17.
Step 3: Execute the above command and IP address has been changed successfully. You can verify by using “ip addr show” command.
How to assign an IP address to DNS server
DNS server is one of the key components of a network. The job of DNS server is to translate the domain name or URL into the IP address which will be used by the network to communicate with the server. If the DNS server is not configured properly or is stopped working then the user will not able to surf the internet. To change the IP address of DNS, perform the following steps:
Step 1: First of all, open Terminal. Backup the existing network configuration file before changing the DNS server. To do this run this command “sudo cp /etc/resolv.conf /etc/resolv.orig”.
Step 2: Enter command “sudo rm /etc/resolv.conf” to remove the resolv.conf file.
Step 3: Enter command “sudo bash” to gain the root privileges.
Step 4: Enter command “sudo echo nameserver 126.96.36.199″ > /etc/resolv.conf”. In this example 188.8.131.52 is the address of DNS server.
After the execution of above commands, the address of DNS server has been updated successfully. To check run this command “cat /etc/resolv.conf”.
How to assign an IP address to Gateway
Gateway also known as Default Gateway is a very important component in a network. It is usually a border router and is used when the computer wants to send information to another network over the internet. To change the IP address of Gateway, perform the following 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 address of the gateway.
After the execution of above commands, the address of gateway has been updated successfully.
In this tutorial, we have discussed the commands to manage & debug a network. This tutorial has been divided into two parts and is showing the same thing by using command line interface & by using graphical user interface. The user can choose any of the above methods as per his requirements.