centos7如何修改IP地址永久有效

[root@centos7 ~]#cd /etc/sysconfig/network-scripts/
[root@centos7 network-scripts]#rm -rf ifcfg-ens33
[root@centos7 network-scripts]#vim ifcfg-eth0
[root@centos7 network-scripts]#cat ifcfg-eth0
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static"
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="eth0"
UUID="7e463dd9-21e9-41e5-92fe-3845aaf3201d"
DEVICE="eth0"
ONBOOT="yes"
IPADDR="10.0.0.7"
PREFIX="24"
DNS1="8.8.8.8"
DNS2="8.8.4.4"
GATEWAY="10.0.0.2"
[root@centos7 network-scripts]#service network restart
Restarting network (via systemctl):                        [  OK  ]
[root@centos7 network-scripts]#
[root@centos7 network-scripts]#route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.0.0.2        0.0.0.0         UG    100    0        0 eth0
10.0.0.0        0.0.0.0         255.255.255.0   U     100    0        0 eth0
[root@centos7 network-scripts]#cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 8.8.8.8
nameserver 8.8.4.4




上一篇:Swoole 中使用通道(Channel)实现协程间通讯(消息队列)


下一篇:uboot编译报错解决