5 minutes per day in Cent OS - 2 - Configure for network interface

1. The first step to determine what is the exact network interface existing in your system is

ifconfig

Check for the information of an interface, normally it is eth0 and with an IP address from DHCP.

In case, the network interface is still existing but it cannot enable and does not have an IP release so,

ifconfig eth0 192.168.0.10 netmask 255.255.255.0 
or
ip addr add 192.168.0.10 dev eth0

Otherwise, the configuration file can be modify then restart network service to effect.

cd /etc/sysconfig/network-scripts/

vi ifcfg-eth0

It should be like this


DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
NETMASK=255.255.255.0
IPADDR=192.168.0.10
TYPE=Ethernet
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=centos.how2centos.com
GATEWAY=192.168.0.1


Note:
You don't have to understand to much about VI command and just try these below to modify then exit from edit mode.


Method 1: issuing :w to save current file content

To save the current content under the name of the file that you currently open. However, please make sure that you are in command mode of vi
:w

Method 2: issuing :w filename to save current file content as different file name

If you wish to save the file under different file name, you can issue the :w filename
:w newfilename.txt

Method 3: issuing :wq  to save current file content and quit the vi application

The following command let you save the current open file content and quit the application after save operation.
:wq

If you merely open the file content and do not make any changes to the open file, you can issue the  followingcommand
:q

You can  also issue the following command to force quitting without saving.
:q!
2. Restarting network service , it would be effect immediately 

# service network stop
# service network start
# service network restart




Comments

Popular Posts