[Prism54-users] Init script for bridging of wlan by ^hulk-19
david
david@hulk.gulmu.com
Thu, 6 Nov 2003 21:56:37 +0100
#Begin
#!/bin/sh
#Config section:
MODE="master"
ESSID="Habitacion WIFI"
CHANNEL=6
IPADDR="192.168.0.2"
GW="192.168.0.1"
NET="192.168.0.0"
IF1="eth0"
IF2="eth1"
#Some binaries definition:
GREP="/bin/grep"
LSMOD="/sbin/lsmod"
RMMOD="/sbin/rmmod"
IWCONFIG="/usr/local/sbin/iwconfig"
IFCONFIG="/sbin/ifconfig"
BRCTL="/usr/sbin/brctl"
IP="/sbin/ip"
ROUTE="/sbin/route"
MODPROBE="/sbin/modprobe"
case "$1" in
start)
if ! ( $LSMOD | $GREP prism54 ); then
$MODPROBE prism54
$IWCONFIG $IF2 essid "$ESSID"
$IWCONFIG $IF2 mode $MODE
$IWCONFIG $IF2 channel $CHANNEL
$IFCONFIG $IF1 0.0.0.0 up
$IFCONFIG $IF2 0.0.0.0 up
$BRCTL addbr br0
$BRCTL addif br0 $IF1
$BRCTL addif br0 $IF2
$BRCTL stp br0 off
$IFCONFIG br0 $IPADDR
#I removed this line because my system auto add the route for this net
#$IP route add $NET/24 dev br0
$ROUTE add default gw $GW
else
echo "module prism54 already loaded"
fi
;;
stop)
$IFCONFIG br0 down
$IFCONFIG $IF1 down
$IFCONFIG $IF2 down
$BRCTL delif br0 $IF1
$BRCTL delif br0 $IF2
$BRCTL delbr br0
$IFCONFIG $IF1 $IPADDR up
$ROUTE add default gw $GW
$RMMOD prism54
;;
esac
exit
#END
After I run /etc/init.d/WIFI start:
iwconfig
lo no wireless extensions.
eth0 no wireless extensions.
eth1 PRISM Duette ESSID:"Habitacion WIFI"
Mode:Master Frequency:2.437GHz Access Point: 00:04:E2:64:9A:3C
Bit Rate:54Mb/s
RTS thr:2347 B Fragment thr:2346 B
Link Quality:16 Signal level:0 Noise level:240
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
br0 no wireless extensions.
ifconfig
br0 Link encap:Ethernet HWaddr 00:01:29:42:4A:19
inet addr:192.168.0.2 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:126 (126.0 b)
eth0 Link encap:Ethernet HWaddr 00:01:29:42:4A:19
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4080 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:5862 dropped:0 overruns:0 carrier:11706
collisions:0 txqueuelen:1000
RX bytes:446025 (435.5 Kb) TX bytes:0 (0.0 b)
Interrupt:5 Base address:0xe000
eth1 Link encap:Ethernet HWaddr 00:04:E2:64:9A:3C
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:5
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:20075 errors:0 dropped:0 overruns:0 frame:0
TX packets:20075 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1671563 (1.5 Mb) TX bytes:1671563 (1.5 Mb)
brctl show
bridge name bridge id STP enabled interfaces
br0 8000.000129424a19 no eth0
eth1
PD: if anyone runs it, send me a beer! :)_