First step: Activate the NIC
After the system is installed, the default NIC is eth0, which activates the NIC with the following command.
# ifconfig eth0 up
Step two: Set the NIC to boot when it enters the system
If you want to get IP address automatically every time you turn on the Internet, you must set up the network service to start the system. Linux is a little different from Windows is that many services are stopped by default, and you use the service at some time to start the service, but did not set it as the default boot, the next time you enter the system this service is still stopped. Here's how to set up a network service that also starts when the system starts.
Use the Chkconfig command to have the Network service start by default when the system boot level is 2345.
# chkconfig--level 2345network on
Step Three: Modify the NIC file Ifcfg-eth0
Modify the Ifcfg-eth0 file, set the value of Onboot to Yes, and let the network service use the NIC when it starts. Set the value of Bootproto to DHCP so that the network card automatically obtains the IP address from the DHCP server.
# Vi/etc/sysconfig/network-scripts/ifcfg-eth0
Device=eth0ipaddr=192.168.0.47NETMASK=255.255.255.0GATEWAY=192.168.0.1DNS=114.114.114.114HWADDR=xx: 0C: in: CD:94: A8type=Ethernetuuid=7d33b5b2-0651-4077-ad0a-65151e63c85bonboot=yesnm_controlled=Yesbootproto=Staticuserctl=Nopeerdns=Yesipv6init=no
4. Restart Service
Service Network restart
linux-Setting the fixed IP