VMware Cloud Community
eng20196
Contributor
Contributor

Static IPs for Virtual Machines

Greetings,  I'm new to the ESXi5.1 and can't seem to locate a way to assign static IPs to Virtual Machines.

My environment:  ESXi5.1 installed on PowerEdge server with 4 Ethernet port NIC.

                             2 Virtual Machines (VMs) running CentOS-7 Minimal

                             Connecting from VSphere Client to ESXI server over Port 0 of the NIC

Port 0 of the server NIC is the Management Interface connected to vswitch0 with static IP 192.168.208.x

No other machines are associated with this switch/interface.

Port 1 of the server NIC is connected to vswitch1 and has two VMs connected to it. VLAN100 to VM1 and VLAN200 to VM2

Port 2 of the server NIC is connected to vswitch2 and has the same two VMs connected to it without VLANs.

Port 3 of the server NIC is unused at this time.

Port 0 static IP was assigned when installing the ESXi software on the server.  Port 1 requires no IP address and will operate in promiscuous mode.

Port 2 will be connected to a 10.10.x.x network and requires a static IP/Gateway/DNS.  I can't locate the form to assign it.

Any assistance is greatly appreciated.

7 Replies
vAMenezes
Enthusiast
Enthusiast

Seems like there is some confusion here. Are you trying to assign static IPs to your VMs as the title of the question states, or to the port group within that virtual switch you created? Did you create a port group within that vswitch2? Maybe that's what you're missing. Or if I'm wrong just please clarify.

Reply
0 Kudos
eng20196
Contributor
Contributor

Yes, I am needing to assign static IPs to the VMs.  There are 4 physical interfaces on the server.  I have only been able to assign one IP address and that's the management IP.

Very odd.  I have VM's connected to VS's but can't assign static IPs.  or don't know how.

Thanks

Reply
0 Kudos
eng20196
Contributor
Contributor

I believe I found my configuration problem.  When adding "Networking" and new virtual switches I did not select vMKernel Port.  Changing from VM Port Group to vMKernel Port allows the assignment of IP addressing.

Reply
0 Kudos
eng20196
Contributor
Contributor

Still testing but there is a fault with my previous comment.  I have now created vSwitch Port Group and added a vmKernel port to that switch.  If I ever get this working I'll share my resolution.

Reply
0 Kudos
a_p_
Leadership
Leadership

I'm not sure I can really follow you. Why do you want to assign IP addresses to the port groups!? An IP address on a port group (i.e. a VMkernel port) is only required for host features (e.g. Management Network, vMotion, iSCSI, ...). IP addresses for VM's are assigned in the guest operating systems themselves. It's basically the same as in a physical environment.

André

Reply
0 Kudos
Kisan_VMware
Enthusiast
Enthusiast

Hi ,

Static IP's can be set for Virtual Machine at OS level. Make sure you have allocated NIC adapter to Virtual machine while creating VM. since this is CentOS follow the following info for assigning static IP to virtual machine.

http://www.mustbegeek.com/configure-static-ip-address-in-centos/

After installing CentOS you will wan’t to configure IP address. CentOS is mostly used as Server. So you will want to give it a static IP address. By default CentOS interface is configured to receive IP from DHCP server. Here I will show you how to configure static IP address in CentOS system.

Configure Static IP Address in CentOS

The following steps will show configuration of static IP address in CentOS machine.

  1. Files needed for network configuration are under /etc/sysconfig/network-scripts. So open the file with editor like nano or vi. Here I will use nano editor. After you start your server running CentOS enter root user credentials and get in. Type the command,
    # nano /etc/sysconfig/network-scripts/ifcfg-eth0
  2. You will see default configuration like this,
    Configure Static IP Address in CentOS
  3. Now change the configuration to this,IP Address Changed
  4. Then save the file, to save press ctrl+x to exit and press y for confirmation.
  5. Now restart the network services by issuing the command,
    [root@hostname~]# service network restart
  6. To verify the IP address issue the following command,
    [root@hostname~]# ifconfig
    You will then see following information,Configure Static IP Address in CentOS
  7. After configuring IP address now let’s configure DNS. Name server or DNS information is stored in different file. The location is, /etc/recolv.conf. Again using nano editor to configure DNS information,
    [root@hostname~]# nano /etc/resolv.conf
    By default, this file is empty, so enter at least one entry here,
    nameserver 4.2.2.2
    The name server IP address can be different depending on your network scenario. I will use www.google.com. Now save the file and exit. You can test the configuration by issuing ping command.
eng20196
Contributor
Contributor

Brilliant!  Thank you.

So I went back to my old configuration using Port Groups and assigned static IPs within the OS of the VM.  Had to tweek some routing options but now have 3 VMs connected to 3 VSwitches all sharing the same 3 NICs.

Reply
0 Kudos