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"
35 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
36 ucidef_add_switch "switch0" "1" "1"
37 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
38 ucidef_add_switch_vlan "switch0" "2" "0t 1"
42 ucidef_set_interfaces_lan_wan "eth0" "eth1"
43 ucidef_add_switch "switch0" "1" "1"
44 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
45 ucidef_add_switch_vlan "switch0" "2" "5 6"
52 ucidef_set_interfaces_lan_wan "eth1" "eth0"
53 ucidef_add_switch "switch0" "1" "1"
54 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
55 ucidef_add_switch_vlan "switch0" "2" "5 6"
61 ucidef_set_interfaces_lan_wan "eth1" "eth0"
62 ucidef_add_switch "switch0" "1" "1"
63 ucidef_add_switch_vlan "switch0" "1" "0 2 3 4 5"
64 ucidef_add_switch_vlan "switch0" "2" "1 6"
68 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
69 ucidef_add_switch "switch0" "1" "1"
70 ucidef_add_switch_vlan "switch0" "1" "0t 5"
71 ucidef_add_switch_vlan "switch0" "2" "0t 4"
80 ucidef_set_interfaces_lan_wan "eth0.1 eth1" "eth0.2"
81 ucidef_add_switch "switch0" "1" "1"
82 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
83 ucidef_add_switch_vlan "switch0" "2" "0t 1"
84 ucidef_add_switch "switch1" "1" "1"
85 ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 4 5"
88 rb-2011uas* | rb-2011uias | rb-2011uias-2hnd)
89 ucidef_set_interface_raw "sfp" "eth0.3"
90 ucidef_add_switch_vlan "switch0" "3" "0t 6"
97 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
98 ucidef_add_switch "switch0" "1" "1"
99 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
103 ucidef_set_interfaces_lan_wan "eth1" "eth0"
104 ucidef_add_switch "switch0" "1" "1"
105 ucidef_add_switch_vlan "switch0" "1" "2 3 4 5 6"
106 ucidef_add_switch_vlan "switch0" "2" "0 1"
110 ucidef_set_interfaces_lan_wan "eth0" "eth1"
111 ucidef_add_switch "switch0" "1" "1"
112 ucidef_add_switch_vlan "switch0" "0" "0 1 2 3 5"
116 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
117 ucidef_add_switch "switch0" "1" "1"
118 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
119 ucidef_add_switch_vlan "switch0" "2" "5 6"
124 ucidef_set_interfaces_lan_wan "eth1" "eth0"
125 ucidef_add_switch "switch0" "1" "1"
126 ucidef_add_switch_vlan "switch0" "1" "1 2 5"
130 ucidef_set_interfaces_lan_wan "eth1" "eth0"
131 ucidef_add_switch "switch0" "1" "1"
132 ucidef_add_switch_vlan "switch0" "1" "0 1 2"
136 ucidef_set_interfaces_lan_wan "eth1" "eth0"
137 ucidef_add_switch "switch0" "1" "1"
138 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5"
143 ucidef_set_interfaces_lan_wan "eth1" "eth0"
144 ucidef_add_switch "switch0" "1" "1"
145 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
153 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
154 ucidef_add_switch "switch0" "1" "1"
155 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
156 ucidef_add_switch_vlan "switch0" "2" "0t 1"
160 ucidef_set_interfaces_lan_wan "eth1" "eth0"
164 ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
165 ucidef_add_switch "switch0" "1" "1"
166 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
167 ucidef_add_switch "switch1" "1" "1"
168 ucidef_add_switch_vlan "switch1" "1" "0t 1 2 3 4"
169 ucidef_add_switch_vlan "switch1" "2" "0t 5"
175 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
176 ucidef_add_switch "switch0" "1" "1"
177 ucidef_add_switch_vlan "switch0" "1" "0t 1 3 4 5"
178 ucidef_add_switch_vlan "switch0" "2" "0t 2"
182 ucidef_set_interfaces_lan_wan "eth1" "eth0"
183 ucidef_add_switch "switch0" "1" "1"
184 ucidef_add_switch_vlan "switch0" "1" "0 1 3"
189 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
190 ucidef_add_switch "switch0" "1" "1"
191 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
192 ucidef_add_switch_vlan "switch0" "2" "0t 1"
196 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
197 ucidef_add_switch "switch0" "1" "1"
198 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
199 ucidef_add_switch_vlan "switch0" "2" "0 5t"
203 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
204 ucidef_add_switch "switch0" "1" "1"
205 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 9t"
206 ucidef_add_switch_vlan "switch0" "2" "0 9t"
211 ucidef_set_interface_raw "eth" "eth0"
212 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
226 ucidef_set_interfaces_lan_wan "eth1" "eth0"
227 ucidef_add_switch "switch0" "1" "1"
228 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
232 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
233 ucidef_add_switch "switch0" "1" "1"
234 ucidef_add_switch_vlan "switch0" "1" "0t 1"
235 ucidef_add_switch_vlan "switch0" "2" "0t 2"
239 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
240 ucidef_add_switch "switch0" "1" "1"
241 ucidef_add_switch_vlan "switch0" "1" "0t 5"
242 ucidef_add_switch_vlan "switch0" "2" "0t 1"
246 ucidef_set_interfaces_lan_wan "eth0" "eth1"
247 ucidef_add_switch "switch0" "1" "1"
248 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 5"
252 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
253 ucidef_add_switch "switch0" "1" "1"
254 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
260 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
261 ucidef_add_switch "switch0" "1" "1"
262 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
263 ucidef_add_switch_vlan "switch0" "2" "0t 5"
264 mac=$(mtd_get_mac_ascii nvram "wan_mac")
265 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
270 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
271 ucidef_add_switch "switch0" "1" "1"
272 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
273 ucidef_add_switch_vlan "switch0" "2" "0t 5"
274 mac=$(mtd_get_mac_ascii devdata "wanmac")
275 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
282 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
283 ucidef_add_switch "switch0" "1" "1"
284 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
285 ucidef_add_switch_vlan "switch0" "2" "0t 5"
286 mac_lan=$(mtd_get_mac_binary caldata 0)
287 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr "lan" "$mac_lan"
288 mac_wan=$(mtd_get_mac_binary caldata 6)
289 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr "wan" "$mac_wan"
294 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
295 ucidef_add_switch "switch0" "1" "1"
296 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
297 ucidef_add_switch_vlan "switch0" "2" "0t 5"
298 mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
299 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
303 ucidef_set_interface_lan "eth0 eth1"
307 ucidef_set_interface_lan "eth0"
308 ucidef_add_switch "switch0" "1" "0"
309 ucidef_add_switch_vlan "switch0" "0" "0 2 3 4"
354 ucidef_set_interface_lan "eth0"
360 ucidef_set_interface_lan "eth1"
374 ucidef_set_interfaces_lan_wan "eth1" "eth0"
378 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
379 ucidef_add_switch "switch0" "1" "1"
380 ucidef_add_switch_vlan "switch0" "1" "0t 3"
381 ucidef_add_switch_vlan "switch0" "2" "0t 2"
385 ucidef_set_interfaces_lan_wan "eth0" "eth1"
389 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
390 ucidef_add_switch "switch0" "1" "1"
391 ucidef_add_switch_vlan "switch0" "1" "5 6t"
392 ucidef_add_switch_vlan "switch0" "2" "1 6t"
425 ucidef_set_interfaces_lan_wan "eth0" "eth1"
426 ucidef_add_switch "switch0" "1" "1"
427 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
431 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
432 ucidef_add_switch "switch0" "1" "1"
433 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
434 ucidef_add_switch_vlan "switch0" "2" "0t 1"
438 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
439 ucidef_add_switch "switch0" "1" "1"
440 ucidef_add_switch_vlan "switch0" "1" "0t 1 2"
441 ucidef_add_switch_vlan "switch0" "2" "0t 3"
445 ucidef_set_interfaces_lan_wan "eth0" "eth1"
446 ucidef_add_switch "switch0" "1" "1"
447 ucidef_add_switch_vlan "switch0" "1" "0 2 3"
451 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
452 ucidef_add_switch "switch0" "1" "1"
453 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
454 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
455 uci set network.@switch[-1].blinkrate='2'
457 ucidef_add_switch_port "switch0" "1"
458 # Port 1 controls the GREEN configuration of LEDs for
459 # the switch and the section does not correspond to a real
462 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
463 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
464 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
465 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
466 # 14: Link (master); 15: separate register
467 uci set network.@switch_port[-1].led='6'
469 ucidef_add_switch_port "switch0" "2"
470 # Port 2 controls the ORANGE configuration of LEDs for
471 # the switch and the section does not correspond to a real
474 # See the key above for switch port 1 for the meaning of the
475 # 'led' setting below.
476 uci set network.@switch_port[-1].led='9'
478 ucidef_add_switch_port "switch0" "5"
479 # Port 5 controls the configuration of the WAN LED and the
480 # section does not correspond to a real switch port.
482 # To toggle the use of green or orange LEDs for the WAN port,
483 # see the LED setting for wndr3700:green:wan in /etc/config/system.
485 # See the key above for switch port 1 for the meaning of the
486 # 'led' setting below.
487 uci set network.@switch_port[-1].led='2'
491 ucidef_set_interfaces_lan_wan "eth0" "eth1"