I am using LXC to host an http server in VirtualBox, but the simple bridge I created does not have an IP address, so it cannot be reached in the host.
I know your question specifically is about LXC (Linux Containers) which is something I am not 100% on, but I will provide some advice based on what I know about guest OS to host OS connections in VirtualBox. Maybe this dovetails with your LXC specific issue?
You say you want to have a simple bridge setup between the VirtualBox guest and the host, but what settings do you have in VirtrualBox for vboxnet0
? To my knowledge, there are two places where the network settings need to be adjusted for a setup like this to work: Within the guest OS but also on the host OS itself.
I’m using a Mac, but the general concept should be the same for anyone else using VirtualBox on Windows or Linux: You need two adapters on a VirtualBox guest OS to ensure an outgoing network connection on the 10.x.x.xnetwork as well as a connection on the host only network which is usually
192.168.x.x`.
If I go to “Preferences” when I launch VirtualBox and then click the “Network” icon and then click the “Host-only Networks” tab, I get a list of adapters I have setup:
Then—as shown in the screenshot—if I select vboxnet0
and then click the screwdriver icon, I can change options. Screenshot below:
I have the “IPv4 Address” set to 192.168.56.1
and the related IPv4 Network Mask
set to 255.255.255.0
. Now I usually have the DHCP server disabled as shown in the following screenshot:
Once that is setup, I make sure the guest OS in VirtualBox has the adapter enabled like this:
Note that I have a “Host-only Adapter” designated and that adapter is associated to vboxnet0
? Once that is done, the guest OS should be fully aware of the host-only setup and you should be good to go.