[Linux] RHEL7.0 配置網路IP的幾種方法

tolilong發表於2017-06-15
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  ]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24237320/viewspace-2140807/,如需轉載,請註明出處,否則將追究法律責任。

相關文章