Advertisement
Guest User

Untitled

a guest
Aug 14th, 2014
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.12 KB | None | 0 0
  1. root@LiMeNode-ee01b4:/# cat /rom/etc/uci-defaults/02_network
  2. #!/bin/sh
  3. #
  4. # Copyright (C) 2011 OpenWrt.org
  5. #
  6.  
  7. [ -e /etc/config/network ] && exit 0
  8.  
  9. touch /etc/config/network
  10.  
  11. . /lib/functions/uci-defaults.sh
  12. . /lib/ar71xx.sh
  13.  
  14. ucidef_set_interface_loopback
  15.  
  16. board=$(ar71xx_board_name)
  17.  
  18. case "$board" in
  19. all0315n |\
  20. all0258n |\
  21. ja76pf2|\
  22. ubnt-unifi-outdoor)
  23. ucidef_set_interface_lan "eth0 eth1"
  24. ;;
  25.  
  26. ap132 |\
  27. wlr8100)
  28. ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
  29. ucidef_add_switch "switch0" "1" "1"
  30. ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
  31. ucidef_add_switch_vlan "switch0" "2" "0t 1"
  32. ;;
  33.  
  34. esr1750)
  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"
  39. ;;
  40.  
  41. ap136-010)
  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"
  46. ;;
  47.  
  48. ap136-020 |\
  49. ap135-020 |\
  50. tl-wr1043nd-v2)
  51. ucidef_set_interfaces_lan_wan "eth1" "eth0"
  52. ucidef_add_switch "switch0" "1" "1"
  53. ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
  54. ucidef_add_switch_vlan "switch0" "2" "5 6"
  55. ;;
  56.  
  57. archer-c5 |\
  58. archer-c7 |\
  59. tl-wdr4900-v2)
  60. ucidef_set_interfaces_lan_wan "eth1" "eth0"
  61. ucidef_add_switch "switch0" "1" "1"
  62. ucidef_add_switch_vlan "switch0" "1" "0 2 3 4 5"
  63. ucidef_add_switch_vlan "switch0" "2" "1 6"
  64. ;;
  65.  
  66. db120 |\
  67. rb-2011l | \
  68. rb-2011uas |\
  69. rb-2011uias |\
  70. rb-2011uas-2hnd)
  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"
  77.  
  78. case "$board" in
  79. rb-2011uas* | rb-2011uias)
  80. ucidef_set_interface_raw "sfp" "eth0.3"
  81. ucidef_add_switch_vlan "switch0" "3" "0t 6"
  82. ;;
  83. esac
  84. ;;
  85.  
  86. dir-825-b1|\
  87. tew-673gru)
  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"
  91. ;;
  92.  
  93. nbg460n_550n_550nh)
  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"
  97. ;;
  98.  
  99. nbg6716)
  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"
  104. ;;
  105.  
  106. rb-433 |\
  107. rb-433u)
  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"
  111. ;;
  112.  
  113. rb-435g)
  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"
  117. ;;
  118.  
  119. rb-450)
  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"
  123. ;;
  124.  
  125. rb-450g |\
  126. routerstation-pro)
  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"
  130. ;;
  131.  
  132. ap136 |\
  133. rb-750gl |\
  134. rb-751g |\
  135. rb-951g-2hnd |\
  136. wzr-hp-g450h)
  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"
  141. ;;
  142.  
  143. rb-951ui-2hnd)
  144. ucidef_set_interfaces_lan_wan "eth1" "eth0"
  145. ;;
  146.  
  147. rb-493g)
  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"
  154. ;;
  155.  
  156. wzr-hp-g300nh2 |\
  157. pb92 |\
  158. ap113)
  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"
  163. ;;
  164.  
  165. el-m150)
  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"
  169. ;;
  170.  
  171. el-mini)
  172. ucidef_set_interface_lan "eth0"
  173. ;;
  174.  
  175. tl-wdr4300|\
  176. tl-wr1041n-v2)
  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"
  181. ;;
  182.  
  183. tl-wr1043nd)
  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"
  188. ;;
  189.  
  190. tl-wr2543n)
  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"
  195. ;;
  196.  
  197. tl-wr841n-v1|\
  198. tl-wr941nd)
  199. ucidef_set_interface_raw "eth" "eth0"
  200. ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
  201. ;;
  202.  
  203. tl-mr3420-v2 |\
  204. tl-wr841n-v8 |\
  205. tl-wr842n-v2 |\
  206. wnr2000-v3 |\
  207. wnr2200 |\
  208. wnr612-v2)
  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"
  212. ;;
  213.  
  214. uap-pro)
  215. ucidef_set_interface_lan "eth0"
  216. ucidef_add_switch "switch0" "1" "1"
  217. ucidef_add_switch_vlan "switch0" "1" "0 1 2"
  218. ;;
  219.  
  220. nanostation-m-xw)
  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"
  225. ;;
  226.  
  227. wrt160nl)
  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"
  231. ;;
  232.  
  233. wzr-hp-g300nh)
  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"
  237. ;;
  238.  
  239. dir-825-c1)
  240. local mac
  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"
  247. ;;
  248.  
  249. mynet-n750)
  250. local 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"
  257. ;;
  258.  
  259. dir-835-a1 |\
  260. wndr3700v4 | \
  261. wndr4300)
  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"
  270. ;;
  271.  
  272. esr900)
  273. local mac
  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"
  280. ;;
  281.  
  282. all0305 |\
  283. aw-nr580 |\
  284. bullet-m |\
  285. cap4200ag |\
  286. eap300v2 |\
  287. eap7660d |\
  288. mr600 |\
  289. mr600v2 |\
  290. rb-411 |\
  291. rb-911g-2hpnd |\
  292. rb-911g-5hpnd |\
  293. rb-912uag-2hpnd |\
  294. rb-912uag-5hpnd |\
  295. rb-sxt2n |\
  296. rb-sxt5n |\
  297. tl-mr10u |\
  298. tl-mr11u |\
  299. tl-mr13u |\
  300. tl-mr3020 |\
  301. tl-mr3040 |\
  302. tl-mr3040-v2 |\
  303. tl-wa750re |\
  304. tl-wa850re |\
  305. tl-wa830re-v2 |\
  306. tl-wa801nd-v2 |\
  307. tl-wa901nd |\
  308. tl-wa901nd-v2 |\
  309. tl-wa901nd-v3 |\
  310. tl-wr703n |\
  311. tube2h |\
  312. wndap360 |\
  313. mynet-rext |\
  314. wp543)
  315. ucidef_set_interface_lan "eth0"
  316. ;;
  317.  
  318. dir-505-a1)
  319. ucidef_set_interface_lan "eth1"
  320. ;;
  321.  
  322. alfa-ap96 |\
  323. alfa-nx |\
  324. ap83 |\
  325. gl-inet |\
  326. jwap003 |\
  327. pb42 |\
  328. pb44 |\
  329. routerstation|\
  330. tl-wr710n |\
  331. tl-wr720n-v3|\
  332. wpe72)
  333. ucidef_set_interfaces_lan_wan "eth1" "eth0"
  334. ;;
  335.  
  336. ap121 |\
  337. ap121-mini |\
  338. ap96 |\
  339. airrouter |\
  340. dir-600-a1 |\
  341. dir-615-c1 |\
  342. dir-615-e1 |\
  343. dir-615-e4 |\
  344. hiwifi-hc6361 |\
  345. ja76pf |\
  346. mynet-n600 |\
  347. oolite |\
  348. rb-750 |\
  349. rb-751 |\
  350. tew-632brp |\
  351. tew-712br |\
  352. tl-mr3220 |\
  353. tl-mr3220-v2 |\
  354. tl-mr3420 |\
  355. tl-wdr3500 |\
  356. tl-wr741nd |\
  357. tl-wr741nd-v4 |\
  358. tl-wr841n-v7 |\
  359. tl-wr841n-v9 |\
  360. whr-g301n |\
  361. whr-hp-g300n |\
  362. whr-hp-gn |\
  363. wzr-hp-ag300h)
  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"
  367. ;;
  368.  
  369. wzr-hp-g450h)
  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"
  374. ;;
  375.  
  376. ew-dorin)
  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"
  381. ;;
  382.  
  383. ew-dorin-router)
  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"
  387. ;;
  388.  
  389. wndr3700)
  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'
  395.  
  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
  399. # switch port.
  400. #
  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'
  407.  
  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
  411. # switch port.
  412. #
  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'
  416.  
  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.
  420. #
  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.
  423. #
  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'
  427. ;;
  428.  
  429. *)
  430. ucidef_set_interfaces_lan_wan "eth0" "eth1"
  431. ;;
  432. esac
  433.  
  434. uci commit network
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement