How to configure IP in linux

藏色散人
Release: 2019-11-13 09:45:04
Original
4642 people have browsed it

How to configure IP in linux

How to configure IP in Linux?

IP address configuration

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

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

Step 1 Check the network card name

[root@localhost Desktop]# nmcli connection
Copy after login

How to configure IP in linux

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. The name can be modified.

The one starting with vir is a virtual network card or virtual device, so the network card address starting with eno needs to be configured here.

Step 2 Configure IP address

[root@localhost Desktop]# nmcli connection modify "eno16777736" ipv4.addresses "172.20.10.3/24" 地址及掩码
[root@localhost Desktop]# nmcli connection modify "eno16777736" ipv4.gateway "172.20.10.1" 网关
[root@localhost Desktop]# nmcli connection modify "eno16777736" ipv4.dns "114.114.114.114" 域名服务器
[root@localhost Desktop]# nmcli connection modify "eno16777736" ipv4.method manual 手动而不是DHCP
[root@localhost Desktop]# nmcli connection modify "eno16777736" connection.autoconnect yes 开机启动
[root@localhost Desktop]# nmcli connection up "eno16777736" 开启接口
Copy after login

Step 3 View IP address and test

How to configure IP in linux

Method 2: Via vi Editor to edit the network card configuration file (systems below RHEL7)

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

Modify the corresponding information in the picture below

Press i to enter the editing mode

Press esc Then enter: wq to save and exit

Press esc and then enter: q! to exit without saving

How to configure IP in linux

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

How to configure IP in linux

Recommended: "Linux Tutorial"

The above is the detailed content of How to configure IP in linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template