前言
刚手动在vmware14中装完centos6.9-minimal-64bits,ifconfig是没IP的.
将/etc/sysconfig/network-scripts/ifcfg-eth0中的ONBOOT由no改为yes,增加DNS服务器,重启网卡服务,IP就有了。
实验
刚装完centos6.9-minimal-64bits,/etc/udev/rules.d/70-persistent-net.rules 文件不用改,就一块网卡
cd /etc/sysconfig/network-scripts
mkdir ./bk
cp ./ifcfg-eth0 ./bk
vi ./ifcfg-eth0
#--------------------------------------------------------------------------------
# @file /etc/sysconfig/network-scripts/ifcfg-eth0
#--------------------------------------------------------------------------------
DEVICE=eth0
TYPE=Ethernet
UUID=ed4384a7-1ab2-4720-bb0b-9fe15d6289f3
# change no to yes
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp
HWADDR=00:0C:29:D7:31:51
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
# add dns server
DNS1=8.8.8.8
DNS2=8.8.4.4
#--------------------------------------------------------------------------------
service network restart
[root@localhost ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:D7:31:51
inet addr:192.168.180.136 Bcast:192.168.180.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fed7:3151/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:110 errors:0 dropped:0 overruns:0 frame:0
TX packets:65 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:10767 (10.5 KiB) TX bytes:8445 (8.2 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)