Hi,
My requirement is to create LXC Containers in OpenWRT system.
I am using a laptop which has Debian OS. So, for POC purpose, the obvious choice was to use Virtual Box with a OpenWRT VM in it.
1. Installed Virtual Box in my Laptop which runs on Debian 10.
2. Created a OpenWRT VDI
3. Created a VM
4. Created LXC container inside VM
The VM has network connectivity. Whereas the Container doesn't have. How to solve the network issue in LXC.
Note: The Container starts perfectly and i am able to get into the container.
Settings that i chose while creating VM in Virtual Box: Please see the attached images
In VM command line i also did the following:
set network.mng=interface
set network.mng.type='bridge'
set network.mng.proto='static'
set network.mng.netmask='255.255.255.0'
set network.mng.ifname='eth0'
set network.mng.ipaddr='192.168.56.2'
delete network.lan
delete network.wan6
set network.wan=interface
set network.wan.ifname='eth1'
set network.wan.proto='dhcp'
set network.lan=interface
set network.lan.ifname='eth2'
set network.lan.proto='dhcp'
I followed the instructions mentioned in OpenWRT website.
(Currently forum is not allowing me to paste website link here. Please excuse)
Is there anything wrong in my Virtual Box network settings that is blocking network to my LXC Container inside VM.
Thanks,
Strive
Network Issue in LXC Containers
Network Issue in LXC Containers
- Attachments
-
- Network - Adapter 3
- Adapter 3.png (30.79 KiB) Viewed 1623 times
-
- Network - Adapter 2
- Adapter 2.png (27.62 KiB) Viewed 1623 times
-
- Network - Adapter 1
- Adapter 1.png (30.34 KiB) Viewed 1623 times
-
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: Network Issue in LXC Containers
First, I see three different networks with overlapping connectivity. See Virtualbox Networks: In Pictures for the connectivity and limitations of your network choices. You may quite likely settle on just using Bridged to get the most unimpeded access to the LAN.
All of the network adapters simulated by Virtualbox are wired Ethernet adapters. Your OpenWRT will not see any Wi-Fi adapters unless you get a USB wi-fi adapter for the guest to use, and use the Virtualbox USB filters to insert the USB Wi-Fi adapter into the OpenWRT VM. See USB basics and troubleshooting. Additionally, this: https://openwrt.org/docs/techref/targets/x86 says you need to provide your own Wi-Fi drivers.
Bridged may not always work with the host PC's Wifi adapter, due to strict implementation of the Wifi protocols by either the wifi adapter driver or the access point firmware. Technically Wifi cannot Bridge, but some combinations of wifi adapter drivers and access point firmware implement these protocols in a lax fashion so Bridged can squeeze through. If it works where you are, good. If you can't get a good network trying to Bridge with a wifi adapter, use the USB Wi-FI adapter mentioned above. And as mentioned above, a Bridged adapter will always appear as wired Ethernet even if you can Bridge to the host's Wi-Fi adapter. If your OpenWRT must see wi-fi, use a USB Wi-fi adapter and the USB filters.
This link discusses networking for an LXC container: https://forum.openwrt.org/t/solved-netw ... er/36795/5
All of the network adapters simulated by Virtualbox are wired Ethernet adapters. Your OpenWRT will not see any Wi-Fi adapters unless you get a USB wi-fi adapter for the guest to use, and use the Virtualbox USB filters to insert the USB Wi-Fi adapter into the OpenWRT VM. See USB basics and troubleshooting. Additionally, this: https://openwrt.org/docs/techref/targets/x86 says you need to provide your own Wi-Fi drivers.
Bridged may not always work with the host PC's Wifi adapter, due to strict implementation of the Wifi protocols by either the wifi adapter driver or the access point firmware. Technically Wifi cannot Bridge, but some combinations of wifi adapter drivers and access point firmware implement these protocols in a lax fashion so Bridged can squeeze through. If it works where you are, good. If you can't get a good network trying to Bridge with a wifi adapter, use the USB Wi-FI adapter mentioned above. And as mentioned above, a Bridged adapter will always appear as wired Ethernet even if you can Bridge to the host's Wi-Fi adapter. If your OpenWRT must see wi-fi, use a USB Wi-fi adapter and the USB filters.
This link discusses networking for an LXC container: https://forum.openwrt.org/t/solved-netw ... er/36795/5
Re: Network Issue in LXC Containers
Thanks for your response.
I have seen the question posted in OpenWRT forum. In fact, my configurations are almost same the one that is mentioned in that post. I have also posted a question in OpenWRT forum.
Meanwhile, i thought of checking if i have been doing anything wrong on Virtual Box side.
Reason for setting up three adapters is:
(From OpenWRT document)
I will try the alternatives and get back.
I have seen the question posted in OpenWRT forum. In fact, my configurations are almost same the one that is mentioned in that post. I have also posted a question in OpenWRT forum.
Meanwhile, i thought of checking if i have been doing anything wrong on Virtual Box side.
Reason for setting up three adapters is:
(From OpenWRT document)
- eth0 of the VM on mng (management) interface, fixed address 192.168.56.2, set in VirtualBox as Host-only Adapter on adapter vboxnet0. This interface will be always available to the host even if host or VM are disconnected from any network.
- eth1 of the VM on wan interface, dynamic address, set in VirtualBox as NAT. This interface will be used to access the Internet through whatever setup the host also uses.
- (optional) eth2 of the VM on lan interface, configured depending on your local network, set in VirtualBox as Bridged Adapter. This interface allows other devices (host included) to connect to the VM as if it was a physical device in the local network. Will only work if there is already a local network of some kind.
I will try the alternatives and get back.
Re: Network Issue in LXC Containers
Finally i could solve the networking issue.
I took out the host only adapter setting. Now i have Adapter 1 as NAT and Adapter 2 as Bridge. This creates a br-lan bridge and everything is fine
Without 'Host-Only Adapter' as Adapter-1 (that is eth0), i am unable to SSH to the VM from outside Virtual Box. Also, i am unable to access VM's web page.
Is there any alternative to SSH to VM?
I took out the host only adapter setting. Now i have Adapter 1 as NAT and Adapter 2 as Bridge. This creates a br-lan bridge and everything is fine
Without 'Host-Only Adapter' as Adapter-1 (that is eth0), i am unable to SSH to the VM from outside Virtual Box. Also, i am unable to access VM's web page.
Is there any alternative to SSH to VM?