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"
210 ucidef_set_interfaces_lan_wan "eth1" "eth0"
211 ucidef_add_switch "switch0" "1" "1"
212 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
216 ucidef_set_interface_lan "eth0"
217 ucidef_add_switch "switch0" "1" "1"
218 ucidef_add_switch_vlan "switch0" "1" "0 1 2"
222 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
223 ucidef_add_switch "switch0" "1" "1"
224 ucidef_add_switch_vlan "switch0" "1" "0t 5"
225 ucidef_add_switch_vlan "switch0" "2" "0t 1"
229 ucidef_set_interfaces_lan_wan "eth0" "eth1"
230 ucidef_add_switch "switch0" "1" "1"
231 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 5"
235 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
236 ucidef_add_switch "switch0" "1" "1"
237 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
242 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
243 ucidef_add_switch "switch0" "1" "1"
244 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
245 ucidef_add_switch_vlan "switch0" "2" "0t 5"
246 mac=$(mtd_get_mac_ascii nvram "wan_mac")
247 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
252 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
253 ucidef_add_switch "switch0" "1" "1"
254 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
255 ucidef_add_switch_vlan "switch0" "2" "0t 5"
256 mac=$(mtd_get_mac_ascii devdata "wanmac")
257 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
263 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
264 ucidef_add_switch "switch0" "1" "1"
265 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
266 ucidef_add_switch_vlan "switch0" "2" "0t 5"
267 mac_lan=$(mtd_get_mac_binary caldata 0)
268 [ -n "$mac_lan" ] && ucidef_set_interface_macaddr "lan" "$mac_lan"
269 mac_wan=$(mtd_get_mac_binary caldata 6)
270 [ -n "$mac_wan" ] && ucidef_set_interface_macaddr "wan" "$mac_wan"
275 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
276 ucidef_add_switch "switch0" "1" "1"
277 ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
278 ucidef_add_switch_vlan "switch0" "2" "0t 5"
279 mac=$(mtd_get_mac_ascii u-boot-env "wanaddr")
280 [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
317 ucidef_set_interface_lan "eth0"
321 ucidef_set_interface_lan "eth1"
335 ucidef_set_interfaces_lan_wan "eth1" "eth0"
366 ucidef_set_interfaces_lan_wan "eth0" "eth1"
367 ucidef_add_switch "switch0" "1" "1"
368 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
372 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
373 ucidef_add_switch "switch0" "1" "1"
374 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
375 ucidef_add_switch_vlan "switch0" "2" "0t 1"
379 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
380 ucidef_add_switch "switch0" "1" "1"
381 ucidef_add_switch_vlan "switch0" "1" "0t 1 2"
382 ucidef_add_switch_vlan "switch0" "2" "0t 3"
386 ucidef_set_interfaces_lan_wan "eth0" "eth1"
387 ucidef_add_switch "switch0" "1" "1"
388 ucidef_add_switch_vlan "switch0" "1" "0 2 3"
392 ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
393 ucidef_add_switch "switch0" "1" "1"
394 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
395 # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
396 uci set network.@switch[-1].blinkrate='2'
398 ucidef_add_switch_port "switch0" "1"
399 # Port 1 controls the GREEN configuration of LEDs for
400 # the switch and the section does not correspond to a real
403 # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
404 # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
405 # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
406 # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
407 # 14: Link (master); 15: separate register
408 uci set network.@switch_port[-1].led='6'
410 ucidef_add_switch_port "switch0" "2"
411 # Port 2 controls the ORANGE configuration of LEDs for
412 # the switch and the section does not correspond to a real
415 # See the key above for switch port 1 for the meaning of the
416 # 'led' setting below.
417 uci set network.@switch_port[-1].led='9'
419 ucidef_add_switch_port "switch0" "5"
420 # Port 5 controls the configuration of the WAN LED and the
421 # section does not correspond to a real switch port.
423 # To toggle the use of green or orange LEDs for the WAN port,
424 # see the LED setting for wndr3700:green:wan in /etc/config/system.
426 # See the key above for switch port 1 for the meaning of the
427 # 'led' setting below.
428 uci set network.@switch_port[-1].led='2'
432 ucidef_set_interfaces_lan_wan "eth0" "eth1"