011-mesh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/usr/bin/lua
  2. local sysconfig = require 'gluon.sysconfig'
  3. local sysctl = require 'gluon.sysctl'
  4. local uci = require('luci.model.uci').cursor()
  5. uci:delete('batman-adv', 'bat0')
  6. uci:section('batman-adv', 'mesh', 'bat0',
  7. {
  8. orig_interval = 5000,
  9. gw_mode = 'client',
  10. }
  11. )
  12. uci:save('batman-adv')
  13. uci:commit('batman-adv')
  14. uci:set('network', 'client', 'macaddr', sysconfig.primary_mac)
  15. uci:set('network', 'client', 'peerdns', 1)
  16. uci:delete('network', 'bat0')
  17. uci:section('network', 'interface', 'bat0',
  18. {
  19. ifname = 'bat0',
  20. proto = 'none',
  21. macaddr = sysconfig.primary_mac,
  22. }
  23. )
  24. uci:save('network')
  25. uci:commit('network')
  26. uci:delete('firewall', 'client')
  27. uci:section('firewall', 'zone', 'client',
  28. {
  29. name = 'client',
  30. network = {'client'},
  31. input = 'ACCEPT',
  32. output = 'ACCEPT',
  33. forward = 'REJECT',
  34. }
  35. )
  36. c:section('firewall', 'rule', 'client_dns',
  37. {
  38. name = 'client_dns',
  39. src = 'client',
  40. dest_port = '53',
  41. target = 'REJECT',
  42. }
  43. )
  44. uci:save('firewall')
  45. uci:commit('firewall')
  46. local dnsmasq = uci:get_first('dhcp', 'dnsmasq')
  47. uci:set('dhcp', dnsmasq, 'boguspriv', 0)
  48. uci:set('dhcp', dnsmasq, 'localise_queries', 0)
  49. uci:set('dhcp', dnsmasq, 'rebind_protection', 0)
  50. uci:delete('dhcp', 'client')
  51. uci:section('dhcp', 'dhcp', 'client',
  52. {
  53. interface = 'client',
  54. ignore = 1,
  55. }
  56. )
  57. uci:save('dhcp')
  58. uci:commit('dhcp')
  59. sysctl.set('net.ipv6.conf.br-client.forwarding', 0)