Shell Script to start DLink PCL wireless lan card 520 / 510

by on April 10, 2008 · 0 comments

  1. #!/bin/sh
  2. # Script to start DLink PCL wireless lan card 520
  3. # ----------------------------------------------------------------
  4. # Copyright (c) 2006 nixCraft <http://cyberciti.biz/fb/>
  5. # This script is licensed under GNU GPL version 2.0 or above
  6. # -------------------------------------------------------------------------
  7. # This script is part of nixCraft shell script collection (NSSC)
  8. # Visit http://bash.cyberciti.biz/ for more information.
  9. # See url for more info:
  10. # http://www.cyberciti.biz/tips/linux-install-and-configure-dlink-dwl-g-520-wireless-lan-pci-card.html
  11. # -------------------------------------------------------------------------
  12.  
  13. # assing values
  14. # use 'iwlist ra0 scanning' command to get values
  15. SSID=nixcraft
  16. TYPE=Managed
  17. CHANNEL=6
  18. KEY="your-key"
  19. INET=ra0
  20. IWC="/sbin/iwconfig"
  21.  
  22. # ok config ra0
  23. $IWC $INET essid $SSID
  24. $IWC $INET mode $TYPE
  25. $IWC $INET channel $CHANNEL
  26. $IWC $INET key $KEY
  27.  
  28. # firewall
  29. iptables -F
  30. iptables -X
  31. iptables -t nat -F
  32. iptables -t nat -X
  33. iptables -t mangle -F
  34. iptables -t mangle -X
  35. modprobe ip_conntrack
  36. modprobe ip_conntrack_ftp
  37.  
  38. # Setting default filter policy
  39. iptables -P INPUT DROP
  40. iptables -P OUTPUT ACCEPT
  41.  
  42. # Unlimited access to loop back
  43. iptables -A INPUT -i lo -j ACCEPT
  44. iptables -A OUTPUT -o lo -j ACCEPT
  45.  
  46. # Allow UDP, DNS and Passive FTP
  47. iptables -A INPUT -i $INET -m state --state ESTABLISHED,RELATED -j ACCEPT
  48.  
  49. #allow bittorent incomming client request :)
  50. iptables -A INPUT -p tcp --destination-port 6881:6882 -j ACCEPT
  51.  
  52. #Uncomment below to allow sshd incoming client request
  53. #iptables -A INPUT -p tcp --destination-port 22 -j ACCEPT
  54.  
  55. # DROP everything and Log it
  56. iptables -A INPUT -j LOG
  57. iptables -A INPUT -j DROP


4000+ howtos and counting! If you enjoyed this article, join 45000+ others and get free email updates!

Click here to subscribe via email.

Previous Script:

Next Script: