Skip to content

Instantly share code, notes, and snippets.

@wilsoncook
Created July 3, 2014 09:57
Show Gist options
  • Save wilsoncook/46b7a318e33429fab898 to your computer and use it in GitHub Desktop.
Save wilsoncook/46b7a318e33429fab898 to your computer and use it in GitHub Desktop.
安装CentOS mininal版本后,如何启动network
Looks like your eth0 is not set up. Here is what I did to fix mine on CentOS 6.4.
sudo su -
cat /etc/sysconfig/network |grep -i network
This should return: NETWORKING=yes - If it does not, then change it to yes.
vi /etc/sysconfig/network-scripts/ifcfg-eth0
This should look like:
DEVICE="eth0"
HWADDR="08:00:27:07:9e:57"
NM_CONTROLLED="YES"
ONBOOT="NO"
There are a few options that we want to change here, NM_CONTROLLED needs to be NO, ONBOOT needs to be YES, and finally add this code at the bottom:
BOOTPROTO="dhcp"
This will allow you to grab an IP from your DHCP and essentially enable IPV4.
Now the whole file should look like this:
DEVICE="eth0"
HWADDR="08:00:27:07:9e:57"
NM_CONTROLLED="NO"
ONBOOT="YES"
BOOTPROTO="dhcp"
Save and close. Now, lets restart the network service to reload with these settings:
[root@Development ~]# service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0:
Determining IP information for eth0... done.
[ OK ]
Notice the ‘eth0′ – awesome! Now lets check to see if we got an IPV4 from our DHCP:
ifconfig
You should now see 'eth0'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment