How to assign multiple static IP's on vm

This is for discussing general topics about how to use VirtualBox.
orenpp1
Posts: 7
Joined: 30. Apr 2015, 23:52

How to assign multiple static IP's on vm

Post by orenpp1 »

Hi there,

I'm a newb and in need of help in configuring different static IP's for each of my VM's

Hardware:
single desktop, 1 NIC, virtualbox software (windows 7), standard DSL connection.

I have several static IP's purchased from my ISP.
each VM created was created with different virtual MAC address

I need each of my VM to show different static IP
Would appreciate any prompt response....
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: How to assign multiple static IP's on vm

Post by Perryg »

Use bridged mode for the network adapter and then assign the static address according to how the provider tells you to do it in the guest/s.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: How to assign multiple static IP's on vm

Post by Perryg »

Copied from PM
I've set all machines with a seperate dail up and they all have different public IP's
My problem is when surfing on one of the machines when a disconnection takes place
The machine will then use the host's dail up connection thus resulting in the same IP.

How can I disable the machines from connecting to the host's dail up connection??
Guest network actually uses the host network stack for connection. You can use bridged mode to connect static addresses to the guest, but it will still be using the host stack for the transport. If I gather what it is that you are trying to achieve it would probably be better to have a router from your DSL to the host and that way the host will not interfere as much with the guest connections. How this would work really depends on your provider and how they actually do the routing and for that you would need to contact them. There are simply too many different ways that the providers handle this for anyone to be able to tell how remotely.
orenpp1
Posts: 7
Joined: 30. Apr 2015, 23:52

Re: How to assign multiple static IP's on vm

Post by orenpp1 »

Thanks for the prompt answer,

Is there any way of blocking the machines from using the hosts network?
is there a way I can configure the machine's dail up connection differently?

I also noticed there is a Virtual network connection created on the host, should I use it?
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: How to assign multiple static IP's on vm

Post by Perryg »

It really depends on what you are trying to achieve. Do/does these guest/s need to be visible from the Internet?
orenpp1
Posts: 7
Joined: 30. Apr 2015, 23:52

Re: How to assign multiple static IP's on vm

Post by orenpp1 »

Hi,

Preferably yes...
orenpp1
Posts: 7
Joined: 30. Apr 2015, 23:52

Re: How to assign multiple static IP's on vm

Post by orenpp1 »

Also read in one post here I can just use windows firewall and create a rule that will disable the guests from reaching the host.

If this thing can be done I would appreciate anyone's idea on how to achieve so
BillG
Volunteer
Posts: 5105
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: How to assign multiple static IP's on vm

Post by BillG »

How the Windows firewall works is a Windows question, not a VirtualBox one.

I think that your problem is a lack of knowledge about networking in general. If your host uses a DSL connection and you want to use multiple public IPs, you really need a router. All of your machines, whether physical or virtual, use private LAN IPs allocated by DHCP in the router. The vms run in bridged mode.

Allocating public IP addresses to machines is messy whether you are using physical or virtual machines. The neatest way is to make sure that the router you buy supports IP to IP mapping. You allocate the batch of IPs to the router, then map those IPs to the private IP of the machines on the private LAN behind the router.
Bill
orenpp1
Posts: 7
Joined: 30. Apr 2015, 23:52

Re: How to assign multiple static IP's on vm

Post by orenpp1 »

Thanks for the quick answer,

Blocking the guests from accessing the host's LAN is achievable only by using a router with IP to IP mapping?? (condisering the fact I use DSL connection with dail up's on each VM & host)

Just wanna make sure before I go ahead and purchase one...
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: How to assign multiple static IP's on vm

Post by scottgus1 »

Blocking the guests from accessing the host's LAN is not possible with normal consumer-grade routers. One needs a firewall to block requests to see the host LAN. I've seen reports that pfSense can do that while routing. Maybe there's a open-source firmware upgrade for the router itself that can do that as well. But the average router, even though it will usually be able to route to different LAN IP addresses based on port number, will not block certain guests from seeing the LAN. In fact, most consumer routers won't even do what Bill is talking about: External IP address to internal IP address routing. The usuals expect only one external IP address with different port numbers, then route to different LAN IP addresses - FWIW the Linksys WRT54G won't even do this basic function. pfSense or the like may be able to do all of this stuff.
BillG
Volunteer
Posts: 5105
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: How to assign multiple static IP's on vm

Post by BillG »

I really don't understand this thing you have about blocking the vms from using the host's LAN (which was not mentioned in your original post). If you only have one connection to the Internet, the host and guests are all in the same network, whether you use private or public IPs, static or dynamic. Everything on your side of the DSL connection must be in the same network (unless you somehow split it up using virtual routers) or they cannot reach the DSL router and through it the Internet.

Since that is the case, the only way to block traffic from the vms reaching the host is with firewall settings, which is nothing to do with VirtualBox.
Bill
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: How to assign multiple static IP's on vm

Post by noteirak »

Maybe an actual explaination of WHAT you need to achieve could help us tell you HOW to achieve it.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
orenpp1
Posts: 7
Joined: 30. Apr 2015, 23:52

Re: How to assign multiple static IP's on vm

Post by orenpp1 »

Will further elaborate....

I have 1 desktop 1 NIC(physical), Windows 7 professional (host & all guests). 1 modem with a static IP dail up DSL conection.
Each VM also has dail up connection on desktop (static IP).

When I dail up from any VM it shows me the static IP (which is what I want)
I need to make sure that when a dail up disconnection takes place on any VM the guest will not be able to access the host's LAN directly.
In other words, when the dail up connection on any of my VM desktop is not dailed I will not have internet access....

Would appreciate any help and sorry if I was unclear before.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: How to assign multiple static IP's on vm

Post by scottgus1 »

Couple of things (semantics, I know, but it will help). It's "dial up", not "dail up", and DSL isn't dial-up, even though it comes over a telephone line. Dial-up is when your modem connects to your phone line, makes a phone call automatically, and you hear the modem song for a few moments, then you get slow-as-a sloth internet access. You will not be able to call someone on that phone line until your modem hangs up. DSL is on all the time, no dialing up necessary, and you can still call folks.

I know you said you had one modem, but this is throwing me off:
Each VM also has dial up connection on desktop (static IP).
These seemingly picky points are to help me ask this question: Are you using separate dial-up modems, one for each guest and the host, or do you have separate DSL modems, one for each guest and the host, or do you have one DSL modem carrying multiple IP addresses for all of you guests and host?

I'm going to assume that in this day and age you are not really using dial-up. Might be wrong. :shock:

If you have separate DSL modems, one for each IP address, then you can mount extra NICs in your host and disconnect the host OS from using them, while leaving Virtualbox connected to them. Then connect one DSL modem to each NIC and connect the NIC to the appropriate guest. No crossover into the LAN would then theoretically be possible.

However, I am guessing that you have one DSL modem carrying all the IP addresses. At which point you are going to have to use a firewall to prevent your guests from connecting into the LAN and stay separate on their own IP path. This is beyond Virtualbox's capabilities, and you'll need to see what can be done with the host firewall or with a fancy router or pfSense solution.

Here is a way (not tested by me yet - looking for time) to use a computer running pfSense to allow folks to use one's internet connection without letting them into one's LAN: http://howto.wired.com/wiki/Build_a_Wir ... ldid=36162 pfSense can run as a Virtualbox guest and allow internet access into a Virtualbox internal network, apparently without letting the guests onto the host's LAN (reported here: viewtopic.php?f=6&t=52103#p238805)
Last edited by scottgus1 on 19. May 2015, 15:02, edited 1 time in total.
Martin
Volunteer
Posts: 2561
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: How to assign multiple static IP's on vm

Post by Martin »

He probably has a DSL passive modem and is doing several PPPOE "dial up" connections from the host and the VMs.
Post Reply