Issue Bridging more than one adapter

Hey!

I'm currently running OpenWrt 22.03.5 using VirtualBox on a Windows 11 Host machine. I have 4 adapters configured in VirtualBox. Currently the fourth adapter is set to receive an IP address from the WIFI the my computer is connected to via DHCP, for the OpenWrt's lan source. Also eth0 is the host-only adapter, so the windows 11 host machine can access the OpenWrt's services/subnet, and this works perfectly. The issue is that when I try bridging eth0, eth1, and eth2, only eth0 seems to work, and if I change the order and put eth1 first then the internal network works and the host only adapter stops working, and of course the ethernet controller (eth3) never works unless put first. I've provided some of my configuration info below, if any more is need please ask! Thank you for any help!!


ADAPTERS;

Adapter 1: (HOST-ONLY ADAPTER) HOST-ONLY (FOR ACCESS TO WRT SERVICE FROM HOST MACHINE) (eth0)

Adapter 2: (int-net) Internal Network (FOR OTHER VMS) (eth1)

Adapter 3: (BRIDGED) ETHERNET CONTROLLER (FOR INDIVIUAL DEVICE OR NETWORK SWITCH) (eth2)

Adapter 4: (BRIDGED) WIRELESS ADAPTER (FOR ROUTER WIFI) (eth3)

VirtualBox Adapters (picture);

https://prnt.sc/Uzl1zWDgX_RZ 

IFCONFIG OUTPUT:

br-lan    Link encap:Ethernet  HWaddr XX:XX:XX:XX:XX:XX
          inet addr:10.71.71.1  Bcast:10.71.71.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:10 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:682 (682.0 B)  TX bytes:883 (883.0 B)

eth0      Link encap:Ethernet  HWaddr XX:XX:XX:XX:XX:XX
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:10 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:822 (822.0 B)  TX bytes:919 (919.0 B)

eth1      Link encap:Ethernet  HWaddr XX:XX:XX:XX:XX:XX
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:918 (918.0 B)

eth2      Link encap:Ethernet  HWaddr XX:XX:XX:XX:XX:XX
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:918 (918.0 B)

eth3      Link encap:Ethernet  HWaddr XX:XX:XX:XX:XX:XX
          inet addr:192.168.1.111  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:425 errors:0 dropped:0 overruns:0 frame:0
          TX packets:167 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:424866 (414.9 KiB)  TX bytes:18018 (17.5 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:130 errors:0 dropped:0 overruns:0 frame:0
          TX packets:130 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:12429 (12.1 KiB)  TX bytes:12429 (12.1 KiB)

NETWORK CONFIG OUTPUT:

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth0'
        list ports 'eth1'
        list ports 'eth2'
        option ipv6 '0'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '10.71.71.1'
        option netmask '255.255.255.0'
        option peerdns '0'
        option dns '10.71.71.1:5353' # local AGH
        option ipv6 '0'
        option delegate '0'

config interface 'wan'
        option device 'eth3'
        option proto 'dhcp'
        option peerdns '0'
        option dns '10.71.71.1:5353' # local AGH
        option ipv6 '0'
        option delegate '0'

BRCTL SHOW OUTPUT:

bridge name     bridge id               STP enabled     interfaces
br-lan          xxxx.xxxxxxxxxxxx       no              eth0
                                                        eth1
                                                        eth2

Welcome to the community!

Can you clarify this more?

  • This seems invalid
  • DNS should only be set on WAN
1 Like

Thank You, For The Welcome and The Reply!

Honestly I've reinstalled openwrt several times trying to fix it, and modifying the network config I must've added the dns option to both the wan and lan interface, but this doesn't cause any issues as my dns works fine and when the internal network adapter is the first one set in bridge config then everything works fine for my others vm's. I've removed the dns option from the lan config and rebooted and nothing seemed to have changed, also the dns server is a locally ran adguardhome server that uses opendns dns servers.

Also sorry forgot to include this, but when my host adapter is the one that is working, and I get on a another virtual machine that using the internal network then it will receive and IP from the OpenWrt subnet via DHCP and same with a raspberry pi connected via ethernet to my computer, yet WIFI doesn't work on either unless their adapter is specified first in the config.

UPDATE:

I've reinstalled OpenWrt several times and every time it seems to behave the same, has anyone been able to setup OpenWrt in virtualbox and bridge eth0,1, and 2 as br-lan and using eth3 as the bridged wireless adapted. Or if anyone can share some knowledge on bridging more than one eth in br-lan.

But wait, what does "and using eth3 as the bridged wireless adapter" mean?

Are you taking over the PCI or are you adding it as a virtual interface?

:bulb: I think you need to take over the card.

I do it all the time, I just don't understand what I asked you to clarify. That information is needed to assist you:

1 Like

Thank You, again for the reply!

My eth3 is the adapter which receives an IP from my router, as its the fourth adapter configured in VirtualBox and its a bridged-adapter to my laptops wireless adapter which is connected to my WIFI.

CLARIFICATION:

Adapter Breakdown:
I have four adapters setup in VirtualBox for my OpenWrt VM, the first is the VirtualBox's host only adapter which allows the host machine to access the VM's subnet which in my case is 10.71.71.0/24, since this is the first adapter configured in VirtualBox it's eth0 in the VM.
The second is VirtualBox's internal network (intnet) which allow other VM's that have the internal network enabled to connect to the OpenWrt VM as a router, as this is the second adapter in VirtualBox it is eth1 in the OpenWrt VM.
The third adapter is a bridged adapter to my laptops ethernet port, which is to allow connecting either an individual device such as a raspberry pi or a switch for multiple devices, of course these devices shall also use the OpenWrt VM as their router.
The fourth adapter is a bridged adapter to my laptops wireless card and is used for the WAN interface on my OpenWrt VM.

Issue:
Eth0 which is the host only network is working perfectly, I know because instead of accessing the LuCI web-page through the IP the VM gets from my router which is in the 192.168.1.0/24 subnet, I can access it at 10.71.71.1, which wouldn't work if the host only adapter isn't working, And of course Eth3 which is the bridged wireless adapter for the WAN interface is working fine, as I can ping 1.1.1.1, and google.com, as well as opkg update. The issue is with devices connected via Eth1 & Eth2 as they seem to receive an IP from the OpenWrt VM, yet the WIFI doesn't seem to work on them despite the device being visible in LuCI. I have tried several VM's including an Ubuntu 22.04 Desktop VM, FreePBX 16, and Windows 10 VM and none of them can use the internet yet they all receive an IP within the 10.71.71.0/24 range. And it is the same thing with my Raspberry Pi connect to my laptop via ethernet, it does receive an IP from the virtual router except can't use the internet,
** Also none of the VM's nor my RPi can ping 10.71.71.1 when connected which is odd, and of course they can't ping 1.1.1.1, or google.com.
** I'm sure I messed up when configuring the bridge as current in the network config, in the br-lan config the ports are in this order (eth0, eth1, eth2) lines 12,13,14(network-config). As eth0 is the host-only adapter and its the only one in the bridge that doesn't seem to have an issue, I tried switching the order of them in the network config, I changed it to (eth1, eth0, eth2) and now the internal-network is working perfectly and I can't use the host only adapter nor the bridged ethernet adapter, with eth1 being the first in the bridge config all the virtual machines connected to the internal network now can use the internet, but of course eth0 and eth2 still don't work.
** NOTES;

  • I've recently changed to 1.1.1.1 as my DNS for testing until its working and no change.
  • It's odd that the devices connected to the "not-working" adapters (whichever two aren't specified first) still receive an IP via DHCP but can't use the internet.
  • It's odd that the first adapter specified in the br-lan config is the one that works correctly, as they all should.
  • I've noticed in my ifconfig output that depending on which adapter is the first specified then the br-lan in the output has the same HWaddr as that adapter.

Please let me know, if you need any more information on my situation

UPDATE:

I've got it working! I Believe my lack of knowledge was the obvious mistake here.. I was assuming that I could simply add eth1 & eth2 to the br-lan bridge and everything would work, except of course the clients of eth1 and & eth2 couldn't use the WIFI. I've just tested a new configuration and instead of bridging the adapters I've made them each their own interface and assigned a different subnet, and now its seems to be working fine, of course this isn't how I wanted to do it in the beginning I wanted all the clients to belong to the same subnet, am I wrong to think this is possible, or did I simply to it incorrectly? The host only adapter subnet is still 10.71.71.0/24 and now eth1 is 72.0/24 and eth2 is 73.0/24 and the clients of both eth1 and eth2 can interact with eth0,eth1 & eth2 and access the internet, so I suppose this setup will work! I am now experiencing another issue, which has happened to me before when I was testing previous OpenWrt configs, where when I bridge my ethernet controller and connect say my raspberry pi to the ethernet port, even though the raspberry pi works perfectly with the virtual router and can use the internet, it also seems to cause issues such as dns leaks on my host machine for example I have a vpn on the virtual router but not the host machine and normally my IP is my home IP except for when the virtual router is enabled then my ip tends to change to the vpn ip, also if I do a dnsleaktest then it shows the dns servers of my virtual router and my host machine which is obviously not correct.
** Basically, I need to isolate my ethernet adapter to only interact with my virtual machine, and not have my host machine attempt to use it!

Any help would be much appreciated, I'll be making a final update with some notes and a video that helped me, then most likely mark this thread as closed and make a new one as the issue at hand is different.

UPDATE:

I've solved the issue (assuming what I wanted originally is not possible) instead of bridging multiple adapters I've given them their own interface and dedicated subnet. Now all the clients no matter how they connected to the router or what subnet they belong to they can communicate to each other and use the internet.

I won't be marking this as the solution, as I think what I originally wanted which was for all the clients to belong to the same subnet, is possible. Which would mean what I've done here is simple an "easy fix" to the issue but doesn't fix the original issue trying to bridge the adapters... (I will be creating a different thread as I have been experiencing an issue since I've started using OpenWrt in VirtualBox.)

Any information that could help me further diagnose the issue when using the bridge would be much appreciated.

The video I watched was rather helpful and is now making me think that the issue may belong with my firewall, as the devices while using the bridge do receive an IP they just can't use the internet or communicate with the router, which makes me think they can maybe talk to the lan interface but not the wan interface. I plan on doing some more testing with different configuration's so I'll keep the thread updated!

video that helped (not my video!): https://youtu.be/4lgnqKy5qfU

original network cfg: # not working...

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth0' # virtualbox host only adapter
        list ports 'eth1' # virtualbox internal network adapter
        list ports 'eth2' # bridged ethernet controller

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '10.71.71.1'
        option netmask '255.255.255.0'
        option peerdns '0'
        option dns '10.71.71.1:5353' # AGH SERVER
        option ipv6 '0'
        option delegate '0'

config interface 'wan' # WAN (bridged wifi adapter)
        option device 'eth3'
        option proto 'dhcp'
        option ipv6 '0'
        option delegate '0'

new network cfg: # working!

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth0'

config interface 'lan' # virtualbox host only adapter
        option device 'br-lan'
        option proto 'static'
        option netmask '255.255.255.0'
        option ipaddr '10.71.71.1'
        option ipv6 '0'
        option delegate '0'

config interface 'wan' # WAN (bridged wifi adapter)
        option device 'eth3'
        option proto 'dhcp'
        option peerdns '0'
        option dns '10.71.71.1:5353' # AGH SERVER
        option ipv6 '0'
        option delegate '0'

config interface 'internal_netwk' # virtualbox internal network adapter
        option proto 'static'
        option device 'eth1'
        option netmask '255.255.255.0'
        option ipaddr '10.71.72.1'
        option ipv6 '0'
        option delegate '0'

config interface 'eth_control' # bridged ethernet controller
        option proto 'static'
        option device 'eth2'
        option netmask '255.255.255.0'
        option ipaddr '10.71.73.1'
        option ipv6 '0'
        option delegate '0'