How to add ip address in linux
First, need to edit the set up for the Ethernet. Let’s start with editing this file:
1.# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=1f:65:9d:63:ec:e1
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
IPV6INIT=no
USERCTL=no
NM_CONTROLLED=yes
PEERDNS=yes
IPADDR=192.168.0.201
NETMASK=255.255.255.0
Now, configure default getaway:
1. # vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=centos6
GATEWAY=192.168.0.1
Configure DNS Server
# vi /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
Now restart the network interface:
Comments