3 # Copyright (C) 2011 OpenWrt.org
6 [ -e /etc/config/network ] && exit 0
8 touch /etc/config/network
10 . /lib/functions/uci-defaults.sh
13 ucidef_set_interface_loopback
15 board=$(ar71xx_board_name)
22 ucidef_set_interface_lan "eth0 eth1"
27 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
28 ucidef_add_switch "switch0" "1" "1"
29 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
30 ucidef_add_switch_vlan "switch0" "2" "0t 1"
34 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
35 ucidef_add_switch "switch0" "1" "1"
36 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
37 ucidef_add_switch_vlan "switch0" "2" "0t 1"
41 ucidef_set_interfaces_lan_wan "eth0" "eth1"
42 ucidef_add_switch "switch0" "1" "1"
43 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
44 ucidef_add_switch_vlan "switch0" "2" "5 6"
50 ucidef_set_interfaces_lan_wan "eth1" "eth0"
51 ucidef_add_switch "switch0" "1" "1"
52 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
53 ucidef_add_switch_vlan "switch0" "2" "5 6"
59 ucidef_set_interfaces_lan_wan "eth1" "eth0"
60 ucidef_add_switch "switch0" "1" "1"
61 ucidef_add_switch_vlan "switch0" "1" "0 2 3 4 5"
62 ucidef_add_switch_vlan "switch0" "2" "1 6"
71 ucidef_set_interfaces_lan_wan "eth0.1 eth1" "eth0.2"
72 ucidef_add_switch "switch0" "1" "1"
73 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
74 ucidef_add_switch_vlan "switch0" "2" "0t 1"
75 ucidef_add_switch "switch1" "1" "1"
76 ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 4 5"
79 rb-2011uas* | rb-2011uias | rb-2011uias-2hnd)
80 ucidef_set_interface_raw "sfp" "eth0.3"
81 ucidef_add_switch_vlan "switch0" "3" "0t 6"
88 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
89 ucidef_add_switch "switch0" "1" "1"
90 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
94 ucidef_set_interfaces_lan_wan "eth0" "eth1"
95 ucidef_add_switch "switch0" "1" "1"
96 ucidef_add_switch_vlan "switch0" "0" "0 1 2 3 5"
100 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
101 ucidef_add_switch "switch0" "1" "1"
102 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
103 ucidef_add_switch_vlan "switch0" "2" "5 6"
108 ucidef_set_interfaces_lan_wan "eth1" "eth0"
109 ucidef_add_switch "switch0" "1" "1"
110 ucidef_add_switch_vlan "switch0" "1" "1 2 5"
114 ucidef_set_interfaces_lan_wan "eth1" "eth0"
115 ucidef_add_switch "switch0" "1" "1"
116 ucidef_add_switch_vlan "switch0" "1" "0 1 2"
120 ucidef_set_interfaces_lan_wan "eth1" "eth0"
121 ucidef_add_switch "switch0" "1" "1"
122 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5"
127 ucidef_set_interfaces_lan_wan "eth1" "eth0"
128 ucidef_add_switch "switch0" "1" "1"
129 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
137 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
138 ucidef_add_switch "switch0" "1" "1"
139 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
140 ucidef_add_switch_vlan "switch0" "2" "0t 1"
144 ucidef_set_interfaces_lan_wan "eth1" "eth0"
148 ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
149 ucidef_add_switch "switch0" "1" "1"
150 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
151 ucidef_add_switch "switch1" "1" "1"
152 ucidef_add_switch_vlan "switch1" "1" "0t 1 2 3 4"
153 ucidef_add_switch_vlan "switch1" "2" "0t 5"
159 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
160 ucidef_add_switch "switch0" "1" "1"
161 ucidef_add_switch_vlan "switch0" "1" "0t 1 3 4 5"
162 ucidef_add_switch_vlan "switch0" "2" "0t 2"
166 ucidef_set_interfaces_lan_wan "eth1" "eth0"
167 ucidef_add_switch "switch0" "1" "1"
168 ucidef_add_switch_vlan "switch0" "1" "0 1 3"
172 ucidef_set_interface_lan "eth0"
177 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
178 ucidef_add_switch "switch0" "1" "1"
179 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
180 ucidef_add_switch_vlan "switch0" "2" "0t 1"
184 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
185 ucidef_add_switch "switch0" "1" "1"
186 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
187 ucidef_add_switch_vlan "switch0" "2" "0 5t"
191 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
192 ucidef_add_switch "switch0" "1" "1"
193 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 9t"
194 ucidef_add_switch_vlan "switch0" "2" "0 9t"
199 ucidef_set_interface_raw "eth" "eth0"
200 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
209 ucidef_set_interfaces_lan_wan "eth1" "eth0"
210 ucidef_add_switch "switch0" "1" "1"
211 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
215 ucidef_set_interface_lan "eth0"
216 ucidef_add_switch "switch0" "1" "1"
217 ucidef_add_switch_vlan "switch0" "1" "0 1 2"
221 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
222 ucidef_add_switch "switch0" "1" "1"
223 ucidef_add_switch_vlan "switch0" "1" "0t 5"
224 ucidef_add_switch_vlan "switch0" "2" "0t 1"
228 ucidef_set_interfaces_lan_wan "eth0" "eth1"
229 ucidef_add_switch "switch0" "1" "1"
230 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 5"
234 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
235 ucidef_add_switch "switch0" "1" "1"
236 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
241 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
242 ucidef_add_switch "switch0" "1" "1"
243 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
244 ucidef_add_switch_vlan "switch0" "2" "0t 5"
245 mac=$(mtd_get_mac_ascii nvram "wan_mac")
246 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
251 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
252 ucidef_add_switch "switch0" "1" "1"
253 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
254 ucidef_add_switch_vlan "switch0" "2" "0t 5"
255 mac=$(mtd_get_mac_ascii devdata "wanmac")
256 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
262 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
263 ucidef_add_switch "switch0" "1" "1"
264 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
265 ucidef_add_switch_vlan "switch0" "2" "0t 5"
266 mac_lan=$(mtd_get_mac_binary caldata 0)
267 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr "lan" "$mac_lan"
268 mac_wan=$(mtd_get_mac_binary caldata 6)
269 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr "wan" "$mac_wan"
274 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
275 ucidef_add_switch "switch0" "1" "1"
276 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
277 ucidef_add_switch_vlan "switch0" "2" "0t 5"
278 mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
279 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
315 ucidef_set_interface_lan "eth0"
319 ucidef_set_interface_lan "eth1"
333 ucidef_set_interfaces_lan_wan "eth1" "eth0"
364 ucidef_set_interfaces_lan_wan "eth0" "eth1"
365 ucidef_add_switch "switch0" "1" "1"
366 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
370 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
371 ucidef_add_switch "switch0" "1" "1"
372 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
373 ucidef_add_switch_vlan "switch0" "2" "0t 1"
377 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
378 ucidef_add_switch "switch0" "1" "1"
379 ucidef_add_switch_vlan "switch0" "1" "0t 1 2"
380 ucidef_add_switch_vlan "switch0" "2" "0t 3"
384 ucidef_set_interfaces_lan_wan "eth0" "eth1"
385 ucidef_add_switch "switch0" "1" "1"
386 ucidef_add_switch_vlan "switch0" "1" "0 2 3"
390 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
391 ucidef_add_switch "switch0" "1" "1"
392 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
393 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
394 uci set network.@switch[-1].blinkrate='2'
396 ucidef_add_switch_port "switch0" "1"
397 # Port 1 controls the GREEN configuration of LEDs for
398 # the switch and the section does not correspond to a real
401 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
402 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
403 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
404 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
405 # 14: Link (master); 15: separate register
406 uci set network.@switch_port[-1].led='6'
408 ucidef_add_switch_port "switch0" "2"
409 # Port 2 controls the ORANGE configuration of LEDs for
410 # the switch and the section does not correspond to a real
413 # See the key above for switch port 1 for the meaning of the
414 # 'led' setting below.
415 uci set network.@switch_port[-1].led='9'
417 ucidef_add_switch_port "switch0" "5"
418 # Port 5 controls the configuration of the WAN LED and the
419 # section does not correspond to a real switch port.
421 # To toggle the use of green or orange LEDs for the WAN port,
422 # see the LED setting for wndr3700:green:wan in /etc/config/system.
424 # See the key above for switch port 1 for the meaning of the
425 # 'led' setting below.
426 uci set network.@switch_port[-1].led='2'
430 ucidef_set_interfaces_lan_wan "eth0" "eth1"