原文:http://bash.cyberciti.biz/misc-shell/dlink-pcl-wireless-lan-card-script/
以下是该shell脚本的源代码:
#!/bin/sh
# Script to start DLink PCL wireless lan card 520
# ----------------------------------------------------------------
# Copyright (c) 2006 nixCraft <http://cyberciti.biz/fb/>
# This script is licensed under GNU GPL version 2.0 or above
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
# Visit http://bash.cyberciti.biz/ for more information.
# See url for more info:
# http://www.cyberciti.biz/tips/linux-install-and-configure-dlink-dwl-g-520-wireless-lan-pci-card.html
# -------------------------------------------------------------------------
# assing values
# use 'iwlist ra0 scanning' command to get values
SSID=nixcraft
TYPE=Managed
CHANNEL=6
KEY="your-key"
INET=ra0
IWC="/sbin/iwconfig"
# ok config ra0
$IWC $INET essid $SSID
$IWC $INET mode $TYPE
$IWC $INET channel $CHANNEL
$IWC $INET key $KEY
# firewall
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
modprobe ip_conntrack
modprobe ip_conntrack_ftp
# Setting default filter policy
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
# Unlimited access to loop back
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
# Allow UDP, DNS and Passive FTP
iptables -A INPUT -i $INET -m state --state ESTABLISHED,RELATED -j ACCEPT
#allow bittorent incomming client request :)
iptables -A INPUT -p tcp --destination-port 6881:6882 -j ACCEPT
#Uncomment below to allow sshd incoming client request
#iptables -A INPUT -p tcp --destination-port 22 -j ACCEPT
# DROP everything and Log it
iptables -A INPUT -j LOG
iptables -A INPUT -j DROP |