SHARE
TWEET

share-internet.sh

a guest Jul 30th, 2012 17 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. # desc   share your internet access to another v.2
  3. # author root@abimayu.com
  4. # site   www.abimayu.com
  5. #
  6. # another computer use this range 172.16.1.2 - 172.16.1.254
  7. # to run, running this command
  8. # sudo bash share-internet.sh
  9.  
  10. # set interface
  11. sudo ifconfig eth1 down
  12. sudo iwconfig eth1 channel 4
  13. sudo iwconfig eth1 mode ad-hoc
  14. sleep 1;
  15. sudo ifconfig wlan0 172.16.1.1/24 up
  16.  
  17. # set as gateway to internet
  18. sleep 0.5;
  19. sudo echo 1 > /proc/sys/net/ipv4/ip_forward
  20. sudo iptables -F
  21. sudo iptables -t nat -F
  22. sudo iptables -t nat -A POSTROUTING -s 172.16.1.0/24 -j MASQUERADE
  23. sudo iptables -A FORWARD -s 172.16.1.0/24 -j ACCEPT
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top