Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash -
- cd `dirname $0`
- source net-vars
- source util
- ifconfig $BR_IFACE 2>/dev/null 1>/dev/null
- if [ $? == 0 ]; then
- echo "$BR_IFACE seems already configured. Skipping bridge/TAP configuration."
- exit
- fi
- require_root
- # Create bridge interface
- ip link add name $BR_IFACE type bridge
- ip addr add "$BR_NETWORK" dev $BR_IFACE
- ip link set $BR_IFACE up
- dnsmasq --interface=$BR_IFACE \
- --bind-interfaces \
- --dhcp-range=$BR_DHCP_RANGE \
- --pid-file="`pwd`/$DNSMASQ_PIDFILE"
- modprobe tun
- chmod 0666 /dev/net/tun
- # Create TAP interfaces
- for i in ${TAP_IFACES[@]}; do
- ip tuntap add dev $i mode tap user $TAP_USER
- ip link set $i up promisc on
- done
- ip link set ${TAP_IFACES[0]} master $BR_IFACE
- # Allow packet forwarding
- sysctl net.ipv4.ip_forward=1
- sysctl net.ipv6.conf.default.forwarding=1
- sysctl net.ipv6.conf.all.forwarding=1
- # Forward packets from TAP interfaces to the Wi-Fi interface
- set_iptables_rules -A
- # vim ts=2 sts=2 sw=2 et
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement