1. Default network configuration on Centos or RedHat for eth0 (dhcp)
vi /etc/sysconfig/network-scripts/ifcfg-eth0DEVICE=”eth0″
BOOTPROTO=”dhcp”
HWADDR=”00:0C:29:55:52:41″
IPV6INIT=”yes”
NM_CONTROLLED=”yes”
ONBOOT=”yes”
TYPE=”Ethernet”
UUID=”67ffccb8-2408-4ecb-bdd9-baf81f4911af”
2. Configure static IP AddressBOOTPROTO=”dhcp”
HWADDR=”00:0C:29:55:52:41″
IPV6INIT=”yes”
NM_CONTROLLED=”yes”
ONBOOT=”yes”
TYPE=”Ethernet”
UUID=”67ffccb8-2408-4ecb-bdd9-baf81f4911af”
vi /etc/sysconfig/network-scripts/ifcfg-eth0DEVICE=”eth0″
BOOTPROTO=”static”
HWADDR=”00:0C:29:55:52:41″
IPV6INIT=”yes”
NM_CONTROLLED=”yes”
ONBOOT=”yes”
TYPE=”Ethernet”
IPADDR=192.168.0.112
NETMASK=255.255.255.0
UUID=”67ffccb8-2408-4ecb-bdd9-baf81f4911af”
3. Configure Default gateway and hostnameBOOTPROTO=”static”
HWADDR=”00:0C:29:55:52:41″
IPV6INIT=”yes”
NM_CONTROLLED=”yes”
ONBOOT=”yes”
TYPE=”Ethernet”
IPADDR=192.168.0.112
NETMASK=255.255.255.0
UUID=”67ffccb8-2408-4ecb-bdd9-baf81f4911af”
vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=Centos6.3
GATEWAY=192.168.0.1
4. Restart networkNETWORKING=yes
HOSTNAME=Centos6.3
GATEWAY=192.168.0.1
[root@Centos6 ~]# /etc/init.d/network restart
Shutting down interface eth0: Device state: 3 (disconnected)
[ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: Active connection state: activating
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/4
state: activated
Connection activated
[ OK ]
[root@Centos6 ~]#
5. Configure DNS ServerShutting down interface eth0: Device state: 3 (disconnected)
[ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: Active connection state: activating
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/4
state: activated
Connection activated
[ OK ]
[root@Centos6 ~]#
[root@Centos6 ~]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 8.8.4.4
# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts like so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lab.foo.com bar.foo.com
[root@Centos6 ~]#
# Generated by NetworkManager
nameserver 8.8.4.4
# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts like so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lab.foo.com bar.foo.com
[root@Centos6 ~]#
No comments:
Post a Comment