// ifconfig
[root@localhost network-scripts]# ifconfig
enp5s0f0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 0c:c4:7a:32:06:bc txqueuelen 1000 (Ethernet)
RX packets 2789 bytes 1502507 (1.4 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0xfafe0000-faffffff
enp5s0f1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 118.244.212.178 netmask 255.255.255.224 broadcast 118.244.212.191
inet6 fe80::ec4:7aff:fe32:6bd prefixlen 64 scopeid 0x20<link>
ether 0c:c4:7a:32:06:bd txqueuelen 1000 (Ethernet)
RX packets 202774 bytes 197210427 (188.0 MiB)
RX errors 0 dropped 4585 overruns 0 frame 0
TX packets 79864 bytes 13770643 (13.1 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0xfaf60000-faf7ffff
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 0 (Local Loopback)
RX packets 10 bytes 864 (864.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 10 bytes 864 (864.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@localhost network-scripts]#
// network-scripts
[root@localhost network-scripts]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# ls
ifcfg-enp5s0f0 ifdown-isdn ifup-bnep ifup-routes
ifcfg-enp5s0f1 ifdown-post ifup-eth ifup-sit
ifcfg-lo ifdown-ppp ifup-ib ifup-Team
ifcfg-配置_1 ifdown-routes ifup-ippp ifup-TeamPort
ifdown ifdown-sit ifup-ipv6 ifup-tunnel
ifdown-bnep ifdown-Team ifup-isdn ifup-wireless
ifdown-eth ifdown-TeamPort ifup-plip init.ipv6-global
ifdown-ib ifdown-tunnel ifup-plusb network-functions
ifdown-ippp ifup ifup-post network-functions-ipv6
ifdown-ipv6 ifup-aliases ifup-ppp
[root@localhost network-scripts]#
// f1
[root@localhost network-scripts]# cat ifcfg-enp5s0f1
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=enp5s0f1
UUID=8c023245-5a6f-4738-975e-0c5e89b58ee5
DEVICE=enp5s0f1
ONBOOT=no
[root@localhost network-scripts]#
// 配置_1
[root@localhost network-scripts]# cat ifcfg-配置_1
TYPE=Ethernet
BOOTPROTO=none
IPADDR=118.244.212.178
PREFIX=27
GATEWAY=118.244.212.161
DNS1=202.106.196.115
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME="配置 1"
UUID=dad3f4d6-ab54-49da-afeb-424be5b415d3
ONBOOT=yes
[root@localhost network-scripts]#
// yum install NetworkManager-tui
[root@localhost network-scripts]# yum install NetworkManager-tui
已加载插件:fastestmirror, langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Loading mirror speeds from cached hostfile
软件包 1:NetworkManager-tui-1.0.0-14.git20150121.b4ea599c.el7.x86_64 已安装并且是最新版本
无须任何处理
[root@localhost network-scripts]#
// nmtui edit enp5s0f0
// f0
[root@localhost network-scripts]# cat ifcfg-enp5s0f0
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=enp5s0f0
UUID=254dc573-bf21-40d2-8237-743497053cc9
DEVICE=enp5s0f0
ONBOOT=no
IPADDR=192.168.1.125
PREFIX=32
GATEWAY=192.168.1.1
PEERDNS=yes
PEERROUTES=yes
[root@localhost network-scripts]#
// modify
[root@localhost network-scripts]# cat ifcfg-enp5s0f0
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME=enp5s0f0
UUID=254dc573-bf21-40d2-8237-743497053cc9
DEVICE=enp5s0f0
ONBOOT=yes
HWADDR=0C:C4:7A:32:06:BC
NETMASK=255.255.255.0
IPADDR=192.168.1.125
PREFIX=24
GATEWAY=192.168.1.1
[root@localhost network-scripts]#
// network restart
[root@localhost network-scripts]# /etc/init.d/network restart
Restarting network (via systemctl): [ 确定 ]
[root@localhost network-scripts]#
原文地址:http://huangchao.blog.51cto.com/10446378/1665560