November 15, 2022

Change IP Address On CentOs 7 Linux

Abhishek Thakur


Default Linux installation uses DHCP network configuration. DHCP is a client/server protocol that automatically provides IP addresses to the host. It also holds information regarding the IP such as its subnet mask and default gateway. This means it automatically obtains an IP address from a router on your network. This dynamic protocol has its advantage however certain operation requires a static IP address. A good example is a File/Web server. In this article, we will show you how to change IP address or how to set up static IP on a CentOs 7 Linux host.

We are taking the example of the given IPV4 Address details.

IP Address: 147.124.***.***

Gateway: 147.***.208.*

Netmask: 255.255.***.***

DNS: 8.8.8.8/8.8.4.4

Change IP Address With ifcfg Files

The ifcfg files control the software terminal for individual network devices. As the system boots, it uses these files to determine what terminal to bring up and how to configure them. To configure an interface with static IP on CentOs 7 browse to the given ifcfg file and edit it.

  • Firstly let’s find out the network interface name using the given command.
# ifconfig -a

 

Ip Address

 

  • Next, open the network interface config file using the given command, this will open the ifcfg file with the default information.

 

# vi /etc/sysconfig/network-scripts/ifcfg-eth0
 

 

  • To change the IP to static edit the file with static IP details and save the file.

 

Change IP Address

 

  • Now restart the network manager service using the given command.
# systemctl restart network
  • After the restart, you can see that the server Ip is changed to the IP in the example.

Change IP

Change IP Using NMTUI

Network Manager Text User Interface is a curses‐based TUI application for interacting with NetworkManager. When starting nmtui, the user is prompted to choose the activity to perform unless it was specified as the first argument. With 99RDP Linux VPS the NMTUI tool is installed by default, Firstly, run it using the # nmtui command in the terminal.

 

  • Select Edit a connection, and select the network device eth0.

 

IP Address

 

  • Enter the static IP details, and save it.

 

Address

 

  • Quit the Network Manager and reboot the system.

 

IP

Conclusion

Finally, these are the two options to change IP address for your CentOS 7 host, The same applies to other Linux Distro too.


Buy Static IP Linux DS @ $ 59 Only.

Popular Blog Posts