CentOS6里面ifcfg-eth0对于大小写敏感

装了一台CentOS,在设置以太网网络参数的时候
cd /etc/sysconfig/network-scripts
里面有个ifcfg-eth0文件,vi编辑它
一开始的时候默认内容是
DEVICE="eth0"
HWADDR="CE:CB:F3:34:24:A0"
NM_CONTROLLED="yes"
ONBOOT="no"
我现在根据我的网络环境,设置为
DEVICE="eth0"
HWADDR="CE:CB:F3:34:24:A0"
NM_CONTROLLED="yes"
ONBOOT="yes"
ipaddr="172.18.11.2"
network="255.255.0.0"
gateway="172.18.11.1"
保存退出,service network restart重启网络服务,期待设置的网络参数生效
没想到无效
[root@localhost network-scripts]# service network restart
Shutting down interface eth0:[OK]
Shutting down loopback interface:[OK]
Bringing up loopback interface:[OK]
Bringing up interface eth0:[OK]

[root@localhost network-scripts]# ifconfig
eth0Link encap:EthernetHWaddr CE:CB:F3:34:24:A0
inet6 addr: fe80::cccb:f3ff:fe34:24a0/64 Scope:Link
UP BROADCAST RUNNING MULTICASTMTU:1500Metric:1
RX packets:788 errors:0 dropped:0 overruns:0 frame:0
TX packets:29 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:283534 (276.8 KiB)TX bytes:2020 (1.9 KiB)
Interrupt:9
里面没有ip地址的内容
【CentOS6里面ifcfg-eth0对于大小写敏感】回头在看看刚才ifcfg-eth0,把里面的最后三行改成大写字母
DEVICE="eth0"
HWADDR="CE:CB:F3:34:24:A0"
NM_CONTROLLED="yes"
ONBOOT="yes"
IPADDR="172.18.11.2"
NETMASK="255.255.0.0"
GATEWAY="172.18.11.1"
保存退出,再次service network restart
再来验证一下是否生效
[root@localhost network-scripts]# ifconfig
eth0Link encap:EthernetHWaddr CE:CB:F3:34:24:A0
inet addr:172.18.11.2Bcast:172.18.255.255Mask:255.255.0.0
inet6 addr: fe80::cccb:f3ff:fe34:24a0/64 Scope:Link
UP BROADCAST RUNNING MULTICASTMTU:1500Metric:1
RX packets:870 errors:0 dropped:0 overruns:0 frame:0
TX packets:51 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:288490 (281.7 KiB)TX bytes:3494 (3.4 KiB)
Interrupt:9

OK了,看来大小写敏感啊
转载于:https://blog.51cto.com/81699/963144

    推荐阅读