Linux - Virtualization and CloudThis forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a server with 4 publicly routable IPs, and I want to put 4 VM on it and have them each with a public IP. Is this possible? I would assume with clever NAT I could do it, but I am not sure (even less sure what VM solutions support it).
Otherwise, I will only be able to have 3 VM, as 1 IP is used by the host, which would require buying more IPs.
Last edited by ThelenShar; 12-27-2010 at 11:14 PM.
If your Server have capacity(memory cpu and disk) you can run 4 VM with private IP's, NAT the local VM IP's with respective public IP on default gateway from where the local traffic route to the internet(may be it could be a router)
Distribution: Fedora on the desk / Gentoo in the Racks
Posts: 36
Rep:
You can apply multiple public ip's to the same interface on your host system by simply adding virtual interfaces with ifconfig. As in, "ifconfig eth0 192.168.1.2", "ifconfig eth0:1 192.168.1.3", "ifconfig eth0:2 192.168.1.4" and so on. This enables one physical interface to have multiple ip's. Now yes it's true that there are better ways of doing this, the fact is that this works quick and simple. As for binding the interfaces to your virtual machines, that's a much more involved question and depends on what virtualization system your using.
X.X.X.105 is assumed to be the actual eth0 IP address
the scripts shown here are used on a dd-wrt router, so the first lines specifying the interface and defining the virtual IPs would probably be better done in /etc/network/interfaces (or equivilent for fedora), but the rest is generic enough that it should run on almost ANY *NIX setup that uses iptables
replacing the X.X.X addresses with the PUBLIC IP addresses
and the Y.Y.Y addresses with the PRIVATE IP addresses of the virtual machines
and of course you would repeat the lines from the first two sections for each combination of public addr/private addr/port (one port per public IP)
of course the above assumes that the VMs are web servers (port 80), but you could easily change the port numbers to suit whatever services are running on each, of course if one is a web server, one a mail server, and one an ftp server then with the above setup you only would in theory need one public ip
the above are scripts that would have to be run every time the computer boots
this splits multiple incoming ports from the same IP address to each virtual machine
either way can be done but either way as i mentioned, NAT is the responsibility of the HOST (the os running on the REAL machine) to act as the traffic cop so to speak that directs the traffic to the proper VIRTUAL machines
this is assuming you are using a LINUX based os for your host OS, if you are using windows as your host os, good luck
(yes im sure someone will pick the above scripts apart and find something wrong, but you get the general idea i hope)
I shouldn't have mentioned NAT, everyone seems to be getting caught up in that >_<
We don't need/want any NAT for 3 of the public IPs, they can just be routed normally to the VM without fiddling.
The problem is, the VM host needs an IP address, meaning that somehow the last VM will need to be NAT'd or something, such that it can 'be' the host IP.
I am assuming I can just change the ports for the host server (ssh, ftp, VM control port etc) to something else (say in 60k range), but outside of that we don't want to have to manually NAT everything from guest 4. ie, 1-59999 will be NAT'd automatically.
I think there isn't a very simple or clean solution, it might just require purchasing more IPs (which sadly costs over $100USD a month >_<)
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233
Rep:
if that's the case then you probably just need to create a bridged interface between the real network card and the virtual network card, that way the virtual nics are directly exposed to the lan but what i was describing was more along the lines of port forwarding, which leaves any other port not assigned to the vms open to the host, and nat isn't a manual process per-se other then configuring the script and setting it to run on boot, after that it's automated
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.