Change IP CentOS: 2 Simple Methods

There are several ways to change the IP address in CentOS.

  1. Changing IP address using command line: By using command line tools such as ifconfig or ip command, you can directly modify the IP address of a network interface. For example, with the ifconfig command, you can change the IP address by following these steps:
sudo ifconfig eth0 192.168.1.100 netmask 255.255.255.0
  1. Modify network configuration file: In CentOS, the network configuration file is located in the directory /etc/sysconfig/network-scripts/ , you can modify the IP address by editing the corresponding configuration file for the network interface such as ifcfg-eth0. Find the configuration file for the corresponding interface, edit the file, and modify the IP address settings.
  2. To utilize the nmtui tool: nmtui is a text-based user interface tool provided by CentOS for configuring network interfaces. By running the nmtui command in the command line, users can enter an interactive interface to select and modify network interfaces and change IP addresses and other related configurations.
  3. NetworkManager is the default network management tool for CentOS, allowing users to configure networks through a graphical interface. In the CentOS desktop environment, you can modify IP addresses by accessing the network settings in the system preferences.

Here are several common methods for changing IP addresses in CentOS. Choose the one that suits you best to make the adjustment.

bannerAds