In this tutorial we will learn step by step how to configure IP address in linux . There are different ways in linux  to configure IP address. We will show how to configure IP address in linux in different ways. We will use GUI tool nmtui text bases user interface network manager tool




What is IP address?

  • An IP address is a set of 4 numbers assigned to each device/system on a computer network.
  • Every computer requires IP address to communicate with others over the LAN or WAN.
  • In computer network the IP address is a numerical representation of a host address.

For example, the domain google.co.uk would go to the IP address 216.58.210.67 There are four configuration parameters required for Static IP.

  1. IP Address
  2. Subnet mask
  3. Default Gateway or Router
  4. DNS Server(s)

There are two ways to configure an IP on a host.

  1. Static Configuration
  2. Dynamic Configuration

Static IP ConfigurationYou have to assign all these parameters manually.
The IP address will not change automatically. We assign static IP addresses to servers or network resources like printer, router etc. Dynamic IP Configuration Dynamic configurations are handled by DHCP server which assigns IP address automatically. DHCP service on the network provides all these parameters to a system when it joins the network.





DHCP uses DORA process for IP.

DORA Stand for;

D- Discover

O-Offer

R-Request

A-Acknowledgement

How to Configure IP in Linux

CentOS/Red Hat provides two tools to configure the network device/interface.

  1. Network Configuration Tool
  2. Network Manager Tool

Network Configuration Tool This is a command line network configuration tool. This tool is used to configure IP address on terminal. Type below command in terminal and hit enter to invoke tool nmtui —network manager text user interface  (you can run this command as root user) see below image; nmtuicmd

You will see the dialog box (screenshot below)and select option Edit a connection 1

Select the interface enp0s3 which is by default interface name and hit enter 2

You will see the network configuration dialog box if you want to use DHCP then leave value Automatic  highlighted in below screenshot; 3 For static IP you have to select the option Manual and enter the IP manually 4 5 6 By the help of navigation keys goto option ok to save the edit connection settings. Network Manager Tool This is a GUI tool to configure IP address. It is also default network management tool for RHEL. This tool is used to configure IP address on GUI. To invoke this tool click Goto the options – Applications>System Tools> Settings. 7 8 9 Click on IPV4 option by default it is Automatic for static you need to select Manual option. 11 After selecting manual option you need to  set IP address, Netmask and Gateway. DNS IP as per your requirement. 12 Click Apply button to save the settings. Another Method: Last but not least if you are using Pure CLI mode then there is another way to configure IP through configuration file. The path to the access configuration file is /etc/sysconfig/network-scripts/ifcfg-enp0s3. For configuration you need to edit the configuration file Vim tool (vi) is use for editing vi /etc/sysconfig/network-scripts/ifcfg-enp0s3. 13 You need to change and add some parameters for Static IP configuration, by default as I said that DHCP use by interface; 14 Some Changes are; BOOTPROTO=”static” NM_CONTROLLED=”no” ONBOOT=”yes” Add Parameters are; IPADDR=192.168.1.100 NETMASK=255.255.255.0 After editing press first Esc key to switch to command mode and type :wq to save changes and exit.   If you are not familiar with vi editor please visit our tutorial working with vi editor part1 and working with vi editor part2 Now start/restart the service of network by using systemctl restart network. sysserv Check your interface get the IP by using ifconfig command. 15 Yes interface get the IP which is 192.168.1.100 🙂
Congratulations we have learn how to configure IP in linux bravo
In this tutorial we have learnt step by step  how to configure IP address in linux using GUI tool  nmtui  text based user interface network manager tool

I hope you enjoyed tutorial. See you again in next tutorial. Please let us know if there are any mistakes in tutorial suggestions are always welcome… Thanks

SUBSCRIBE OUR NEWSLETTER
I agree to have my personal information transfered to MailChimp ( more information )
Join us by subscribing to our newsletter and learn IT subjects for free
We hate spam. Your email address will not be sold or shared with anyone else.