VMware Cloud Community
vmnewb0
Contributor
Contributor

Reposted: Can't ping esxi host from ubuntu guest vm

Sorry but I accidentally marked my previous discussion as answered and I can't figure out how to undo that. The problem has not been solved yet so I'm reposting:

I need to get my ubuntu vm connected to the network. This is my first foray into using vmware and virtualization in general. I really have no clue what I'm doing here.

I have an esxi 5.5 server running bare metal on a xeon server, and using the trial version of vSphere client 5.5 on my Windows laptop I've created and deployed my first vm using an ubuntu 12.04 LTS iso image.

I've installed the vmWare tools using default setting on the ubuntu guest vm. It complained about no X support but seemed to install alright since the vmware-toolbox-cmd command seems to function.

The esxi server has an ip address of 184.164.130.34, and the network admins have provided the ip range 184.164.130.34 to 184.164.130.38 to use. So I configured ubuntu to use an ip address of 184.164.130.35.

What am I missing here? Must I assign that vm ip address 184.164.130.35 somewhere in the vSphere client?

Here is a picture of my network config in vSphere:

vsphereNetworkingPortGroupFixed.jpg

Here is the pic of the ifconfig output from the ubuntu guest vm:

ubuntuGuestIfconfig.jpg

here is the pic of /etc/network/interfaces:

ubuntuGuestEtcNetworkInterfaces.jpg

here's what happens when I try to ping the host esxi server from this guest vm:

ubuntuPing.jpg

Any help here is much appreciated! Thanks!

11 Replies
vuzzini
Enthusiast
Enthusiast

Hello vmnewb0,

Welcome to VMware Communities Smiley Happy

The configuration of ESXi host networking looks right to me. Are you able to ping the gateway from Ubuntu VM ?

Check if firewall is enabled. Try to disable firewall and check whether you are able to ping the ESXi host management ip. You may refer below steps:

Find status of firewall

Login as root user either by opening the Terminal or login over the ssh based session. Type the following command:

$ sudo ufw status

Sample outputs: Status: inactive

Ubuntu stop iptables service command

Type the following command to unloads firewall and disables firewall on boot:

$ sudo ufw disable

Restart networking services.

If you found this or any other answer useful please consider the use of the Helpful or Correct buttons to award points. Sandeep Vuzzini Sr. DevOps Engineer
0 Kudos
vmnewb0
Contributor
Contributor

Thanks Sandeep. The ufw status command shows that the firewall is inactive, so I guess that's not the problem. I can't ping the gateway from the ubuntu vm either.

One interesting thing: I just noticed on login that there is an assigned address for something called virbr0: 192.168.122.1. I guess that's a virtual bridge interface? I never configured that ip address in ubuntu or the vSphere client. I can ping that address from inside the ubuntu vm, but not from inside the esxi host terminal.

Please let me know if you have any other ideas. Thanks.

0 Kudos
vuzzini
Enthusiast
Enthusiast

virbr0 is a virtual network interface, which is used as NAT that allows KVM guests to access the external network. You may remove and un-define the virbro network interface settings and configurations using the following set of commands:

# virsh net-destroy default

# virsh net-undefine default


Below is a brief example to configure an IP address in ubuntu, you can use the ifconfig command in the following manner. Just modify the IP address and subnet mask to match your network requirements.

$ sudo ifconfig eth0 184.164.130.35 netmask 255.255.255.248

To verify the IP address configuration of eth0, you can use the ifconfig command in the following manner.

$ sudo ifconfig eth0

To configure a default gateway, you can use the route command in the following manner. Modify the default gateway address to match your network requirements.

$ sudo route add default gw <add the gateway address here> eth0

To verify your default gateway configuration, you can use the route command in the following manner.

$ route -n

Ex: Let's consider that you added a default gateway as 10.0.0.1, you see the output of "route -n" as below:

pastedImage_2.png

Now, run: "sudo ifup eth0"

* To configure your server to use DHCP for dynamic address assignment, add the dhcp method to the inet address family statement for the appropriate interface in the file /etc/network/interfaces. The example below assumes you are configuring your first Ethernet interface identified as eth0.

auto eth0

iface eth0 inet dhcp

By adding an interface configuration as shown above, you can manually enable the interface through the ifup command which initiates the DHCP process via dhclient.

sudo ifup eth0

If you found this or any other answer useful please consider the use of the Helpful or Correct buttons to award points. Sandeep Vuzzini Sr. DevOps Engineer
0 Kudos
vmnewb0
Contributor
Contributor

So I should remove the virtual network interface? I thought that was necessary for the guest vm's ethernet driver to talk to the virtual network. ie don't I need that for an internet connection in the guest VM?

Also, you're telling me that I need to configure DHCP. Is that necessary? I'm pretty sure I need to use static ip addresses based on what I've said above, the fact that the network admin gave me a range of addresses that I can use. Isn't that static assignment? Please clarify.

Unfortunately the route command isn't installed on the ubuntu vm and installing it without an internet connection is a real challenge because of package dependencies. However as you can see from the pic I initially posted of /etc/network/interfaces from the ubuntu guest vm, it has those settings.

I apologize. My physical networking knowledge is pretty rusty, but I've been brushing up through some tutorials.

Here's what I'm confused about. I've leased a dedicated server and now I'd like to run ubuntu under vmware to do some performance testing in that environment. The server leasing company gave me this info for a machine with an esxi hypervisor installed:

Netmask:        255.255.255.248

Gateway:        184.164.130.33

First usable IP: 184.164.130.34

Last usable IP:184.164.130.38

Server Name: e3-1240v3.BL-phx0.1.141.9.2.I6.securedservers.com

Now I want to setup a guest vm and connect it to the internet. Sounds simple right? Based on this setup, I should be able to assign the guest vm an ip address of 184.164.130.35, correct? Is that using DHCP? From what I understand it is not DHCP, but rather static assignment.

Do I give my ubuntu guest vm a netmask of 255.255.255.248, gateway of 184.164.130.33, and IP address of 184.164.130.35?

I'm totally confused about how this virtualized networking works. If a machine across the internet wants to contact my guest vm at ip adddress 184.164.130.35, how does it know to go through the physical server at ip address 184.164.130.34? I never entered the address 184.164.130.35 in any configuration in vSphere. How would the outside world know where to find 184.164.130.35?

Thanks again for your help.

David

0 Kudos
njcmdrx
Contributor
Contributor

Not sure this will be your issue, however, I had a case with a Linux vm.  I could NOT ping the ESX host I was on.  I could ping others.  I ran a tcpdump and when I pinged, I noticed I was sending an "ARP who-has" packet to get the MAC address from my ping target.  This packet is a broadcast asking the host who owns the ip to respond with its MAC address.  My ESX host would respond to all other ARP requests, except my Linux vm's request.  So, it would respond to others, just not this one particular vm.

I resolved this by vmotioning to another host, the ping started to respond, then I vmotioned back and pings continued to work and I never had an issue again.  I never changed a thing on the vm.  However, I knew the mac table on my vm still contained the record, and had no reason to resend the broadcast asking for the host's MAC.  I never checked again to see if the ARP who-has started working again, and the issue never re-occurred since.  I chalked it up to some software glitch in the dvswitch or the host that cleared when the vmotions re-registered the vm on the switch in the vmotion process.

------

reading some more detail on your question...since you are testing you cant exactly vmotion around.

Can you ping the gateway184.164.130.33 from ESX service console or your vm?

I assume you can ping the address you assigned to the vm?

Try building another vm, give it one of the other addresses and see if you can have the 2 vm's ping each other.  If they ping each other but not any other addresses, its in the config of the networking on the ESX side of the setup and we can look at that.

-------

I also just noticed the 'half duplex' setting on the switch in your screenshot.  I would double check that.  make sure the service console is talking.

I see 2 vswitches.  ESX mgmt console is on one with a 100 half duplex NIC, the other is on a 1000 Full NIC.  Are both nics plugged into the same hardware?  Seems strange.  You may not be able to ping from a vm on one vswitch to the console on another vswitch if the 2 physical nics don't network to each other.

I doubt you issue is on your vm if all of your settings are correct.  Looks like a ESX setup, physical switching issue from looking at screenshots.

as a test, connect the vm to the same vswitch as your mgmt console on vminic1, see if they can ping each other.

vmnewb0
Contributor
Contributor

With my old config I could not ping the gateway as described in the previous posts. However now I can with this new config in /etc/network/interfaces. This required a few changes there, one of them being that the gateway ip is now the same as the host esxi server's ip. However I cannot ping any valid ip address beyond the gateway, for example my own ip address or google's. However I can ping those outside ip addresses when logged into the host esxi server at ip address 184.164.130.34 (the vm's gateway).

What does that suggest?

/etc/network/interfaces:

auto lo

iface lo inet loopback

auto eth1

iface eth1 inet static

          address 184.164.130.35

          netmask 255.255.255.248

          network 184.164.130.32

          broadcast 184.164.130.39

          gateway 184.164.130.34

          nameserver 8.8.8.8 4.2.2.2

Thanks,

David

0 Kudos
vuzzini
Enthusiast
Enthusiast

Hello David,

Not sure why did you set the default gateway as ESXi host IP address. The default gateway is usually an access point to external/another network, so without properly configuring the default gateway the vm will not be able to connect to external network.

If you found this or any other answer useful please consider the use of the Helpful or Correct buttons to award points. Sandeep Vuzzini Sr. DevOps Engineer
vmnewb0
Contributor
Contributor

Hi Sandeep,

The network admins told me to set the gateway to the esxi host ip address. After doing that it allowed my to finally ping the esxi host address, but nothing past that. The default gateway for the esxi host is 184.130.164.33. Setting the guest vm gateway to the same value doesn't seem to help. I assume that's what you were implying... ie setting the vm guest default gateway to the same gateway that the esxi host uses?

0 Kudos
vuzzini
Enthusiast
Enthusiast

Hello David,

The VMkernel default gateway (Host gateway IP address) can be different from the VM default gateway; however, there needs to be proper routing between the two routes.

If you found this or any other answer useful please consider the use of the Helpful or Correct buttons to award points. Sandeep Vuzzini Sr. DevOps Engineer
0 Kudos
vmnewb0
Contributor
Contributor

So it turns out that the vSphere networking config was all wrong. The VM Network needed to be added to vSwitch0 so that it would be on the same switch as the Management Network as in this picture:

vsphereNetworkingFixed.jpg

0 Kudos
njcmdrx
Contributor
Contributor

Looking at the pic in the first post and the last one, I noticed you were at half duplex on vmnic1, and now the pic shows full duplex on vmnic1.  That can make a difference in connectivity.

You CAN use different vswitches, as long as the vmnics can connect via physical network components (switches and routers).  If they are same subnet and your masks are correct, layer 2 will get you there, if they are 2 different subnets, you need correct gateways and routing between the 2 physical nics to make them talk.

In larger environments, the management nics are commonly on their own nic and the vms use another.  By putting them on the same vswitch, you don't even need to technically connect the nics to any physical network gear or even connect a vnic and they will talk because the networking stays internal to the host.