OpenWrt Forum Archive

Topic: understanding how "bridge" interface works

The content of this topic has been archived on 14 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,

I have a very simple network configuration:

root@WL-500gP:~# cat /etc/config/network 
#### VLAN configuration 
config switch eth0
option enable   1

config switch_vlan eth0_9
option device "eth0"
option vlan 9
option ports "0t 1t 2t 3t 4t 5t"

#### LAN configuration
config interface lan
option type bridge
option ifname "eth0.9"
option proto static
option ipaddr 10.10.10.253
option netmask 255.255.255.240
option gateway 10.10.10.254

root@WL-500gP:~# 

As you can see, physical interface eth0.9 is associated with interface configuration section "lan" and interface type is set to "bridge". IPv4 parameters are set manually.

1) Is this "option type bridge" meant to bridge(put interfaces to same broadcast domain) radio interface defined in /etc/config/wireless file with the VLAN interface defined in "option ifname" line?

2) How does bridge understand that he should answer when someone sends packets to 10.10.10.253? I guess this bridge does not work like a switch which does not check IP header when forwarding traffic? Instead, each frame passing through the bridge is processed and if IPv4 destination is 10.10.10.253, then router will know that this packet was destined to it?

1) yes
2) bridges pretty much work like switches, they do not consult the ip headers but the ethernet frame headers.. The first packet to an unknown ethernet destination is simply boradcasted to all ports, then the bridge remembers on which port the yet unknown ethernet destination replies, this knowledge is then put into a learning table. The next time a packet is sent to that specific ethernet mac, the learning table is consoluted to see which port the mac is at, then traffic is only forwarded to that specific port.

jow wrote:

2) bridges pretty much work like switches, they do not consult the ip headers but the ethernet frame headers.. The first packet to an unknown ethernet destination is simply boradcasted to all ports, then the bridge remembers on which port the yet unknown ethernet destination replies, this knowledge is then put into a learning table. The next time a packet is sent to that specific ethernet mac, the learning table is consoluted to see which port the mac is at, then traffic is only forwarded to that specific port.

Yes, but how does the bridge know when IP traffic(for example SSH connection) is addressed to bridge itself? For example I have created a bridge with following configuration in /etc/config/network file:

#### LAN configuration
config interface lan
        option type     bridge
        option ifname   "eth0.0"
        option proto    dhcp

This bridge creates a single broadcast domain for all the Wi-Fi hosts and physically connected hosts. br-lan interface receives IPv4 address 10.50.50.4 from DHCP server:

root@WL-500gP:~# ifconfig br-lan
br-lan    Link encap:Ethernet  HWaddr 00:1B:FC:45:2A:57  
          inet addr:10.50.50.4  Bcast:10.50.50.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:354 errors:0 dropped:0 overruns:0 frame:0
          TX packets:73 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:25864 (25.2 KiB)  TX bytes:6918 (6.7 KiB)

root@WL-500gP:~# 

I'm able to ping or SSH to 10.50.50.4 from 10.50.50.0/24 network either from Wi-Fi devices or physically connected devices. Does this simply work in a way that br-lan is a virtual interface, which get's it's IPv4 address either from DHCP or statically and once anyone would like to communicate with br-lan, it sends the frames to br-lan MAC address in local Ethernet network?

Yes.

The discussion might have continued from here.