-1

I have a server with ESXi installed. And added some Virtual Machines (Ubuntu).

All the VMs are having a private IP, but how can I assign a public IP to a VM?

What I want is to assign a public ip (IPv6 preferred) to a VM, so I can reach a specific VM based of an IP.

What I want is to be able to ssh into a specific VM, on port 20 and the assigned IP. And the same for websites, so port 80 etc forwarding.

I have already a VM Port Group in ESXi, and Virtual Machines. See this: https://www.dropbox.com/s/efnrun70s7te8e5/a.jpg?dl=0

closed as off-topic by HopelessN00b Mar 14 '15 at 16:54

  • This question does not appear to be about server, networking, or related infrastructure administration within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Your virtual switch doesn't have any relation to assigning ip addresses to your virtual machines. As EEAA stated in his answer, you assign ip addresses to virtual machines the same way you assign them to physical machines. You perform NAT, port forwarding and routing for virtual machines the same way you do for physical machines. What are you trying to achieve? – joeqwerty Mar 14 '15 at 16:10
  • I suggest you get some basic virtualisation training and re-read what this site is for and what it's not – Chopper3 Mar 14 '15 at 16:52
  • Questions must demonstrate a minimal understanding of the problem being solved. Try including attempted solutions, why they didn't work, and the expected results. See How can I ask better questions on Server Fault? for further guidance. – HopelessN00b Mar 14 '15 at 16:54
2

You assign public addresses the exact same way you'd assign private addresses.

Of course you will need to ensure that proper routing is in place, otherwise nothing will work.

Alternatively, you can port forward from your router to these VMs.

  • Added a picture to clarify it all. – user2382765 Mar 14 '15 at 16:05
  • Sorry, that doesn't clarify anything. Give us as much detail as you can, including the entire network infrastructure between your ISP and the ESXi server. – EEAA Mar 14 '15 at 16:07
  • What do you think needs to be clarified? Remember: Nothing magical happened just because someone said virtual. A network is still a network. A route is still a route. – Rob Moir Mar 14 '15 at 16:36
0

There are a couple things which we'd need to clarify to start with:

  • Whether you actually want to dedicate a public IP address to that VM or whether you just want to access the two servers on that port
  • Whether you want to be able to use the public IP internally as well as externally

Note: All of the below is explained with the assumption that by private IPs you mean an internal network address, accessible on your internal network, not private to the ESXi host.

If you purely wish to access the VM on those services from an external environment you can configure port forwarding on your internet facing router to forward the ports 22 (SSH) and 80 (HTTP) to the VM.

If you wish to access any arbitrary ports on the VM (externally) without re-configuring your network equipment constantly, the best plan would be to configure Network Address Translation (NAT) on your network equipment, to translate the(/a) public IP address through to the private internal address.

If you need to access this public IP address internally as well as externally, you'll need to configure your internet facing router to perform a (Loopback) hairpin NAT to reroute traffic directed from the internal network to the public IP address. More details about hairpin NAT here: Loopback to forwarded Public IP address from local network - Hairpin NAT

Not the answer you're looking for? Browse other questions tagged or ask your own question.