110-network 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. igmp_snooping = 0,
  10. peerdns = 0,
  11. auto = 1,
  12. }
  13. )
  14. if not uci:get('network', 'wan', 'proto') then
  15. uci:set('network', 'wan', 'proto', 'dhcp')
  16. end
  17. uci:section('network', 'interface', 'wan6',
  18. {
  19. ifname = 'br-wan',
  20. peerdns = 0,
  21. ip6table = 1,
  22. sourcefilter = 0,
  23. }
  24. )
  25. if not uci:get('network', 'wan6', 'proto') then
  26. uci:set('network', 'wan6', 'proto', 'dhcpv6')
  27. end
  28. uci:section('network', 'rule6', 'wan6_lookup',
  29. {
  30. mark = '0x01/0x01',
  31. lookup = 1,
  32. }
  33. )
  34. uci:section('network', 'route6', 'wan6_unreachable',
  35. {
  36. type = 'unreachable',
  37. interface = 'loopback',
  38. target = '::/0',
  39. gateway = '::',
  40. table = 1,
  41. metric = 65535,
  42. }
  43. )
  44. uci:save('network')
  45. sysctl.set('net.ipv6.conf.all.accept_ra', 0)
  46. sysctl.set('net.ipv6.conf.default.accept_ra', 0)