mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-01-27 17:37:18 +01:00
the idea is to make them similar to route interface, to avoid confusion * they can be also be mgmt/inet/iptv * they will have default proto set to dhcp * syntax is now direct:vlan:100 or direct:transparent
314 lines
9.7 KiB
Markdown
314 lines
9.7 KiB
Markdown
# Advanced Mode - Quick Reference
|
|
|
|
## Interface Type Syntax
|
|
|
|
### Bridge Types (Traditional VLAN Devices)
|
|
```
|
|
bridge:transparent # No VLANs
|
|
bridge:tagged:VID # All ports tagged
|
|
bridge:wan-tagged:VID # Only WAN tagged
|
|
bridge:transparent-qinq:SVID # LAN untagged, WAN S-tag
|
|
bridge:transparent-qinq:C:S # LAN untagged, WAN C+S tags
|
|
bridge:tagged-qinq:C:S # LAN C-tag, WAN C+S tags
|
|
bridge:qinq:C:S # All ports C+S tags
|
|
```
|
|
|
|
### Bridge VLAN Filtering (Modern - Recommended)
|
|
```
|
|
brvlan:tagged:VID # All ports tagged (bridge-vlan)
|
|
brvlan:wan-tagged:VID # WAN tagged, LAN untagged (bridge-vlan)
|
|
brvlan:mixed:VID # Custom tagging (bridge-vlan)
|
|
```
|
|
|
|
### Routed Types
|
|
```
|
|
route:transparent # No VLAN, default MAC
|
|
route:vlan:VID # VLAN routing
|
|
route:macvlan:MAC # MACVLAN device (supports BaseMACAddress macros)
|
|
route:vlan:VID:MAC # VLAN + custom MAC
|
|
```
|
|
|
|
### Standalone Types
|
|
```
|
|
direct:vlan:VID # Standalone VLAN (proto=dhcp)
|
|
direct:transparent # No VLAN
|
|
```
|
|
|
|
### Device Reference Types
|
|
```
|
|
device-ref:INTERFACE # Reference device from another interface
|
|
# Allows multiple interfaces to share the same device
|
|
# Example: wan6 sharing wan's device
|
|
```
|
|
|
|
### Modifiers
|
|
```
|
|
-pppoe # proto=pppoe (PPPoE authentication)
|
|
-dhcpv6 # proto=dhcpv6 (DHCPv6 client)
|
|
-dhcp # proto=dhcp (DHCP client - explicit, default if no suffix)
|
|
-static # proto=static (static IP configuration)
|
|
-none, -n # proto=none (no IP configuration)
|
|
-disabled, -d # disabled=1 (interface disabled)
|
|
```
|
|
|
|
**Default Protocol**: If no protocol modifier is specified, the interface defaults to `-dhcp`.
|
|
|
|
**Note**: When using `-static` with interface name `lan`, the system automatically configures:
|
|
- IP: 192.168.1.1/24
|
|
- IPv6 prefix delegation: /60
|
|
- DHCP server: 192.168.1.100-250, 1h lease
|
|
- DHCPv6 and RA server enabled
|
|
|
|
### MAC Address Macros
|
|
```
|
|
BaseMACAddress # Base MAC from fw_printenv -n ethaddr
|
|
BaseMACAddressP1 # Base MAC + 1
|
|
BaseMACAddressP2 # Base MAC + 2
|
|
BaseMACAddressPN # Base MAC + N
|
|
AA:BB:CC:DD:EE:FF # Explicit MAC address
|
|
```
|
|
|
|
---
|
|
|
|
## Common Configurations
|
|
|
|
### 1. Transparent Bridge
|
|
```bash
|
|
uci set netmode.global.mode='advanced'
|
|
uci set netmode.@supported_args[0].value='wan'
|
|
uci set netmode.@supported_args[1].value='bridge:transparent'
|
|
uci set netmode.@supported_args[2].value='ALL'
|
|
uci commit netmode && service netmode restart
|
|
```
|
|
|
|
### 2. Router Mode (LAN + WAN)
|
|
```bash
|
|
# LAN bridge with static IP + DHCP server, WAN bridge with DHCP client
|
|
uci set netmode.global.mode='advanced'
|
|
uci set netmode.@supported_args[0].value='lan,wan'
|
|
uci set netmode.@supported_args[1].value='bridge:transparent-static,bridge:tagged:2501'
|
|
uci set netmode.@supported_args[2].value='ALL_LAN,WAN'
|
|
uci commit netmode && service netmode restart
|
|
```
|
|
|
|
### 3. VLAN-Tagged Bridge
|
|
```bash
|
|
uci set netmode.global.mode='advanced'
|
|
uci set netmode.@supported_args[0].value='mgmt'
|
|
uci set netmode.@supported_args[1].value='bridge:tagged:100'
|
|
uci set netmode.@supported_args[2].value='ALL'
|
|
uci commit netmode && service netmode restart
|
|
```
|
|
|
|
### 4. Multiple Service Bridges
|
|
```bash
|
|
uci set netmode.global.mode='advanced'
|
|
uci set netmode.@supported_args[0].value='inet,iptv,mgmt'
|
|
uci set netmode.@supported_args[1].value='bridge:tagged:100-n,bridge:tagged:200-n,bridge:tagged:300'
|
|
uci set netmode.@supported_args[2].value='LAN1-LAN2-WAN,LAN3-LAN4-WAN,WAN'
|
|
uci commit netmode && service netmode restart
|
|
```
|
|
|
|
### 5. QinQ Configuration
|
|
```bash
|
|
uci set netmode.global.mode='advanced'
|
|
uci set netmode.@supported_args[0].value='customer_a,customer_b'
|
|
uci set netmode.@supported_args[1].value='bridge:qinq:10:100-n,bridge:qinq:20:100-n'
|
|
uci set netmode.@supported_args[2].value='LAN1-LAN2-WAN,LAN3-LAN4-WAN'
|
|
uci commit netmode && service netmode restart
|
|
```
|
|
|
|
### 6. Routed Multi-Service (VLAN)
|
|
```bash
|
|
uci set netmode.global.mode='advanced'
|
|
uci set netmode.@supported_args[0].value='wan,iptv,mgmt'
|
|
uci set netmode.@supported_args[1].value='route:vlan:100,route:vlan:200,route:vlan:300'
|
|
uci set netmode.@supported_args[2].value='WAN,WAN,WAN'
|
|
uci commit netmode && service netmode restart
|
|
```
|
|
|
|
### 7. Routed Multi-Service with Custom MAC Addresses
|
|
```bash
|
|
uci set netmode.global.mode='advanced'
|
|
uci set netmode.@supported_args[0].value='wan,iptv'
|
|
uci set netmode.@supported_args[1].value='route:transparent,route:transparent'
|
|
uci set netmode.@supported_args[2].value='WAN,WAN'
|
|
uci set netmode.@supported_args[3].value='BaseMACAddress,BaseMACAddressP1'
|
|
uci commit netmode && service netmode restart
|
|
```
|
|
|
|
### 8. IPv4 + IPv6 on Same Device (Device Reference)
|
|
```bash
|
|
# wan uses DHCP, wan6 uses DHCPv6 on the same bridge device
|
|
uci set netmode.global.mode='advanced'
|
|
uci set netmode.@supported_args[0].value='wan,wan6'
|
|
uci set netmode.@supported_args[1].value='bridge:tagged:2501,device-ref:wan-dhcpv6'
|
|
uci set netmode.@supported_args[2].value='WAN,WAN'
|
|
uci commit netmode && service netmode restart
|
|
```
|
|
|
|
### 9. Direct VLAN Interface
|
|
```bash
|
|
uci set netmode.global.mode='advanced'
|
|
uci set netmode.@supported_args[0].value='wan'
|
|
uci set netmode.@supported_args[1].value='direct:vlan:2501'
|
|
uci set netmode.@supported_args[2].value='WAN'
|
|
uci commit netmode && service netmode restart
|
|
```
|
|
|
|
### 10. Hybrid (Routed + Bridged)
|
|
```bash
|
|
uci set netmode.global.mode='advanced'
|
|
uci set netmode.mode_4_supprted_args_1.value='wan,iptv'
|
|
uci set netmode.mode_4_supprted_args_2.value='route:vlan:100,bridge:tagged:200-n'
|
|
uci set netmode.mode_4_supprted_args_3.value='WAN,LAN1-LAN2-LAN3-WAN'
|
|
uci commit netmode && service netmode restart
|
|
```
|
|
|
|
### 11. Bridge VLAN Filtering (WAN Tagged)
|
|
```bash
|
|
uci set netmode.global.mode='advanced'
|
|
uci set netmode.mode_4_supprted_args_1.value='internet'
|
|
uci set netmode.mode_4_supprted_args_2.value='brvlan:wan-tagged:1499'
|
|
uci set netmode.mode_4_supprted_args_3.value='LAN1-LAN2-WAN'
|
|
uci commit netmode && service netmode restart
|
|
```
|
|
|
|
### 12. Multiple Services with Bridge VLAN Filtering
|
|
```bash
|
|
uci set netmode.global.mode='advanced'
|
|
uci set netmode.mode_4_supprted_args_1.value='internet,tv'
|
|
uci set netmode.mode_4_supprted_args_2.value='brvlan:wan-tagged:1499,brvlan:wan-tagged:1510-n'
|
|
uci set netmode.mode_4_supprted_args_3.value='LAN1-LAN2-WAN,LAN3-LAN4-WAN'
|
|
uci commit netmode && service netmode restart
|
|
```
|
|
|
|
---
|
|
|
|
## Port List Syntax
|
|
|
|
| Syntax | Description |
|
|
|--------|-------------|
|
|
| `ALL` | All LAN + WAN + EXT ports (from UCI/board.json) |
|
|
| `ALL_LAN` | All LAN ports only (no WAN, no EXT) |
|
|
| `LAN` | Single LAN port (for devices with one LAN port) |
|
|
| `WAN` | WAN port only |
|
|
| `EXT` | EXT port only |
|
|
| `LAN-WAN` | Single LAN port and WAN |
|
|
| `LAN1-LAN2-WAN` | LAN1, LAN2, and WAN |
|
|
| `LAN1-LAN3-EXT` | LAN1, LAN3, and EXT |
|
|
| `WAN-EXT` | WAN and EXT ports |
|
|
|
|
**Note**: `LAN` is used for devices with a single LAN port, while `LAN1-8` are used for devices with multiple numbered LAN ports. The system automatically detects which is present in UCI.
|
|
|
|
---
|
|
|
|
## Verification Commands
|
|
|
|
```bash
|
|
# Check current mode
|
|
cat /etc/netmodes/.last_mode
|
|
|
|
# View configuration
|
|
uci show netmode
|
|
|
|
# View network interfaces
|
|
ip addr show
|
|
|
|
# View bridges
|
|
brctl show
|
|
|
|
# View VLAN devices
|
|
ip -d link show type vlan
|
|
|
|
# View MACVLAN devices
|
|
ip -d link show type macvlan
|
|
|
|
# View logs
|
|
logread | grep netmode-advanced
|
|
|
|
# Test DHCP
|
|
udhcpc -i wan -n
|
|
|
|
# Capture VLAN traffic
|
|
tcpdump -i eth4 -e -n vlan
|
|
```
|
|
|
|
---
|
|
|
|
## Troubleshooting
|
|
|
|
### Force mode reapply
|
|
```bash
|
|
rm /etc/netmodes/.last_mode
|
|
service netmode restart
|
|
```
|
|
|
|
### Check for errors
|
|
```bash
|
|
logread | grep -E "(error|ERROR|failed|FAILED)"
|
|
```
|
|
|
|
### Verify UCI syntax
|
|
```bash
|
|
uci show netmode
|
|
uci show network
|
|
```
|
|
|
|
### Reset to DHCP mode
|
|
```bash
|
|
uci set netmode.global.mode='routed-dhcp'
|
|
uci commit netmode
|
|
service netmode restart
|
|
```
|
|
|
|
---
|
|
|
|
## TR-181 Argument Mapping
|
|
|
|
```
|
|
Device.X_IOWRT_EU_NetMode.SupportedModes.4.SupportedArguments.1.Value = interface_names
|
|
Device.X_IOWRT_EU_NetMode.SupportedModes.4.SupportedArguments.2.Value = interface_types
|
|
Device.X_IOWRT_EU_NetMode.SupportedModes.4.SupportedArguments.3.Value = ports
|
|
Device.X_IOWRT_EU_NetMode.SupportedModes.4.SupportedArguments.4.Value = macaddrs
|
|
```
|
|
|
|
---
|
|
|
|
## Examples by Use Case
|
|
|
|
### ISP Triple-Play (VLAN-based with MAC Addresses)
|
|
```bash
|
|
# Internet VLAN 100, IPTV VLAN 200, VoIP VLAN 300 with different MACs
|
|
uci set netmode.global.mode='advanced'
|
|
uci set netmode.@supported_args[0].value='wan,iptv,voip'
|
|
uci set netmode.@supported_args[1].value='route:vlan:100,route:vlan:200,route:vlan:300'
|
|
uci set netmode.@supported_args[2].value='WAN,WAN,WAN'
|
|
uci set netmode.@supported_args[3].value='BaseMACAddress,BaseMACAddressP1,BaseMACAddressP2'
|
|
uci commit netmode && service netmode restart
|
|
```
|
|
|
|
### Enterprise Guest + Corporate Networks
|
|
```bash
|
|
# Guest VLAN 100, Corporate VLAN 200, Management VLAN 300
|
|
uci set netmode.global.mode='advanced'
|
|
uci set netmode.@supported_args[0].value='guest,corporate,mgmt'
|
|
uci set netmode.@supported_args[1].value='bridge:tagged:100-n,bridge:tagged:200-n,bridge:tagged:300'
|
|
uci set netmode.@supported_args[2].value='LAN1-WAN,LAN2-LAN3-WAN,WAN'
|
|
uci commit netmode && service netmode restart
|
|
```
|
|
|
|
### Wholesale QinQ Provider
|
|
```bash
|
|
# Multiple customers with different C-tags, same S-tag
|
|
uci set netmode.global.mode='advanced'
|
|
uci set netmode.@supported_args[0].value='cust_a,cust_b,cust_c'
|
|
uci set netmode.@supported_args[1].value='bridge:qinq:10:100-n,bridge:qinq:20:100-n,bridge:qinq:30:100-n'
|
|
uci set netmode.@supported_args[2].value='LAN1-LAN2-WAN,LAN3-LAN4-WAN,LAN5-LAN6-WAN'
|
|
uci commit netmode && service netmode restart
|
|
```
|
|
|
|
---
|
|
|
|
**Version**: 1.0
|
|
**Last Updated**: 2024-12-12
|