Configure Static IP CentOs 6.6 Minimal on vmware

after installing centos minimal on a vmware vmachine you will have no internet access at all, the default dhcp client on the vm should be started using command “dhclient” only.

this is good cause by default the network settings for a virtual machine on vmware is set on NAT. once we start the dhcp we can see the information needed for the static ip configuration using ifconfig.

to see what your current ip on dhcp is type:

[root@localhost ~]# ifconfig | grep addr

in this case the result for me was:

[root@localhost ~]# ifconfig | grep addr
eth0      Link encap:Ethernet  HWaddr 00:0C:29:B3:ED:01
          inet addr:192.168.35.129  Bcast:192.168.35.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:feb3:ed01/64 Scope:Link
          Interrupt:19 Base address:0x2000
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host

this means my ip address given through vmware dhcp server is 192.168.35.129. What I want to do is to give the ip address of 192.168.35.100 to my minimal machine. this will make it easier for future use.

there are few files that has to be edited. I usually use nano as the text editor, by default this does not come in centos minimal, so if you want to install it run “yum install nano -y”.

ok the first file we need to edit is the eth0 adapter file. it is located at: /etc/sysconfig/network-scripts/ifcfg-eth0

so to edit it with nano we need to run:

[root@localhost ~]# nano /etc/sysconfig/network-scripts/ifcfg-eth0

so at the end it should look like this:

DEVICE=eth0
HWADDR=00:0C:29:B3:ED:01
TYPE=Ethernet
UUID=726b6daf-457e-43ae-a9d1-398ec1f8e0b7
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=192.168.35.100
NETMASK=255.255.255.0


notice I have changed the bootproto to none! now its time to edit “/etc/sysconfig/network”. use nano in the same way.

enter you gateway like this which in my case is : 192.168.35.2

NETWORKING=yes
HOSTNAME=localhost.localdomain
GATEWAY=192.168.35.2

after doing above it’s suggested you to add DNS servers to resolv.conf file within /etc/ directory.

Open “/etc/resolv.conf” and add dns server IP’s with “nameserver” before them, let say if you are going to use Google DNS servers which are 8.8.8.8 & 8.8.4.4, the content of /etc/resolv.conf will be:

nameserver 8.8.8.8
nameserver 8.8.4.4

thats all. restart your network and you are good to go.

 

 

Incoming search terms:

  • centos 6 6 ip address
  • centos 6 6 network configuration
  • centos 6 static ip
  • Network configuration CentOS 6 6
  • centos 6 6 static ip
  • static ip centos 6 6
  • centos 6 6 interfaces with terminal
  • 6 6 ip configuration
  • install centos vmware ip address
  • vsphere 6 change database centos ip address

2 comments

  1. in my case it was necesary to change the “ONBOOT=no” to “ONBOOT=yes” in order to make the network interface take the IP address i gave it when i restart the network service.

    All the other tips, work like a charm.

    Thnx a lot!

  2. it has to be set to yes to start eth0 on boot.
    thanks for reminding it, I forgot to mention it. I have updated the post though.

    Glad I could help.

Leave a Reply