Hi,
I'm trying to setup a VM (host: macosx, guest: windows 7) beginning with a NAT network config and then switching to bridged network using VBoxManage modifyvm. The result is that the vm autoassigns itself a random IP address as it doesn't configure a Default Gateway.
If I try doing the same using VirtualBox GUI, the network configuration is correct.
Can you help me understand what steps I am missing?
Thanks a lot in advance
switch to bridged network via VBoxManage CLI
-
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: switch to bridged network via VBoxManage CLI
The commands for editing nic connections via Vboxmanage modifyvm include two commands for setting to Bridged:
--nic<1-N> none|null|nat|natnetwork|bridged|intnet|hostonly|generic to set to Bridged
--bridgeadapter<1-N> none|<devicename>
description on the second command from the manual:
--nic<1-N> none|null|nat|natnetwork|bridged|intnet|hostonly|generic to set to Bridged
--bridgeadapter<1-N> none|<devicename>
description on the second command from the manual:
Sounds like just setting the nic to Bridged isn't enough. You have to pick the host's physical adapter name, too. (NAT doesn't ask for which host adapter to use.) The GUI is set to pick the first in the list, but the CLI can have nothing connected, so you need to do it with a new command.If bridged networking has been enabled for a virtual network card . . . use this option to specify which host interface the given virtual network interface will use.
-
ftartaggia
- Posts: 3
- Joined: 22. Jun 2016, 16:36
Re: switch to bridged network via VBoxManage CLI
Thanks a lot for your reply, but that's what I'm already doing: I set nic1 to bridged and bridgeadapter1 to en0.
But when I do this via VB GUI, the VM correctly autoconfigures the Default Gateway to my host's LAN router, while when I do the same via VBoxManage, the VM's Default Gateway remains unset.
Any idea?
But when I do this via VB GUI, the VM correctly autoconfigures the Default Gateway to my host's LAN router, while when I do the same via VBoxManage, the VM's Default Gateway remains unset.
Any idea?
-
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: switch to bridged network via VBoxManage CLI
I don't have a Mac host to see what the answer to my question is, so let me please ask you.
This is the Windows version of a guest's Network settings: You will see that when I set my guest to Bridged, the name of the network card appears in the "Name" dropdown.
Does yours show the actual name of the network card in the dropdown, or does it say "en0"?
Maybe you could also post a screenshot of what your guest Network window loosk like, as well as the commands you're using.
This is the Windows version of a guest's Network settings: You will see that when I set my guest to Bridged, the name of the network card appears in the "Name" dropdown.
Does yours show the actual name of the network card in the dropdown, or does it say "en0"?
Maybe you could also post a screenshot of what your guest Network window loosk like, as well as the commands you're using.
-
ftartaggia
- Posts: 3
- Joined: 22. Jun 2016, 16:36
Re: switch to bridged network via VBoxManage CLI
I finally solved it 
I need to pass the network interface name, not its identifier!
I was passing "--bridgeadapter en0", but I need to pass "--bridgeadapter 'en0: Wi-Fi' (AIrport)"
LOL
Anyway, thanks a lot for your help!
I need to pass the network interface name, not its identifier!
I was passing "--bridgeadapter en0", but I need to pass "--bridgeadapter 'en0: Wi-Fi' (AIrport)"
LOL
Anyway, thanks a lot for your help!
-
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: switch to bridged network via VBoxManage CLI
Very good, had a feeling that was it. Glad it's working!