How to configure Network Settings in CentOS command mode?

1. Log in to the CentOS via console.

2. Change directory to /etc/sysconfig/

3. Add the gateway information to the file network. You can use a text editor such as nano or vi to edit the file.

i.e. vi /etc/sysconfig/network

The network file should look similar to this


Please note that your gateway and hostname should be different from the above example. Once you finish adding the GATEWAY line, save the file and exit.

4. Next, you need to modify the Ehternet interface 0 file located at /etc/sysconfig/network-scripts/ifcfg-eth0


vi /etc/sysconfig/network-scripts/ifcfg-eth0


Again, your IPADDR and NETMASK settings may be different from the above example. Once you finish editing the file, save it and exit.

5. The next file you need to modify is resolv.conf located in /etc/resolv.conf

Add the following 2 lines to the file.


Please check the welcome email you received from Cybercon for the name server IP address. Yours may not be or Once that is done, save the file and exit.

6. After you modify all the above files, you need to restart the network. You can do so by issuing the following command.

service network restart