How to create new Internal network with static addressing

This is for discussing general topics about how to use VirtualBox.
Post Reply
ANDROIDWORLD
Posts: 9
Joined: 26. May 2015, 18:40

How to create new Internal network with static addressing

Post by ANDROIDWORLD »

I found that I can create new network for Internal Adapter only using this command

Code: Select all

vboxmanage dhcpserver add --netname intnet2 --ip 10.10.0.1 --netmask 255.255.255.0 --lowerip 10.10.0.2 --upperip 10.10.0.254 --enable
So I select Internal Network adapter in VM settings and types intnet2 and it works just fine, but one problem is that this is still DHCP, but I need to set static IP for hosts. Is it possible ?
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: How to create new Internal network with static addressing

Post by scottgus1 »

It's the "dhcpserver add" part that'll clue in that your new network will have a DHCP server on it. There should be a Vboxmanage command to make a new internal network which defaults to not having a DHCP server. (You can also make a new non-DHCP intnet simply by typing in a new name in the guest's internal network name box.)

Edit: there does not seem to be a way to just make an internal network with a Vboxmanage command.

Section 6.6 in the manual says this:
Internal networks are created automatically as needed, i.e. there is no central configuration. Every internal network is identified simply by its name. Once there is more than one active virtual network card with the same internal network ID, the VirtualBox support driver will automatically "wire" the cards and act as a network switch.
You make a new internal network by assigning two or more guests to the same internal network name. You don't need to make the internal network ahead of time. Your posted command makes the network because it's attaching a DHCP server to the network. You can attach guests to the desired network with these Vboxmanage commands (from the manual):
You can use
VBoxManage modifyvm "VM name" --nic<x> intnet

Optionally, you can specify a network name with the command
VBoxManage modifyvm "VM name" --intnet<x> "network name"

If you do not specify a network name, the network card will be attached to the network intnet by default.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: How to create new Internal network with static addressing

Post by scottgus1 »

And yes you can use static IPs on an internal network, in fact without a DHCP server you'll have to. You can also limit the range the DHCP server will hand out and assign static IPs out of the DHCP range, so the internal network can have both static and dynamic IPs on it.

One other little terminology thing, just to help further postings. The virtual machines your PC is running are "guests" or "VMs", and the physical PC is the "host".
ANDROIDWORLD
Posts: 9
Joined: 26. May 2015, 18:40

Re: How to create new Internal network with static addressing

Post by ANDROIDWORLD »

Thank you so much ! It works like a charm !!
Post Reply