CentOS Change IP Address

Introduction to CentOS Change IP Address

In the CentOS environment, the Internet Protocol i.e. the IP address is playing a very important role. Because it is the server-level operating system. It will manage the multiple application or job levels thread connection, etc. There are different ways to change the IP address in the CentOS operating system. It will depend how the CentOS operating system was installed, like with the minimal package installation or the complete graphical package installation. If we are using the graphical mode of CentOS operating system then it will be bit easy to change the IP address. But if we are using the command prompt or CLI then it will be more complex to do that. In the CentOS environment, if we are using the DHCP server i.e. the Dynamic Host Configuration Protocol then we do not need to take care about changing the IP address of the system.

Syntax of CentOS Change IP Address

Syntax of CentOS Change IP Address are given below:

For CLI

nmcli [OPTIONS...] {help | general | networking | radio | connection | device | agent | monitor} [COMMAND] [ARGUMENTS...]

For UI

nmtui

  • nmcli | nmtui: As per the need, we can use the nmcli or nmtui keyword in the syntax or command. It will accept arguments like different options, device type, command, different arguments, etc. As per the provided input, the nmcli or nmtui will the IP address of the CentOS system. The nmcli or nmtui command will help to manage the different network related task as well.
  • OPTION: As per the requirement, we can provide the different flags as the option that is compatible with the nmcli or nmtui command.
  • COMMAND: As per the requirement or need, we can use the command in nmcli or nmtui.
  • ARGUMENTS: As per the requirement or need, we can also use the arguments in nmcli or nmtui.

How CentOS Change IP Address works?

In the practical world, most of the origination is using the Linux environment. As per the need or the requirement, we need to choose which version of Linux we need to choose for the deployment. The method of changing the IP address may verify from the Linux version to version. In the CentOS environment, there are different ways to change it. It will depend on which type of CentOS UI you are using like graphical UI or CLI. If we are using the graphical UI then it will be a bit easy to change the IP address. If we are using the CLI then we need to use the nmtui or nmcli utility. In nmcli, we can control the network also. Here, we need to use the proper command and syntax it. The syntax of nmcli to control the network is “nmcli networking { on | off | connectivity } [ ARGUMENTS … ]”

There are two types to the allocation of IP address to the CentOS operating system like the automatic allocation of IP address or the manual allocation of IP address. In the automatic process, we do need to take care of anything because the DHCP server will manage the IP address allocation to the host. But in some cases, there is no option of DHCP then we need to assign the IP address manually to the host.

Below is the list of options that are compatible with the nmtui command. Please consider the following option in terms of the NETWORKING CONTROL COMMANDS.

  • on, off: With the help of the NetworkManager, it will help to enable or disable networking control. All NIC or the network interfaces can be managed by NetworkManager. It will be deactivated when the networking is disabled.
  • connectivity [check]: It will help to get the network connectivity state of the host. This will be the optional check argument and it will update to NetworkManager to re-check the connectivity of the host or the most recent status of the connectivity checkThere are different ways to check the network connectivity status
    • none: This option will update that the host is not connected to any network.
    • portal: This option will update the host is behind in a captive portal. It will not reach the full Internet.
    • limited: This option will state the host is connected to a network. But the host is not having an internet connection.
    • full: This option will state the host is connected to a network. But the host is having an internet connection.
    • unknown: This option will update the host status is unknown.

Examples of CentOS Change IP Address

Examples to understand CentOS change IP address CentOS change IP address : How to check the current IP address In the CentOS environment, we are able to check the current IP address of the host.

Command:

ip add sh

Explanation:

As per the above command, we will get the list of IP address associated with the current working host.

Output:

CentOS Change IP Address-1.1

CentOS change IP address : Change the IP address through nmcli 

As we have discussed, there are different ways to do changes in the IP address. Here, we are doing with the help of the nmcli utility.

Command:

nmcli device modify enp0s8 ipv4.address 192.168.56.220/24

Explanation: As per the above command, we are using the nmcli utility to change the IP address of the host machine.

Output:

CentOS Change IP Address-1.2

CentOS change IP address : Change the IP address through nmtui

Similarly to the nmcli, we are able to change the IP address of the host with the help of nmtui also. Here, we are doing with the help of nmtui utility.

Command:

nmtui

Explanation: As per the above command, we are using the nmtui utility to change the IP address of the host machine.

Output:

CentOS Change IP Address-1.3

Screenshot 1 (a)

CentOS Change IP Address-1.4

Screenshot 1 (b)

Conclusion

We have seen the uncut concept of the “CentOS change IP address” with the proper example, explanation and command with different outputs. There are different ways to achieve it. As per the requirement or need, we can choose which method we need to choose for the same.

Leave a Reply

Your email address will not be published.