Configure network interface part 1
Network configuration on Linux is consists of four steps. We can do it both graphically and in text mode. In this article we will learn both of these ways, so that we can do this task using both the methods.
What are the files we need to know when we are going to configure a Linux system network! Those files are mentioned below:
- /etc/sysconfig/network-scripts/ifcfg-(Device Name)
- /etc/ sysconfig/network
- /etc/hosts
- /etc/resolve.conf
But as we should start by the easy way so we will start with graphical configuration. For that we need to know two basic commands which are directly related with network configuration. Those commands are:
- nmcli
- nmtui
here these two commands help us finding the network interfaces available on our system and configure them. First nmcli, well this is a network manager controller. This will take care of the network manager to manage the interfaces. If we disable the network manager then this command will not work on terminal. So to use those commands we cannot disable or stop network manager.
nmcli have several options. But we will use only the option d to list the interfaces attached with our system. So the command is
#nmcli d
On the output it will show the interface name on the first column, on second column it will show the type of network device, third it will show it’s status of connection.
Once we have found our interface name we are ready to start configuration. In this stage we will run the nmtui command and follow the steps shown below.
#nmtui
Now press the enter button and we will be able to see the below window:
Now as you see we will select the first option “edit a connection” and press enter. Here we have to use keyboard only. Because of, even though it is graphical mode but it is a tool that can be used on terminal. So on terminal mouse pointer does not work. Now once we pressed enter then we will find the next window shown below:
Now as we can see we selected the second interface. We will configure this interface now. now press enter and we will see the below window.
Replace my IP address with your IP address. Also replace the gateway and DNS. Then scroll down
On this section we need to check the option “automatically connect”. Once that is done, now we have to use the arrow keys to go down and select “OK”. Then we will be back to the previous window.
Now use arrow keys to select “back”. Then press enter. Now we will be on the previous window and select “ok”.
Then we will be on terminal. After that we have to run the command here.
#systemctl restart network.service
Now try to ping the gateway using ping command.
#ping gateway-IP
If the configurations are properly put into places then we will start getting the response from the gateway.
On this part we completed network configuration using network manger tools.
On the next article we will learn how to configure network using text mode.