Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to configure the IP address for linux

Shulou Source: shulou.com Published: 2022-06-02 23:17:19 10月04日 Update

How to configure the IP address for linux? In view of this problem, this article introduces the corresponding analysis and answers in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.

Rhel7/centos7 has added a new IP address configuration tool, but the previous version does not, so you can refer to two methods here.

Method 1: nmcli tool (new version of the system is available)

Step 1 check the name of the network card

[root@localhost Desktop] # nmcli connection

As shown in the figure, NAME corresponds to the name of the network card, and DEVICE corresponds to the hardware identification of the network card, and the name can be modified.

The beginning of vir is a virtual network card or virtual device, so here you need to configure the address of the network card that begins with eno.

Step 2 configure the IP address

[root@localhost Desktop] # nmcli connection modify "eno16777736" ipv4.addresses "172.20.10.3 go 24" address and mask [root@localhost Desktop] # nmcli connection modify "eno16777736" ipv4.gateway "172.20.10.1" Gateway [root@localhost Desktop] # nmcli connection modify "eno16777736" ipv4.dns "114.114.114" Domain name Server [root@localhost Desktop] # nmcli connection modify "eno16777736" ipv4.method manual manually instead of DHCP [root@localhost Desktop ] # nmcli connection modify "eno16777736" connection.autoconnect yes boot [root@localhost Desktop] # nmcli connection up "eno16777736" enable the interface

Step 3 check the IP address and test

Method 2: edit the network card configuration file through the vi editor (systems below RHEL7)

[root@localhost Desktop] # vi / etc/sysconfig/network-scripts/ifcfg-eno16777736

Just modify the corresponding information in the following figure

Press I to enter edit mode

Press esc and then enter: wq to save exit

Press esc and then enter: Q! Exit for not saving

After the modification, restart the network service through service network restart

This is the answer to the question about how to configure the IP address for linux. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

Tags: Address network card method configuration name question tool beginning more system help service solution input easy easy information content domain name buddy Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Shulou Information Microsoft Huawei MariaDB