Host networking for dummies without a GUI

Discussions related to using VirtualBox on Linux hosts.
Post Reply
serker
Posts: 5
Joined: 16. Feb 2009, 09:41

Host networking for dummies without a GUI

Post by serker »

Please bear with me, I need an example, and the manual doesn't provide the CLI equivalent of the GUI commands.

I currently have a Vbox setup for nat, i.e.:

VBoxManage modifyvm "station1" -nic1 nat

It works just fine. Unfortunately, I need a full IP on the intranet at the office--natting just won't do anymore. Hence:

VBoxManage modifyvm *station1* -nic1 hostif

The command is successful, and within Win XP (in the Virtual machine) I reset my ethernet card to a real ip within the office (10.x.y.z, with netmask 255.0.0.0, gateway 10.0.0.1). Yet I cannot ping the gateway, see anything on the network, do anything that seems to relate to the "host side".

When I look at the station1.xml file, I see the following line:

<Network>
<Adapter slot="0" enabled="true" MACAddress="000027c610d7" cable="true" speed="1000000" type="Am79C973"/>
<NAT/>
</Adapter>

Could someone please provide an example of what this line would change to if I enabled hostif? I suspect somewhere in the xml there would be a pointer to the actual host interface, yet each time I try it I simply get this:

(same as above, but chane NAT line to <HostInterface/>)

I'm betting that there's something else that's either supposed to enter into that, or that some extra XML flag is posted elsewhere in the xml, since the manual mentions that the GUI has a pulldown menu for the actual host interface you wish to attach to.

Please help!!!
TerryE
Volunteer
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
Contact:

Post by TerryE »

Would this cut from one of my scripts help?

Code: Select all

machineName=...
hDisk1=...
hDisk2=...
serial=...
hostIFname=`VBoxManage -nologo list hostifs | grep 'Name:' | head -1 | cut -b 18-`

VBoxManage -nologo createvm -name $machineName -register
VBoxManage -nologo modifyvm $machineName  \
    -ostype "Linux26" -memory 512 -vram 1 -accelerate3d off \
    -acpi on -ioapic off -pae off -monitorcount 1  \
    -biosbootmenu disabled -boot1 disk \
    -floppy disabled -sata off -idecontroller PIIX4  \
    -hda "$hDisk1"  -hdb "$hDisk1"  \
    -nic1 hostif -nictype1 Am79C973 -macaddress1 080027EBFF6$serial \
    -cableconnected1 on -hostifdev1 "$hostIFname" \
    -hdd none -dvd none -nic2 none -nic3 none  -nic4 none  \
    -uart1 off -uart2 off -audio none -clipboard disabled -usb off \
    -vrdp on -vrdpport $rdpPort -vrdpauthtype external
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
serker
Posts: 5
Joined: 16. Feb 2009, 09:41

Post by serker »

TerryE wrote:Would this cut from one of my scripts

-nic1 hostif -nictype1 Am79C973 -macaddress1 080027EBFF6$serial \
-cableconnected1 on -hostifdev1 "$hostIFname" \
The bold flag above was ultimately what I needed in the end. Thank you so much for posting it. (Geez, I couldn't find a flag anywhere like that in the UM).
Post Reply