First step: Activate the network card
System installed after the default network card is eth0, with the following command to activate this network card.
# ifconfig eth0 up
Step two: Set the network card to start when entering the system
If you want to automatically get the IP address to the Internet every time you turn on, you should set up the network service when the system starts. Linux is a bit different from Windows is a lot of services by default is stopped, and you use the service when you start the service, but did not set it as the default startup, the next time to enter the system this service is still stopped. The following is a way to set up network services to start when the system starts.
Use the Chkconfig command to enable network services to start by default when the system boot level is 2345.
# chkconfig--level 2345 Network on
Step three: Modify the NIC file Ifcfg-eth0
Modify the Ifcfg-eth0 file and set the value of Onboot to Yes so that the network service uses the NIC when it starts. Set the value of Bootproto to DHCP, allowing the network card to automatically obtain an IP address from the DHCP server.
# Vi/etc/sysconfig/network-scripts/ifcfg-eth0
Onboot=yes
Bootproto=dhcp
Summarize:
Usually the third step is the most important, because most Linux system default network service is also started when the system is started, the NIC is enabled, as long as the third step, and then use the following command to start the Network service OK.
# Service Network Start
Configure static IP address Internet and dynamic IP address expatiating, modify Ifcfg-eth0, and then use command Service network retart Restart network services.
Device=eth0
ipaddr=192.168.1.100
netmask=255.255.255.0
gateway=192.168.1.1
dns=8.8.8.8
Bootproto=static
Onboot=yes