110-network 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/usr/bin/lua
  2. local uci = require('luci.model.uci').cursor()
  3. local sysctl = require 'gluon.sysctl'
  4. local sysconfig = require 'gluon.sysconfig'
  5. uci:section('network', 'interface', 'wan',
  6. {
  7. ifname = sysconfig.wan_ifname,
  8. type = 'bridge',
  9. peerdns = 0,
  10. auto = 1,
  11. }
  12. )
  13. if not uci:get('network', 'wan', 'proto') then
  14. uci:set('network', 'wan', 'proto', 'dhcp')
  15. end
  16. uci:section('network', 'interface', 'wan6',
  17. {
  18. ifname = 'br-wan',
  19. peerdns = 0,
  20. ip6table = 1,
  21. }
  22. )
  23. if not uci:get('network', 'wan6', 'proto') then
  24. uci:set('network', 'wan6', 'proto', 'dhcpv6')
  25. end
  26. uci:section('network', 'rule6', 'wan6_lookup',
  27. {
  28. mark = '0x01/0x01',
  29. lookup = 1,
  30. }
  31. )
  32. uci:section('network', 'route6', 'wan6_unreachable',
  33. {
  34. type = 'unreachable',
  35. interface = 'loopback',
  36. target = '::/0',
  37. gateway = '::',
  38. table = 1,
  39. metric = 65535,
  40. }
  41. )
  42. uci:save('network')
  43. uci:commit('network')
  44. sysctl.set('net.ipv6.conf.all.accept_ra', 0)
  45. sysctl.set('net.ipv6.conf.default.accept_ra', 0)