Advertisement
Guest User

Untitled

a guest
Jul 28th, 2015
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. wlan0
  2. inet addr:192.168.10.1
  3. Bcast:192.168.10.255
  4. Mask:255.255.255.0
  5.  
  6. eth0:
  7. inet addr:10.102.8.93
  8. Bcast:10.102.11.255
  9. Mask:255.255.252.0
  10.  
  11. Kernel IP routing table
  12. Destination Gateway Genmask Flags Metric Ref Use Iface
  13. 0.0.0.0 10.102.8.1 0.0.0.0 UG 0 0 0 eth0
  14. 10.102.8.0 0.0.0.0 255.255.252.0 U 0 0 0 eth0
  15. 192.168.10.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
  16.  
  17. EXTIF="eth0"
  18. INTIF="wlan0"
  19. echo " External Interface: $EXTIF"
  20. echo " Internal Interface: $INTIF"
  21.  
  22. echo " Enabling forwarding.."
  23. echo "1" > /proc/sys/net/ipv4/ip_forward
  24.  
  25. echo " Enabling DynamicAddr.."
  26. echo "1" > /proc/sys/net/ipv4/ip_dynaddr
  27.  
  28. echo " Clearing any existing rules and setting default policy.."
  29. $IPTABLES -P INPUT ACCEPT
  30. $IPTABLES -F INPUT
  31. $IPTABLES -P OUTPUT ACCEPT
  32. $IPTABLES -F OUTPUT
  33. $IPTABLES -P FORWARD DROP
  34. $IPTABLES -F FORWARD
  35. $IPTABLES -t nat -F
  36.  
  37. echo " FWD: Allow all connections OUT and only existing and related ones IN"
  38. $IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT
  39. $IPTABLES -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT
  40. #$IPTABLES -A FORWARD -j LOG
  41.  
  42. echo " Enabling SNAT (MASQUERADE) functionality on $EXTIF"
  43. $IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement