Advertisement
Guest User

Untitled

a guest
Jun 30th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. #!/bin/bash -
  2.  
  3. cd `dirname $0`
  4.  
  5. source net-vars
  6. source util
  7.  
  8. ifconfig $BR_IFACE 2>/dev/null 1>/dev/null
  9. if [ $? == 0 ]; then
  10. echo "$BR_IFACE seems already configured. Skipping bridge/TAP configuration."
  11. exit
  12. fi
  13.  
  14. require_root
  15.  
  16. # Create bridge interface
  17. ip link add name $BR_IFACE type bridge
  18. ip addr add "$BR_NETWORK" dev $BR_IFACE
  19. ip link set $BR_IFACE up
  20. dnsmasq --interface=$BR_IFACE \
  21. --bind-interfaces \
  22. --dhcp-range=$BR_DHCP_RANGE \
  23. --pid-file="`pwd`/$DNSMASQ_PIDFILE"
  24.  
  25. modprobe tun
  26. chmod 0666 /dev/net/tun
  27.  
  28. # Create TAP interfaces
  29. for i in ${TAP_IFACES[@]}; do
  30. ip tuntap add dev $i mode tap user $TAP_USER
  31. ip link set $i up promisc on
  32. done
  33. ip link set ${TAP_IFACES[0]} master $BR_IFACE
  34.  
  35. # Allow packet forwarding
  36. sysctl net.ipv4.ip_forward=1
  37. sysctl net.ipv6.conf.default.forwarding=1
  38. sysctl net.ipv6.conf.all.forwarding=1
  39.  
  40. # Forward packets from TAP interfaces to the Wi-Fi interface
  41. set_iptables_rules -A
  42.  
  43. # vim ts=2 sts=2 sw=2 et
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement