root@OpenWrt:~# cat /etc/config/network
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config interface 'lan'
option proto 'dhcp'
option ifname 'eth0.1'
option hostname 'r43b'
config interface 'VLAN42'
option ifname 'eth0.42'
option type 'bridge'
option proto 'none'
option auto '1'
config switch
option name 'switch0'
option reset '1'
option enable_vlan '1'
config switch_vlan
option device 'switch0'
option vlan '1'
option vid '1'
option ports '0t 1 2 4 5'
config switch_vlan
option device 'switch0'
option vlan '2'
option vid '42'
option ports '0t 1t 3'
root@OpenWrt:~# cat /etc/config/wireless
config wifi-device 'radio0'
option type 'mac80211'
option hwmode '11g'
option path 'platform/ar934x_wmac'
option htmode 'HT20'
option country 'DE'
option txpower '20'
option channel '1'
config wifi-iface
option device 'radio0'
option mode 'ap'
option encryption 'none'
option network 'VLAN42'
option ssid 'FreifunkWees01-2b'
config wifi-device 'radio1'
option type 'mac80211'
option channel '36'
option hwmode '11a'
option path 'pci0000:00/0000:00:00.0'
option htmode 'HT20'
option disabled '1'
option txpower '17'
option country 'DE'
config wifi-iface
option device 'radio1'
option mode 'ap'
option ssid 'OpenWrt'
option encryption 'none'
option network 'VLAN42'
Alle vier LAN-Ports und Wifi landen bei dieser Konfiguration im Tunnel bzw. VLAN 42.
root@FreifunkWees01:~# cat /etc/config/network
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config interface 'lan'
option ifname 'eth0.1'
option proto 'dhcp'
option hostname 'r10'
config switch
option name 'rtl8366rb'
option reset '1'
option enable_vlan '1'
option enable_vlan4k '1'
config switch_vlan
option device 'rtl8366rb'
option vlan '1'
option ports '0 5t'
config switch_vlan
option device 'rtl8366rb'
option vlan '42'
option ports '0t 1 2 3 4 5t'
config interface 'VLAN42'
option type 'bridge'
option proto 'none'
option auto '1'
option ifname 'eth0.42'
root@FreifunkWees01:~# cat /etc/config/wireless
config wifi-device 'radio0'
option type 'mac80211'
option macaddr '64:66:b3:fa:34:98'
list ht_capab 'SHORT-GI-40'
list ht_capab 'DSSS_CCK-40'
option country 'DE'
option txpower '20'
option channel '11'
config wifi-iface
option device 'radio0'
option mode 'ap'
option encryption 'none'
option ssid 'FreifunkWees01-1'
option network 'VLAN42'
dede@lrp2 ~ $ cat /etc/network/interfaces
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
auto eth0.42
iface eth0.42 inet dhcp
vlan-raw-device eth0
post-up route del default; route add default gw 192.168.42.254
Ohne die post-up-Zeile sähe es so aus:
dede@lrp2 ~ $ route
Kernel-IP-Routentabelle
Ziel Router Genmask Flags Metric Ref Use Iface
default gw 0.0.0.0 UG 0 0 0 eth0.42
192.168.42.0 * 255.255.255.0 U 0 0 0 eth0.42
192.168.178.0 * 255.255.255.0 U 0 0 0 eth0
...und das VLAN42 wäre zwar erreichbar, aber aller Verkehr ins Internet würde direkt über die Fritzbox laufen.
dede@lrp2 ~ $ route
Kernel-IP-Routentabelle
Ziel Router Genmask Flags Metric Ref Use Iface
default fritz.box 0.0.0.0 UG 0 0 0 eth0
192.168.42.0 * 255.255.255.0 U 0 0 0 eth0.42
192.168.178.0 * 255.255.255.0 U 0 0 0 eth0