12

So after fighting the VMWare network giant for the past day, I decided to give in and ask for help. I have a CentOS 6 image running on Windows 7 using a NAT on VMWare Workstation 8.0.2 build-591240, and for some reason, I can no longer connect to the internet with a static IP address. This seems to only to apply to static, and not DHCP, which tells me it's either: some program on my Windows 7 OS that's blocking the connection for that IP address, or there's something weird that happened to my configuration on the CentOS image.

I didn't know if this was due to a yum update, so I tried reinstalling VMWare tools. This didn't seem to fix the issue. I've also tried the following:

  1. Made sure the VMnet connection was connected (stupid, but had to check... also I can connect to the internet with DHCP)
  2. Made sure my firewall on Windows allowed for VMware to connect to the internet
  3. I've seen/read that Windows sometimes blocks ping requests, so I tried going to www.google.com in Firefox, this got a "Server not found response"... so do I have to do something different for DNS??
  4. I checked the registry of my Windows machine, I only have 1 entry for a default gateway

Like I said, this seemed to happen out of the blue. The image could connect to the internet before with no issue. Is anyone aware of a CentOS update that might cause this? I've added my configuration below to save some debugging cycles:

[root@MyCentOS ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:A0:51:BD
          inet addr:192.168.88.128  Bcast:192.168.88.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:683 errors:0 dropped:0 overruns:0 frame:0
          TX packets:67 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:64242 (62.7 KiB)  TX bytes:8055 (7.8 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:1049 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1049 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:68417 (66.8 KiB)  TX bytes:68417 (66.8 KiB)


[root@MyCentOS ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="static"
IPV6INIT="no"
NM_CONTROLLED="no"
ONBOOT="yes"
IPADDR=192.168.88.128
NETMASK=255.255.255.0
GATEWAY=192.168.88.2
TYPE="Ethernet"

[root@MyCentOS ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=MyCentOS
GATEWAY=192.168.88.2

[root@MyCentOS ~]# service iptables status
iptables: Firewall is not running.
[root@MyCentOS ~]# service ip6tables status
ip6tables: Firewall is not running.
[root@MyCentOS ~]# cat /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

[root@MyCentOS ~]# ping 192.168.88.2
PING 192.168.88.2 (192.168.88.2) 56(84) bytes of data.
64 bytes from 192.168.88.2: icmp_seq=1 ttl=128 time=0.391 ms
64 bytes from 192.168.88.2: icmp_seq=2 ttl=128 time=0.271 ms
^C
--- 192.168.88.2 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1349ms
rtt min/avg/max/mdev = 0.271/0.331/0.391/0.060 ms

[root@MyCentOS ~]# ping www.google.com
ping: unknown host www.google.com

[root@MyCentOS ~]# uname -a
Linux MyCentOS 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@MyCentOS ~]# vmware-toolbox-cmd -v
8.8.2.10499 (build-590212)
gordysc
  • 234
  • 1
  • 4
  • 22
  • I tested changing the IP address to 192.168.88.131 in the static configuration (worked with DHCP at this address). And this seemed to fix the issue... Will investigate for other people's future reference to see what's blocking xxx.xxx.xxx.128.. – gordysc Feb 25 '14 at 10:14

7 Answers7

53

The best option is to let it grab an ip automatically from DHCP:

dhclient -v

This will let centos get an ip automatically.

Mona Jalal
  • 34,860
  • 64
  • 239
  • 408
Developer
  • 718
  • 8
  • 8
  • 2
    I'll accept this given no one else has added anything to this thread in the hopes it'll benefit someone down the road. However, the main driver behind this is I wanted a static IP address, whereas the accepted answer is for a non-static address. After looking into it more, another viable solution I found was to simply change the static IP address to another address. I'm guessing VMware changed the MAC address underneath me, and kept the IP address bound to the older MAC. Simply put, if you hit this issue, try assigning a different static IP address. – gordysc Jul 29 '14 at 06:31
  • FYI, this needs to be run every time the server boots – Drakes Oct 14 '16 at 19:02
2

For further readers

I ran through the same problem. Sometimes problem could be in the host machine (Windows 10, and VMware workstation 12), for example in my case.

Check if VMnetDHCP service is running.

right click on windows icon -> task manager -> service tab

if not, then start the service and restart your guest OS in VMware. VMnetDHCP service

Abu Shumon
  • 1,834
  • 22
  • 36
1

I just fixed this problem, not sure if anyone found the soultion. How I fixed it for myself was in the VMware (I have 12th version) I went to

  1. Edit
  2. Virtual Network Editor
  3. Restore Defaults
  4. then click okay
  5. I reinstalled Centos 7
  6. Click on Network & Host Name
  7. Click On for Ethernet
  8. Wait for details to populate i.e. ip address, subnet mask, dns...
  9. Works.

You may not have to uninstalled the OS just try going to edit and virtual network editor first and restoring to defaults first. This should work for all OS you install on VMware.

GiGi G
  • 11
  • 1
0

From what i see, the problem could be you missed setting up dns entries in the vm while setting ip address.

Please edit

nano /etc/resolv.conf
nameserver 192.168.88.2

Nameserver should be the dns server of your network, if its your home router it should be same as your gateway, or just check the network of your pc and assign the same dns address.

Also if you would like to use static ip address, just change the mode to bridge networking and assign the ip address and dns of your network.

Nt adapter has different ip address in different subnet than your bridged networking which is same as the network your pc is in.

0

If you would like another solution, change the network adapter from bridged to NAT, and it's worked for me.

enter image description here

lio
  • 419
  • 5
  • 9
0

This was my problem too. When you create a NAT in VMware Workstation like this: 192.168.X.0/24 , your HOST ip address will be :

vmnet1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.X.1  netmask 255.255.255.0  broadcast 192.168.X.255
        ether <GENERATED MAC ADDRESS>  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1264  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

you should change the NAT Gateway. (eg. 192.168.X.254) in both VM & Virtual Network Editor.

A.Emami
  • 19
  • 1
  • 3
-2

MAKE SURE YOU PREFIX= IS NOT /32 and is 24 or replace with NETMASK=255.255.255.0

Simple mistake.

found in your

/etc/sysconfig/network-scripts/eth**** 
Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
damian
  • 1