daily pastebin goal
66%
SHARE
TWEET

network config bash file

a guest Jun 1st, 2012 23 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. #
  3. # internet connection sharing wlan0 is the gate way
  4. # eth0 is the lan port this might use a straight ethernet cable to a router wan port or a switch or a single PC
  5. # 192.168.2.2 is the port that is being used by the lan for access I changed it to 192.168.2.254 and set fixed addresses for the wan and router
  6. #
  7. # change wlan0 to ppp0 and you can use this for mobile broadband connection sharing
  8. #
  9. ip link set dev eth1 up
  10. ip addr add 10.42.0.1/24 dev eth1
  11. sysctl net.ipv4.ip_forward=1
  12. iptables -t nat -A POSTROUTING -o ppp0 -s 10.42.0.0/24 -j MASQUERADE
  13. iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 3074 -j DNAT --to-destination 10.42.0.2
  14. iptables -t nat -A PREROUTING -i ppp0 -p udp -m multiport --dports 88,3074 -j DNAT --to-destination 10.42.0.2
  15. iptables -A FORWARD -i ppp0 -d 10.42.0.2 -p tcp --dport 3074 -j ACCEPT
  16. iptables -A FORWARD -i ppp0 -d 10.42.0.2 -p udp -m multiport --dports 88,3074 -j ACCEPT
RAW Paste Data
Pastebin PRO WINTER Special!
Get 40% OFF Pastebin PRO accounts!
Top