Prasad
Prasad

Reputation: 333

How to fix ipaddress in CentOS?

I am using VMWare 10, in that installed CentOS 6.5 with two networking interfaces (eth0,eth1).

When I try to use the vmware, every time the ipaddress changes.

How to make the IP address constant (not a static IP address)?

Upvotes: 0

Views: 2692

Answers (1)

ganeshragav
ganeshragav

Reputation: 8915

Vmware will by default allocate dhcp ip addesses. In order to have static IP address, please assign static IP address in Centos using below steps

Static IP assignment for eth0

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

Sample output:
DEVICE="eth0"
BOOTPROTO="dhcp"
HWADDR="xx:xx:xx:xx:xx:xx"
NM_CONTROLLED="yes"
ONBOOT="no"
TYPE="Ethernet"

Configure eth0: In above you can look that IP address is assigned dynamically using dhcp. Change this to below, make sure you aren't changing hwaddr, device - leave it unchanged.

vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="static"
HWADDR="xx:xx:xx:xx:xx:xx"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
IPADDR=192.168.1.2
NETMASK=255.255.255.0

service network restart

It will work now.

Upvotes: 1

Related Questions