1.直接修改文件
[root@rhel7 ~]# ifconfig -a
ens33: flags=4163 mtu 1500
inet 192.168.32.129 netmask 255.255.255.0 broadcast 192.168.32.255
inet6 fe80::d378:75a6:dfff:c29d prefixlen 64 scopeid 0x20
ether 00:0c:29:e7:63:ed txqueuelen 1000 (Ethernet)
RX packets 70 bytes 7829 (7.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 292 bytes 34725 (33.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@rhel7 ~]# cd /etc/sysconfig/network-scripts/
[root@rhel7 network-scripts]# ls -l
total 232
-rw-r--r--. 1 root root 352 Jun 15 22:06 ifcfg-ens33
[root@rhel7 network-scripts]# more ifcfg-ens33
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=581cd9ce-ff00-4662-898e-0d3efefaaa9a
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.32.129
PREFIX=24
GATEWAY=192.168.32.1
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_PRIVACY=no
2.图形界面
nmtui 或者 nm-connection-editor 图形界面进行变更
[root@rhel7 network-scripts]# nmtui
[root@rhel7 network-scripts]# nm-connection-editor
[root@rhel7 network-scripts]# service network restart
Restarting network (via systemctl): [ OK ]
[root@rhel7 ~]# ifconfig -a
ens33: flags=4163 mtu 1500
inet 192.168.32.129 netmask 255.255.255.0 broadcast 192.168.32.255
inet6 fe80::d378:75a6:dfff:c29d prefixlen 64 scopeid 0x20
ether 00:0c:29:e7:63:ed txqueuelen 1000 (Ethernet)
RX packets 70 bytes 7829 (7.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 292 bytes 34725 (33.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@rhel7 ~]# cd /etc/sysconfig/network-scripts/
[root@rhel7 network-scripts]# ls -l
total 232
-rw-r--r--. 1 root root 352 Jun 15 22:06 ifcfg-ens33
[root@rhel7 network-scripts]# more ifcfg-ens33
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=581cd9ce-ff00-4662-898e-0d3efefaaa9a
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.32.129
PREFIX=24
GATEWAY=192.168.32.1
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_PRIVACY=no
2.图形界面
nmtui 或者 nm-connection-editor 图形界面进行变更
[root@rhel7 network-scripts]# nmtui
[root@rhel7 network-scripts]# nm-connection-editor
[root@rhel7 network-scripts]# service network restart
Restarting network (via systemctl): [ OK ]
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24237320/viewspace-2140807/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/24237320/viewspace-2140807/