# Bridge Deployment Scenarios

TR-181 Data Model and ### Bridging UCI Configuration Reference

## 1. Tagged Management Bridge

A management bridge where traffic on ae_wan is tagged with VLAN 100. The management interface receives DHCP.

### TR-181 Data Model

```
start
 
del Device.IP.Interface.*
del Device.Bridging.Bridge.*
del Device.Ethernet.Link.*
 
add Device.Bridging.Bridge.
set Device.Bridging.Bridge.1.Enable 1

add Device.Bridging.Bridge.1.Port.
add Device.Bridging.Bridge.1.Port.

set Device.Bridging.Bridge.1.Port.1.Enable 1
set Device.Bridging.Bridge.1.Port.1.ManagementPort 1
set Device.Bridging.Bridge.1.Port.2.Enable 1
set Device.Bridging.Bridge.1.Port.2.ManagementPort 0
set Device.Bridging.Bridge.1.Port.2.LowerLayers Device.Ethernet.Interface.6
 
add Device.Bridging.Bridge.1.VLAN.
set Device.Bridging.Bridge.1.VLAN.1.VLANID 100
set Device.Bridging.Bridge.1.VLAN.1.Enable 1
 
add Device.Bridging.Bridge.1.VLANPort.
set Device.Bridging.Bridge.1.VLANPort.1.Enable 1
set Device.Bridging.Bridge.1.VLANPort.1.VLAN Device.Bridging.Bridge.1.VLAN.1
set Device.Bridging.Bridge.1.VLANPort.1.Port Device.Bridging.Bridge.1.Port.2
 
add Device.Ethernet.Link.
set Device.Ethernet.Link.1.Enable 1
set Device.Ethernet.Link.1.LowerLayers Device.Bridging.Bridge.1.Port.1
 
add Device.Ethernet.VLANTermination.
set Device.Ethernet.VLANTermination.1.Enable 1
set Device.Ethernet.VLANTermination.1.VLANID 100
set Device.Ethernet.VLANTermination.1.LowerLayers Device.Ethernet.Link.1

add Device.IP.Interface.
set Device.IP.Interface.1.Enable 1
set Device.IP.Interface.1.LowerLayers Device.Ethernet.VLANTermination.1

set Device.DHCPv4.Client.1.Enable 1
set Device.DHCPv4.Client.1.Interface Device.IP.Interface.1
 
commit
```

### Bridging UCI

```
config bridge 'br_bridge1'
	option name 'br-bridge1'
	option enabled '1'
	option stp '0'
	option priority '32767'
	option hello_time '2'
	option max_age '20'
	option forward_delay '4'
	option Alias 'cpe-1'

config port 'br_1_p_1'
	option bridge 'br_bridge1'
	option enabled '1'
	option Alias 'cpe-1'
	option management '1'

config port 'br_1_p_2'
	option bridge 'br_bridge1'
	option enabled '1'
	option Alias 'cpe-2'
	option name 'ae_wan'

config vlan 'br_1_bv_1'
	option bridge 'br_bridge1'
	option enabled '1'
	option Alias 'cpe-1'
	option vlan '100'

config vlanport 'br_1_vp_1'
	option bridge 'br_bridge1'
	option enabled '1'
	option untagged '0'
	option Alias 'cpe-1'
	option vlan 'br_1_bv_1'
	option port 'br_1_p_2'
```

### Network UCI

```
config device 'br_bridge1'
	option name 'br-bridge1'
	option type 'bridge'
	option bridge_empty '1'
	option enabled '1'
	option stp '0'
	option priority '32767'
	option hello_time '2'
	option max_age '20'
	option forward_delay '4'
	list ports 'ae_wan'

config bridge-vlan 'br_1_bv_1'
	option device 'br-bridge1'
	option vlan '100'
	list ports 'ae_wan:t'

config interface 'iface1'
	option proto 'dhcp'
	option disabled '0'
	option device 'br-bridge1.100'
```

## 2. Untagged Bridge

An untagged bridge combining a LAN port and WAN port. Frames ingress/egress WAN carry a VLAN 100 tag; LAN is untagged.

### TR-181 Data Model

```
start
 
del Device.IP.Interface.*
del Device.Bridging.Bridge.*
del Device.Ethernet.Link.*
 
add Device.Bridging.Bridge.
set Device.Bridging.Bridge.1.Enable 1
set Device.Bridging.Bridge.1.Alias vlan-untagged
 
add Device.Bridging.Bridge.1.Port.
set Device.Bridging.Bridge.1.Port.1.Enable 1
set Device.Bridging.Bridge.1.Port.1.ManagementPort 1

add Device.Bridging.Bridge.1.Port.
set Device.Bridging.Bridge.1.Port.2.Enable 1
set Device.Bridging.Bridge.1.Port.2.ManagementPort 0
set Device.Bridging.Bridge.1.Port.2.LowerLayers Device.Ethernet.Interface.1

add Device.Bridging.Bridge.1.Port.
set Device.Bridging.Bridge.1.Port.3.Enable 1
set Device.Bridging.Bridge.1.Port.3.ManagementPort 0
set Device.Bridging.Bridge.1.Port.3.LowerLayers Device.Ethernet.Interface.6
 
add Device.Bridging.Bridge.1.VLAN.
set Device.Bridging.Bridge.1.VLAN.1.Enable 1
set Device.Bridging.Bridge.1.VLAN.1.VLANID 100
 
add Device.Bridging.Bridge.1.VLANPort.
set Device.Bridging.Bridge.1.VLANPort.1.Enable 1
set Device.Bridging.Bridge.1.VLANPort.1.Untagged 1
set Device.Bridging.Bridge.1.VLANPort.1.VLAN Device.Bridging.Bridge.1.VLAN.1
set Device.Bridging.Bridge.1.VLANPort.1.Port Device.Bridging.Bridge.1.Port.2
 
add Device.Bridging.Bridge.1.VLANPort.
set Device.Bridging.Bridge.1.VLANPort.2.Enable 1
set Device.Bridging.Bridge.1.VLANPort.2.Untagged 0
set Device.Bridging.Bridge.1.VLANPort.2.VLAN Device.Bridging.Bridge.1.VLAN.1
set Device.Bridging.Bridge.1.VLANPort.2.Port Device.Bridging.Bridge.1.Port.3
 
commit
```

### Bridging UCI

```
config bridge 'br_bridge1'
	option name 'br-bridge1'
	option enabled '1'
	option stp '0'
	option priority '32767'
	option hello_time '2'
	option max_age '20'
	option forward_delay '4'
	option Alias 'vlan-untagged'

config port 'br_1_p_1'
	option bridge 'br_bridge1'
	option enabled '1'
	option Alias 'cpe-1'
	option management '1'

config port 'br_1_p_2'
	option bridge 'br_bridge1'
	option enabled '1'
	option Alias 'cpe-2'
	option name 'eth0.1'

config port 'br_1_p_3'
	option bridge 'br_bridge1'
	option enabled '1'
	option Alias 'cpe-3'
	option name 'ae_wan'

config vlan 'br_1_bv_1'
	option bridge 'br_bridge1'
	option enabled '1'
	option Alias 'cpe-1'
	option vlan '100'

config vlanport 'br_1_vp_1'
	option bridge 'br_bridge1'
	option enabled '1'
	option untagged '1'
	option Alias 'cpe-1'
	option vlan 'br_1_bv_1'
	option port 'br_1_p_2'

config vlanport 'br_1_vp_2'
	option bridge 'br_bridge1'
	option enabled '1'
	option untagged '0'
	option Alias 'cpe-2'
	option vlan 'br_1_bv_1'
	option port 'br_1_p_3'
```

### Network UCI

```
config device 'br_bridge1'
	option name 'br-bridge1'
	option type 'bridge'
	option bridge_empty '1'
	option enabled '1'
	option stp '0'
	option priority '32767'
	option hello_time '2'
	option max_age '20'
	option forward_delay '4'

	list ports 'eth0.1'
	list ports 'ae_wan'

config bridge-vlan 'br_1_bv_1'
	option device 'br-bridge1'
	option vlan '100'
	list ports 'eth0.1:u'
	list ports 'ae_wan:t'

config interface 'iface_br1'
	option device 'br-bridge1'

```

### Packet dump

```
13:14:17.676557 aa:00:aa:c9:01:01 > aa:00:aa:c8:01:01, ethertype 802.1Q (0x8100), length 102: vlan 100, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 9039, offset 0, flags [DF], proto ICMP (1), length 84)
    10.10.20.111 > 10.10.20.1: ICMP echo request, id 625, seq 4, length 64
13:14:17.676669 aa:00:aa:c8:01:01 > aa:00:aa:c9:01:01, ethertype 802.1Q (0x8100), length 102: vlan 100, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 12329, offset 0, flags [none], proto ICMP (1), length 84)
    10.10.20.1 > 10.10.20.111: ICMP echo reply, id 625, seq 4, length 64
```

## 3. Tagged Bridge

Both LAN1 and WAN ports carry VLAN 100 tags into the bridge. Frames egress with the tag intact on both sides.

### TR-181 Data Model

```
start
 
del Device.IP.Interface.*
del Device.Bridging.Bridge.*
del Device.Ethernet.Link.*
 
add Device.Bridging.Bridge.
set Device.Bridging.Bridge.1.Enable 1
set Device.Bridging.Bridge.1.Alias vlan-tagged
 
add Device.Bridging.Bridge.1.Port.
set Device.Bridging.Bridge.1.Port.1.Enable 1
set Device.Bridging.Bridge.1.Port.1.ManagementPort 1
add Device.Bridging.Bridge.1.Port.
set Device.Bridging.Bridge.1.Port.2.Enable 1
set Device.Bridging.Bridge.1.Port.2.ManagementPort 0
set Device.Bridging.Bridge.1.Port.2.LowerLayers Device.Ethernet.Interface.1
add Device.Bridging.Bridge.1.Port.
set Device.Bridging.Bridge.1.Port.3.Enable 1
set Device.Bridging.Bridge.1.Port.3.ManagementPort 0
set Device.Bridging.Bridge.1.Port.3.LowerLayers Device.Ethernet.Interface.6
 
add Device.Bridging.Bridge.1.VLAN.
set Device.Bridging.Bridge.1.VLAN.1.Enable 1
set Device.Bridging.Bridge.1.VLAN.1.VLANID 100
 
add Device.Bridging.Bridge.1.VLANPort.
set Device.Bridging.Bridge.1.VLANPort.1.Enable 1
set Device.Bridging.Bridge.1.VLANPort.1.Untagged 0
set Device.Bridging.Bridge.1.VLANPort.1.VLAN Device.Bridging.Bridge.1.VLAN.1
set Device.Bridging.Bridge.1.VLANPort.1.Port Device.Bridging.Bridge.1.Port.2
add Device.Bridging.Bridge.1.VLANPort.
set Device.Bridging.Bridge.1.VLANPort.2.Enable 1
set Device.Bridging.Bridge.1.VLANPort.2.Untagged 0
set Device.Bridging.Bridge.1.VLANPort.2.VLAN Device.Bridging.Bridge.1.VLAN.1
set Device.Bridging.Bridge.1.VLANPort.2.Port Device.Bridging.Bridge.1.Port.3
 
commit
```

### Bridging UCI

```

config bridge 'br_bridge1'
	option name 'br-bridge1'
	option enabled '1'
	option stp '0'
	option priority '32767'
	option hello_time '2'
	option max_age '20'
	option forward_delay '4'
	option Alias 'vlan-tagged'

config port 'br_1_p_1'
	option bridge 'br_bridge1'
	option enabled '1'
	option Alias 'cpe-1'
	option management '1'

config port 'br_1_p_2'
	option bridge 'br_bridge1'
	option enabled '1'
	option Alias 'cpe-2'
	option name 'eth0.1'

config port 'br_1_p_3'
	option bridge 'br_bridge1'
	option enabled '1'
	option Alias 'cpe-3'
	option name 'ae_wan'

config vlan 'br_1_bv_1'
	option bridge 'br_bridge1'
	option enabled '1'
	option Alias 'cpe-1'
	option vlan '100'

config vlanport 'br_1_vp_1'
	option bridge 'br_bridge1'
	option enabled '1'
	option untagged '0'
	option Alias 'cpe-1'
	option vlan 'br_1_bv_1'
	option port 'br_1_p_2'

config vlanport 'br_1_vp_2'
	option bridge 'br_bridge1'
	option enabled '1'
	option untagged '0'
	option Alias 'cpe-2'
	option vlan 'br_1_bv_1'
	option port 'br_1_p_3'
```

### Network UCI

```
config device 'br_bridge1'
	option name 'br-bridge1'
	option type 'bridge'
	option bridge_empty '1'
	option enabled '1'
	option stp '0'
	option priority '32767'
	option hello_time '2'
	option max_age '20'
	option forward_delay '4'

	list ports 'eth0.1'
	list ports 'ae_wan'

config bridge-vlan 'br_1_bv_1'
	option device 'br-bridge1'
	option vlan '100'
	list ports 'eth0.1:t'
	list ports 'ae_wan:t'

config interface 'iface_br1'
	option device 'br-bridge1'

```

## 4. Translated Bridge

VLAN translation: LAN port carries VLAN 4; WAN port (ae_wan) carries VLAN 100. Both are members of the same bridge, effectively translating between VLANs.

### TR-181 Data Model

```
start
 
del Device.IP.Interface.*
del Device.Bridging.Bridge.*
del Device.Ethernet.Link.*
 
add Device.Bridging.Bridge.
set Device.Bridging.Bridge.1.Enable 1
set Device.Bridging.Bridge.1.Alias vlan-translated
 
add Device.Bridging.Bridge.1.Port.
set Device.Bridging.Bridge.1.Port.1.Enable 1
set Device.Bridging.Bridge.1.Port.1.ManagementPort 1
add Device.Bridging.Bridge.1.Port.
set Device.Bridging.Bridge.1.Port.2.Enable 1
set Device.Bridging.Bridge.1.Port.2.ManagementPort 0
set Device.Bridging.Bridge.1.Port.2.LowerLayers Device.Ethernet.Interface.1
add Device.Bridging.Bridge.1.Port.
set Device.Bridging.Bridge.1.Port.3.Enable 1
set Device.Bridging.Bridge.1.Port.3.ManagementPort 0
set Device.Bridging.Bridge.1.Port.3.LowerLayers Device.Ethernet.Interface.6
 
add Device.Bridging.Bridge.1.VLAN.
set Device.Bridging.Bridge.1.VLAN.1.Enable 1
set Device.Bridging.Bridge.1.VLAN.1.VLANID 4

add Device.Bridging.Bridge.1.VLANPort.
set Device.Bridging.Bridge.1.VLANPort.1.Enable 1
set Device.Bridging.Bridge.1.VLANPort.1.Untagged 0
set Device.Bridging.Bridge.1.VLANPort.1.VLAN Device.Bridging.Bridge.1.VLAN.1
set Device.Bridging.Bridge.1.VLANPort.1.Port Device.Bridging.Bridge.1.Port.2
 
add Device.Bridging.Bridge.1.VLANPort.
set Device.Bridging.Bridge.1.VLANPort.2.Enable 1
set Device.Bridging.Bridge.1.VLANPort.2.Untagged 1
set Device.Bridging.Bridge.1.VLANPort.2.VLAN Device.Bridging.Bridge.1.VLAN.1
set Device.Bridging.Bridge.1.VLANPort.2.Port Device.Bridging.Bridge.1.Port.3
set Device.Bridging.Bridge.1.VLANPort.2.X_IOWRT_EU_SVLANID 100
set Device.Bridging.Bridge.1.VLANPort.2.X_IOWRT_EU_TPID 33024
 
commit
```

### Bridging UCI

```
config bridge 'br_bridge1'
	option name 'br-bridge1'
	option enabled '1'
	option stp '0'
	option priority '32767'
	option hello_time '2'
	option max_age '20'
	option forward_delay '4'
	option Alias 'vlan-translated'

config port 'br_1_p_1'
	option bridge 'br_bridge1'
	option enabled '1'
	option Alias 'cpe-1'
	option management '1'

config port 'br_1_p_2'
	option bridge 'br_bridge1'
	option enabled '1'
	option Alias 'cpe-2'
	option name 'eth0.1'

config port 'br_1_p_3'
	option bridge 'br_bridge1'
	option enabled '1'
	option Alias 'cpe-3'
	option name 'ae_wan'

config vlan 'br_1_bv_1'
	option bridge 'br_bridge1'
	option enabled '1'
	option Alias 'cpe-1'
	option vlan '4'

config vlanport 'br_1_vp_1'
	option bridge 'br_bridge1'
	option enabled '1'
	option untagged '0'
	option Alias 'cpe-1'
	option vlan 'br_1_bv_1'
	option port 'br_1_p_2'

config vlanport 'br_1_vp_2'
	option bridge 'br_bridge1'
	option enabled '1'
	option untagged '1'
	option Alias 'cpe-2'
	option vlan 'br_1_bv_1'
	option port 'br_1_p_3'
	option svid '100'
	option tpid '33024'
```

### Network UCI

```
config device 'br_bridge1'
	option name 'br-bridge1'
	option type 'bridge'
	option bridge_empty '1'
	option enabled '1'
	option stp '0'
	option priority '32767'
	option hello_time '2'
	option max_age '20'
	option forward_delay '4'

	list ports 'eth0.1'
	list ports 'ae_wan'
	list ports 'ae_wan.100'

config bridge-vlan 'br_1_bv_1'
	option device 'br-bridge1'
	option vlan '4'
	list ports 'eth0.1:t'
	list ports 'ae_wan.100:u*'

config device 'br_1_vp_2'
	option name 'ae_wan.100'
	option type '8021q'
	option vid '100'
	option ifname 'ae_wan'
	option enabled '1'
	option br_vlan_port '1'
	list egress_qos_mapping '0:0'
	list egress_qos_mapping '1:1'
	list egress_qos_mapping '2:2'
	list egress_qos_mapping '3:3'
	list egress_qos_mapping '4:4'
	list egress_qos_mapping '5:5'
	list egress_qos_mapping '6:6'
	list egress_qos_mapping '7:7'


config interface 'iface_br1'
	option device 'br-bridge1'


```

## 5. Add Another Port to Translated Bridge

Extends scenario 3 (tagged bridge, br-dev3) by adding a new LAN port (eth3) with VLAN 5. This can be acheived in a similar manner as the previous example.

## 6. Q-in-Q Transparent Bridge

The WAN port (ae_wan) uses an 802.1ad (S-VLAN) tag with VLAN 200. LAN port is untagged. The bridge transparently passes customer 802.1q frames inside the provider S-VLAN.

### TR-181 Data Model

```
start
 
del Device.IP.Interface.*
del Device.Bridging.Bridge.*
del Device.Ethernet.Link.*
 
add Device.Bridging.Bridge.
set Device.Bridging.Bridge.1.Enable 1
set Device.Bridging.Bridge.1.Alias qinq-transparent
 
add Device.Bridging.Bridge.1.Port.
set Device.Bridging.Bridge.1.Port.1.Enable 1
set Device.Bridging.Bridge.1.Port.1.ManagementPort 1

add Device.Bridging.Bridge.1.Port.
set Device.Bridging.Bridge.1.Port.2.Enable 1
set Device.Bridging.Bridge.1.Port.2.AcceptableFrameTypes AdmitAll
set Device.Bridging.Bridge.1.Port.2.ManagementPort 0
set Device.Bridging.Bridge.1.Port.2.LowerLayers Device.Ethernet.Interface.1

add Device.Bridging.Bridge.1.Port.
set Device.Bridging.Bridge.1.Port.3.Enable 1
set Device.Bridging.Bridge.1.Port.3.ManagementPort 0
set Device.Bridging.Bridge.1.Port.3.AcceptableFrameTypes AdmitAll
set Device.Bridging.Bridge.1.Port.3.LowerLayers Device.Ethernet.Interface.6
 
add Device.Bridging.Bridge.1.VLAN.
set Device.Bridging.Bridge.1.VLAN.1.VLANID 2 # namesake
set Device.Bridging.Bridge.1.VLAN.1.Enable 1
 
add Device.Bridging.Bridge.1.VLANPort.
set Device.Bridging.Bridge.1.VLANPort.1.Enable 1
set Device.Bridging.Bridge.1.VLANPort.1.Untagged 1
set Device.Bridging.Bridge.1.VLANPort.1.VLAN Device.Bridging.Bridge.1.VLAN.1
set Device.Bridging.Bridge.1.VLANPort.1.Port Device.Bridging.Bridge.1.Port.2

add Device.Bridging.Bridge.1.VLANPort.
set Device.Bridging.Bridge.1.VLANPort.2.Enable 1
set Device.Bridging.Bridge.1.VLANPort.2.Untagged 1
set Device.Bridging.Bridge.1.VLANPort.2.VLAN Device.Bridging.Bridge.1.VLAN.1
set Device.Bridging.Bridge.1.VLANPort.2.Port Device.Bridging.Bridge.1.Port.3
set Device.Bridging.Bridge.1.VLANPort.2.X_IOWRT_EU_SVLANID 200
set Device.Bridging.Bridge.1.VLANPort.2.X_IOWRT_EU_TPID 34984
 
commit
```

### Bridging UCI

```
config bridge 'br_bridge1'
	option name 'br-bridge1'
	option enabled '1'
	option stp '0'
	option priority '32767'
	option hello_time '2'
	option max_age '20'
	option forward_delay '4'
	option Alias 'qinq-transparent'

config port 'br_1_p_1'
	option bridge 'br_bridge1'
	option enabled '1'
	option Alias 'cpe-1'
	option management '1'

config port 'br_1_p_2'
	option bridge 'br_bridge1'
	option enabled '1'
	option Alias 'cpe-2'
	option accept_type 'AdmitAll'
	option name 'eth0.1'

config port 'br_1_p_3'
	option bridge 'br_bridge1'
	option enabled '1'
	option Alias 'cpe-3'
	option name 'ae_wan'
	option accept_type 'AdmitAll'

config vlan 'br_1_bv_1'
	option bridge 'br_bridge1'
	option enabled '1'
	option Alias 'cpe-1'
	option vlan '2'

config vlanport 'br_1_vp_1'
	option bridge 'br_bridge1'
	option enabled '1'
	option untagged '1'
	option Alias 'cpe-1'
	option vlan 'br_1_bv_1'
	option port 'br_1_p_2'

config vlanport 'br_1_vp_2'
	option bridge 'br_bridge1'
	option enabled '1'
	option untagged '1'
	option Alias 'cpe-2'
	option vlan 'br_1_bv_1'
	option port 'br_1_p_3'
	option svid '200'
	option tpid '34984'
```

### Network UCI

```
config device 'LAN1'
	option name 'eth0.1'
	option vlan_transparency '1'

config device 'br_bridge1'
	option name 'br-bridge1'
	option type 'bridge'
	option bridge_empty '1'
	option enabled '1'
	option stp '0'
	option priority '32767'
	option hello_time '2'
	option max_age '20'
	option forward_delay '4'
	list ports 'eth0.1'
	list ports 'ae_wan'
	list ports 'ae_wan.200'

config bridge-vlan 'br_1_bv_1'
	option device 'br-bridge1'
	option vlan '2'
	list ports 'eth0.1:u*'
	list ports 'ae_wan.200:u*'

config device 'br_1_vp_2'
	option name 'ae_wan.200'
	option type '8021ad'
	option vid '200'
	option ifname 'ae_wan'
	option enabled '1'
	option br_vlan_port '1'
	list egress_qos_mapping '0:0'
	list egress_qos_mapping '1:1'
	list egress_qos_mapping '2:2'
	list egress_qos_mapping '3:3'
	list egress_qos_mapping '4:4'
	list egress_qos_mapping '5:5'
	list egress_qos_mapping '6:6'
	list egress_qos_mapping '7:7'
	option vlan_transparency '1'

config interface 'iface_br1'
	option device 'br-bridge1'

```

### Pbit inheritance

Can be controlled using the following option, default enabled:

```
set Device.Bridging.Bridge.1.VLANPort.2.X_IOWRT_EU_PBIT_INHERITANCE 1
```

### Packet dump

```
11:11:37.135453 aa:00:aa:c9:01:01 > aa:00:aa:c8:01:01, ethertype 802.1Q-QinQ (0x88a8), length 106: vlan 200, p 4, ethertype 802.1Q, vlan 100, p 4, ethertype IPv4, (tos 0x0, ttl 64, id 20919, offset 0, flags [DF], proto ICMP (1), length 84)
    10.10.20.101 > 10.10.20.1: ICMP echo request, id 579, seq 7, length 64
11:11:37.135572 aa:00:aa:c8:01:01 > aa:00:aa:c9:01:01, ethertype 802.1Q-QinQ (0x88a8), length 106: vlan 200, p 0, ethertype 802.1Q, vlan 100, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 11472, offset 0, flags [none], proto ICMP (1), length 84)
    10.10.20.1 > 10.10.20.101: ICMP echo reply, id 579, seq 7, length 64

```

## 7. Q-in-Q Tagged on LAN

LAN port carries an inner 802.1q VLAN 100 tag. WAN port (ae_wan) carries an outer 802.1ad S-VLAN 200 and inner C-VLAN 100. Both the raw ae_wan port and the S-VLAN device ae_wan.200 are bridge members in VLAN mode.

### TR-181 Data Model

```
start
 
del Device.IP.Interface.*
del Device.Bridging.Bridge.*
del Device.Ethernet.Link.*
 
add Device.Bridging.Bridge.
set Device.Bridging.Bridge.1.Enable 1

add Device.Bridging.Bridge.1.Port.
set Device.Bridging.Bridge.1.Port.1.Enable 1
set Device.Bridging.Bridge.1.Port.1.ManagementPort 1

add Device.Bridging.Bridge.1.Port.
set Device.Bridging.Bridge.1.Port.2.Enable 1
set Device.Bridging.Bridge.1.Port.2.ManagementPort 0
set Device.Bridging.Bridge.1.Port.2.LowerLayers Device.Ethernet.Interface.1
 
add Device.Bridging.Bridge.1.Port.
set Device.Bridging.Bridge.1.Port.3.Enable 1
set Device.Bridging.Bridge.1.Port.3.ManagementPort 0
set Device.Bridging.Bridge.1.Port.3.LowerLayers Device.Ethernet.Interface.6
 
add Device.Bridging.Bridge.1.VLAN.
set Device.Bridging.Bridge.1.VLAN.1.Enable 1
set Device.Bridging.Bridge.1.VLAN.1.VLANID 100
 
add Device.Bridging.Bridge.1.VLANPort.
set Device.Bridging.Bridge.1.VLANPort.1.Enable 1
set Device.Bridging.Bridge.1.VLANPort.1.VLAN Device.Bridging.Bridge.1.VLAN.1
set Device.Bridging.Bridge.1.VLANPort.1.Port Device.Bridging.Bridge.1.Port.2
 
add Device.Bridging.Bridge.1.VLANPort.
set Device.Bridging.Bridge.1.VLANPort.2.Enable 1
set Device.Bridging.Bridge.1.VLANPort.2.Untagged 0
set Device.Bridging.Bridge.1.VLANPort.2.VLAN Device.Bridging.Bridge.1.VLAN.1
set Device.Bridging.Bridge.1.VLANPort.2.Port Device.Bridging.Bridge.1.Port.3
set Device.Bridging.Bridge.1.VLANPort.2.X_IOWRT_EU_SVLANID 200
set Device.Bridging.Bridge.1.VLANPort.2.X_IOWRT_EU_TPID 34984
 
commit
```

### Bridging UCI

```
config bridge 'br_bridge1'
	option name 'br-bridge1'
	option enabled '1'
	option stp '0'
	option priority '32767'
	option hello_time '2'
	option max_age '20'
	option forward_delay '4'
	option Alias 'cpe-1'

config port 'br_1_p_1'
	option bridge 'br_bridge1'
	option enabled '1'
	option Alias 'cpe-1'
	option management '1'

config port 'br_1_p_2'
	option bridge 'br_bridge1'
	option enabled '1'
	option Alias 'cpe-2'
	option name 'eth0.1'

config port 'br_1_p_3'
	option bridge 'br_bridge1'
	option enabled '1'
	option Alias 'cpe-3'
	option name 'ae_wan'

config vlan 'br_1_bv_1'
	option bridge 'br_bridge1'
	option enabled '1'
	option Alias 'cpe-1'
	option vlan '100'

config vlanport 'br_1_vp_1'
	option bridge 'br_bridge1'
	option enabled '1'
	option untagged '0'
	option Alias 'cpe-1'
	option vlan 'br_1_bv_1'
	option port 'br_1_p_2'

config vlanport 'br_1_vp_2'
	option bridge 'br_bridge1'
	option enabled '1'
	option untagged '0'
	option Alias 'cpe-2'
	option vlan 'br_1_bv_1'
	option port 'br_1_p_3'
	option svid '200'
	option tpid '34984'
```

### Network UCI

```
config device 'br_bridge1'
	option name 'br-bridge1'
	option type 'bridge'
	option bridge_empty '1'
	option enabled '1'
	option stp '0'
	option priority '32767'
	option hello_time '2'
	option max_age '20'
	option forward_delay '4'

	list ports 'ae_wan'
	list ports 'eth0.1'
	list ports 'ae_wan.200'

config bridge-vlan 'br_1_bv_1'
	option device 'br-bridge1'
	option vlan '100'
	list ports 'eth0.1:t'
	list ports 'ae_wan.200:t'

config device 'br_1_vp_2'
	option name 'ae_wan.200'
	option type '8021ad'
	option vid '200'
	option ifname 'ae_wan'
	option enabled '1'
	option br_vlan_port '1'
	list egress_qos_mapping '0:0'
	list egress_qos_mapping '1:1'
	list egress_qos_mapping '2:2'
	list egress_qos_mapping '3:3'
	list egress_qos_mapping '4:4'
	list egress_qos_mapping '5:5'
	list egress_qos_mapping '6:6'
	list egress_qos_mapping '7:7'


config interface 'iface_br1'
	option device 'br-bridge1'

```

## 8. Q-in-Q Untagged on LAN

LAN port is untagged. WAN port (ae_wan) carries an outer 802.1ad S-VLAN 200 and inner C-VLAN 100. Frames egress LAN side are stripped of both tags; ingress LAN frames are double-tagged on the WAN side.

### TR-181 Data Model

```
start
 
del Device.IP.Interface.*
del Device.Bridging.Bridge.*
del Device.Ethernet.Link.*
 
add Device.Bridging.Bridge.
set Device.Bridging.Bridge.1.Enable 1

add Device.Bridging.Bridge.1.Port.
set Device.Bridging.Bridge.1.Port.1.Enable 1
set Device.Bridging.Bridge.1.Port.1.ManagementPort 1

add Device.Bridging.Bridge.1.Port.
set Device.Bridging.Bridge.1.Port.2.Enable 1
set Device.Bridging.Bridge.1.Port.2.ManagementPort 0
set Device.Bridging.Bridge.1.Port.2.LowerLayers Device.Ethernet.Interface.1
 
add Device.Bridging.Bridge.1.Port.
set Device.Bridging.Bridge.1.Port.3.Enable 1
set Device.Bridging.Bridge.1.Port.3.ManagementPort 0
set Device.Bridging.Bridge.1.Port.3.LowerLayers Device.Ethernet.Interface.6
 
add Device.Bridging.Bridge.1.VLAN.
set Device.Bridging.Bridge.1.VLAN.1.VLANID 100
set Device.Bridging.Bridge.1.VLAN.1.Enable 1
 
add Device.Bridging.Bridge.1.VLANPort.
set Device.Bridging.Bridge.1.VLANPort.1.Enable 1
set Device.Bridging.Bridge.1.VLANPort.1.VLAN Device.Bridging.Bridge.1.VLAN.1
set Device.Bridging.Bridge.1.VLANPort.1.Port Device.Bridging.Bridge.1.Port.2
set Device.Bridging.Bridge.1.VLANPort.1.Untagged 1
 
add Device.Bridging.Bridge.1.VLANPort.
set Device.Bridging.Bridge.1.VLANPort.2.Enable 1
set Device.Bridging.Bridge.1.VLANPort.2.VLAN Device.Bridging.Bridge.1.VLAN.1
set Device.Bridging.Bridge.1.VLANPort.2.Port Device.Bridging.Bridge.1.Port.3
set Device.Bridging.Bridge.1.VLANPort.2.X_IOWRT_EU_SVLANID 200
set Device.Bridging.Bridge.1.VLANPort.2.X_IOWRT_EU_TPID 34984
 
commit
```

### Bridging UCI

```
config bridge 'br_bridge1'
	option name 'br-bridge1'
	option enabled '1'
	option stp '0'
	option priority '32767'
	option hello_time '2'
	option max_age '20'
	option forward_delay '4'
	option Alias 'cpe-1'

config port 'br_1_p_1'
	option bridge 'br_bridge1'
	option enabled '1'
	option Alias 'cpe-1'
	option management '1'

config port 'br_1_p_2'
	option bridge 'br_bridge1'
	option enabled '1'
	option Alias 'cpe-2'
	option name 'eth0.1'

config port 'br_1_p_3'
	option bridge 'br_bridge1'
	option enabled '1'
	option Alias 'cpe-3'
	option name 'ae_wan'

config vlan 'br_1_bv_1'
	option bridge 'br_bridge1'
	option enabled '1'
	option Alias 'cpe-1'
	option vlan '100'

config vlanport 'br_1_vp_1'
	option bridge 'br_bridge1'
	option enabled '1'
	option untagged '1'
	option Alias 'cpe-1'
	option vlan 'br_1_bv_1'
	option port 'br_1_p_2'

config vlanport 'br_1_vp_2'
	option bridge 'br_bridge1'
	option enabled '1'
	option untagged '0'
	option Alias 'cpe-2'
	option vlan 'br_1_bv_1'
	option port 'br_1_p_3'
	option svid '200'
	option tpid '34984'
```

### Network UCI

```
config device 'br_bridge1'
	option name 'br-bridge1'
	option type 'bridge'
	option bridge_empty '1'
	option enabled '1'
	option stp '0'
	option priority '32767'
	option hello_time '2'
	option max_age '20'
	option forward_delay '4'

	list ports 'ae_wan'
	list ports 'eth0.1'
	list ports 'ae_wan.200'

config bridge-vlan 'br_1_bv_1'
	option device 'br-bridge1'
	option vlan '100'
	list ports 'eth0.1:u*'
	list ports 'ae_wan.200:t'

config device 'br_1_vp_2'
	option name 'ae_wan.200'
	option type '8021ad'
	option vid '200'
	option ifname 'ae_wan'
	option enabled '1'
	option br_vlan_port '1'
	list egress_qos_mapping '0:0'
	list egress_qos_mapping '1:1'
	list egress_qos_mapping '2:2'
	list egress_qos_mapping '3:3'
	list egress_qos_mapping '4:4'
	list egress_qos_mapping '5:5'
	list egress_qos_mapping '6:6'
	list egress_qos_mapping '7:7'


config interface 'iface_br1'
	option device 'br-bridge1'

```

### Packet dump

```
12:05:18.944284 aa:00:aa:c9:01:01 > aa:00:aa:c8:01:01, ethertype 802.1Q-QinQ (0x88a8), length 106: vlan 200, p 0, ethertype 802.1Q, vlan 100, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 24898, offset 0, flags [DF], proto ICMP (1), length 84)
    10.10.20.200 > 10.10.20.1: ICMP echo request, id 594, seq 1, length 64
12:05:18.944401 aa:00:aa:c8:01:01 > aa:00:aa:c9:01:01, ethertype 802.1Q-QinQ (0x88a8), length 106: vlan 200, p 0, ethertype 802.1Q, vlan 100, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 33546, offset 0, flags [none], proto ICMP (1), length 84)
    10.10.20.1 > 10.10.20.200: ICMP echo reply, id 594, seq 1, length 64
12:05:19.945636 aa:00:aa:c9:01:01 > aa:00:aa:c8:01:01, ethertype 802.1Q-QinQ (0x88a8), length 106: vlan 200, p 0, ethertype 802.1Q, vlan 100, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 25518, offset 0, flags [DF], proto ICMP (1), length 84)
    10.10.20.200 > 10.10.20.1: ICMP echo request, id 594, seq 2, length 64
12:05:19.945743 aa:00:aa:c8:01:01 > aa:00:aa:c9:01:01, ethertype 802.1Q-QinQ (0x88a8), length 106: vlan 200, p 0, ethertype 802.1Q, vlan 100, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 34521, offset 0, flags [none], proto ICMP (1), length 84)
    10.10.20.1 > 10.10.20.200: ICMP echo reply, id 594, seq 2, length 64
```
