AJR
05-04-2009, 11:30 AM
With grateful thanks once again to elgeneral for this script by Kameleon74
Translation by Google
DualMode -**** LAN + WLAN
lan_script.sh
#! /bin/sh
export LD_LIBRARY_PATH=/MMP/lib:/MMP/usr/lib
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/MMP/bin:/MMP/sbin:/MMP/usr/bin:/MMP/usr
/sbin
[ -z "$ACTION" ] && echo "Error: should be called from lan_steup" && exit 1
RESOLV_CONF="/etc/resolv.conf"
IF_0="eth0"
IF_1="ra0"
################################# #####################
### start
################################# #####################
if [ "$ACTION" = "init" ]; then
echo "NET_SCRIPT**** load wireless driver rt61!!!"
killall -9 udh***
insmod /MMP/modules/2.6.15/rt61.ko
ifconfig $IF_0 up
ifconfig $IF_1 up
fi
################################# #####################
### start
################################# #####################
if [ "$ACTION" = "start" ]; then
### MODE: 0=cable
if [ "$MODE" = "0" ]; then
echo "NET_SCRIPT**** ethernet cable setting..."
ifconfig $IF_0 0.0.0.0 &
sleep 1
[ ! -z "`/bin/pidof ifconfig`" ] && /usr/bin/killall -9 ifconfig
ifconfig $IF_1 down
ifconfig $IF_0 up
### IP_DHCP_MODE: 0=dhcp
if [ "$IP_DHCP_MODE" = "0" ]; then
echo "NET_SCRIPT**** ethernet dhcp mode!!!"
fi
### IP_DHCP_MODE: 1=static
if [ "$IP_DHCP_MODE" = "1" ]; then
ifconfig $IF_0 $IP_ADDR netmask $IP_SUBNET_MASK &
sleep 2
if [ ! -z "`/bin/pidof ifconfig`" ] ; then
/usr/bin/killall -9 ifconfig
ifconfig $IF_0 $IP_ADDR netmask $IP_SUBNET_MASK &
sleep 2
fi
if [ -n "$IP_GATEWAY" ] ; then
while route del default gw 0.0.0.0 dev $IF_0 ; do
:
done
for i in $IP_GATEWAY ; do
route add default gw $i dev $IF_0
done
fi
echo -n > $RESOLV_CONF
[ -n "$HOST_DOMAIN" ] && echo search $HOST_DOMAIN **** $RESOLV_CONF
[ -n "$DNS_IP_ADDR1" ] && echo nameserver $DNS_IP_ADDR1 **** $RESOLV_CONF
[ -n "$DNS_IP_ADDR2" ] && echo nameserver $DNS_IP_ADDR2 **** $RESOLV_CONF
fi
echo "NET_SCRIPT**** ethernet cable OK!!!"
fi
### MODE: 1=wireless
if [ "$MODE" = "1" ]; then
echo "NET_SCRIPT**** wireless setting..."
insmod /MMP/modules/2.6.15/rt61.ko
ifconfig $IF_0 0.0.0.0 &
sleep 1
[ ! -z "`/bin/pidof ifconfig`" ] && /usr/bin/killall -9 ifconfig
ifconfig $IF_1 up
iwconfig $IF_1 mode Managed
[ -n "$HOSTNAME" ] && iwconfig $IF_1 nick $HOSTNAME
iwconfig $IF_1 channel auto
iwconfig $IF_1 rate auto
iwpriv $IF_1 set NetworkType=Infra
if [ "$WLAN_ENCYPTION" != "0" ] && [ -n "$WLAN_KEY" ]; then
iwpriv $IF_1 set AuthMode=WPA2PSK
iwpriv $IF_1 set EncrypType=TKIP
iwpriv $IF_1 set WPAPSK="$WLAN_KEY"
else
iwpriv $IF_1 set AuthMode=OPEN
iwpriv $IF_1 set EncrypType=NONE
fi
iwpriv $IF_1 set SSID="$WLAN_ESSID"
iwgetid -m $IF_1
iwgetid -a $IF_1
iwgetid -c $IF_1
iwgetid -f $IF_1
iwgetid -p $IF_1
iwgetid -r $IF_1
### IP_DHCP_MODE: 0=dhcp
if [ "$IP_DHCP_MODE" = "0" ]; then
echo "NET_SCRIPT**** wireless dhcp mode!!!"
fi
### IP_DHCP_MODE: 1=static
if [ "$IP_DHCP_MODE" = "1" ]; then
ifconfig $IF_1 $IP_ADDR netmask $IP_SUBNET_MASK &
sleep 2
if [ ! -z "`/bin/pidof ifconfig`" ] ; then
/usr/bin/killall -9 ifconfig
ifconfig $IF_1 $IP_ADDR netmask $IP_SUBNET_MASK &
sleep 2
fi
if [ -n "$IP_GATEWAY" ] ; then
while route del default gw 0.0.0.0 dev $IF_1 ; do
:
done
for i in $IP_GATEWAY ; do
route add default gw $i dev $IF_1
done
fi
echo -n > $RESOLV_CONF
[ -n "$HOST_DOMAIN" ] && echo search $HOST_DOMAIN **** $RESOLV_CONF
[ -n "$DNS_IP_ADDR1" ] && echo nameserver $DNS_IP_ADDR1 **** $RESOLV_CONF
[ -n "$DNS_IP_ADDR2" ] && echo nameserver $DNS_IP_ADDR2 **** $RESOLV_CONF
fi
echo "NET_SCRIPT**** wireless OK!!!"
echo "NET_SCRIPT**** ethernet cable setting..."
ifconfig $IF_0 0.0.0.0 &
sleep 1
[ ! -z "`/bin/pidof ifconfig`" ] && /usr/bin/killall -9 ifconfig
ifconfig $IF_0 up
ifconfig $IF_0 192.168.2.3 netmask 255.255.255.0 &
sleep 2
if [ ! -z "`/bin/pidof ifconfig`" ] ; then
/usr/bin/killall -9 ifconfig
ifconfig $IF_1 192.168.2.3 netmask 255.255.255.0 &
sleep 2
fi
echo "NET_SCRIPT**** ethernet cable OK!!!"
fi
fi
################################# #####################
### alive
################################# #####################
if [ "$ACTION" = "alive" ]; then
rdate -s time.bora.net &
fi
################################# #####################
exit 0
via telnet:
mount-o remount, rw-t ext3 / dev/hda1 / SMP ...... ********** See corrected line in next post
and at the end via FTP script created above to / MMP / usr / bin (replace existing lan_script.sh - for safety initially back up original script)
Azbox restart.
And when network settings, normally set up for wifi with WEP 128bit.
Azbox Settings -> Wireless
(WPA or WPA2) in red script editing worth
for EPA WPAPSK
for WPA2 WPA2PSK
IP for LAN party. In this case is 192.168.2.3
by Kameleon74
Translation by Google
DualMode -**** LAN + WLAN
lan_script.sh
#! /bin/sh
export LD_LIBRARY_PATH=/MMP/lib:/MMP/usr/lib
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/MMP/bin:/MMP/sbin:/MMP/usr/bin:/MMP/usr
/sbin
[ -z "$ACTION" ] && echo "Error: should be called from lan_steup" && exit 1
RESOLV_CONF="/etc/resolv.conf"
IF_0="eth0"
IF_1="ra0"
################################# #####################
### start
################################# #####################
if [ "$ACTION" = "init" ]; then
echo "NET_SCRIPT**** load wireless driver rt61!!!"
killall -9 udh***
insmod /MMP/modules/2.6.15/rt61.ko
ifconfig $IF_0 up
ifconfig $IF_1 up
fi
################################# #####################
### start
################################# #####################
if [ "$ACTION" = "start" ]; then
### MODE: 0=cable
if [ "$MODE" = "0" ]; then
echo "NET_SCRIPT**** ethernet cable setting..."
ifconfig $IF_0 0.0.0.0 &
sleep 1
[ ! -z "`/bin/pidof ifconfig`" ] && /usr/bin/killall -9 ifconfig
ifconfig $IF_1 down
ifconfig $IF_0 up
### IP_DHCP_MODE: 0=dhcp
if [ "$IP_DHCP_MODE" = "0" ]; then
echo "NET_SCRIPT**** ethernet dhcp mode!!!"
fi
### IP_DHCP_MODE: 1=static
if [ "$IP_DHCP_MODE" = "1" ]; then
ifconfig $IF_0 $IP_ADDR netmask $IP_SUBNET_MASK &
sleep 2
if [ ! -z "`/bin/pidof ifconfig`" ] ; then
/usr/bin/killall -9 ifconfig
ifconfig $IF_0 $IP_ADDR netmask $IP_SUBNET_MASK &
sleep 2
fi
if [ -n "$IP_GATEWAY" ] ; then
while route del default gw 0.0.0.0 dev $IF_0 ; do
:
done
for i in $IP_GATEWAY ; do
route add default gw $i dev $IF_0
done
fi
echo -n > $RESOLV_CONF
[ -n "$HOST_DOMAIN" ] && echo search $HOST_DOMAIN **** $RESOLV_CONF
[ -n "$DNS_IP_ADDR1" ] && echo nameserver $DNS_IP_ADDR1 **** $RESOLV_CONF
[ -n "$DNS_IP_ADDR2" ] && echo nameserver $DNS_IP_ADDR2 **** $RESOLV_CONF
fi
echo "NET_SCRIPT**** ethernet cable OK!!!"
fi
### MODE: 1=wireless
if [ "$MODE" = "1" ]; then
echo "NET_SCRIPT**** wireless setting..."
insmod /MMP/modules/2.6.15/rt61.ko
ifconfig $IF_0 0.0.0.0 &
sleep 1
[ ! -z "`/bin/pidof ifconfig`" ] && /usr/bin/killall -9 ifconfig
ifconfig $IF_1 up
iwconfig $IF_1 mode Managed
[ -n "$HOSTNAME" ] && iwconfig $IF_1 nick $HOSTNAME
iwconfig $IF_1 channel auto
iwconfig $IF_1 rate auto
iwpriv $IF_1 set NetworkType=Infra
if [ "$WLAN_ENCYPTION" != "0" ] && [ -n "$WLAN_KEY" ]; then
iwpriv $IF_1 set AuthMode=WPA2PSK
iwpriv $IF_1 set EncrypType=TKIP
iwpriv $IF_1 set WPAPSK="$WLAN_KEY"
else
iwpriv $IF_1 set AuthMode=OPEN
iwpriv $IF_1 set EncrypType=NONE
fi
iwpriv $IF_1 set SSID="$WLAN_ESSID"
iwgetid -m $IF_1
iwgetid -a $IF_1
iwgetid -c $IF_1
iwgetid -f $IF_1
iwgetid -p $IF_1
iwgetid -r $IF_1
### IP_DHCP_MODE: 0=dhcp
if [ "$IP_DHCP_MODE" = "0" ]; then
echo "NET_SCRIPT**** wireless dhcp mode!!!"
fi
### IP_DHCP_MODE: 1=static
if [ "$IP_DHCP_MODE" = "1" ]; then
ifconfig $IF_1 $IP_ADDR netmask $IP_SUBNET_MASK &
sleep 2
if [ ! -z "`/bin/pidof ifconfig`" ] ; then
/usr/bin/killall -9 ifconfig
ifconfig $IF_1 $IP_ADDR netmask $IP_SUBNET_MASK &
sleep 2
fi
if [ -n "$IP_GATEWAY" ] ; then
while route del default gw 0.0.0.0 dev $IF_1 ; do
:
done
for i in $IP_GATEWAY ; do
route add default gw $i dev $IF_1
done
fi
echo -n > $RESOLV_CONF
[ -n "$HOST_DOMAIN" ] && echo search $HOST_DOMAIN **** $RESOLV_CONF
[ -n "$DNS_IP_ADDR1" ] && echo nameserver $DNS_IP_ADDR1 **** $RESOLV_CONF
[ -n "$DNS_IP_ADDR2" ] && echo nameserver $DNS_IP_ADDR2 **** $RESOLV_CONF
fi
echo "NET_SCRIPT**** wireless OK!!!"
echo "NET_SCRIPT**** ethernet cable setting..."
ifconfig $IF_0 0.0.0.0 &
sleep 1
[ ! -z "`/bin/pidof ifconfig`" ] && /usr/bin/killall -9 ifconfig
ifconfig $IF_0 up
ifconfig $IF_0 192.168.2.3 netmask 255.255.255.0 &
sleep 2
if [ ! -z "`/bin/pidof ifconfig`" ] ; then
/usr/bin/killall -9 ifconfig
ifconfig $IF_1 192.168.2.3 netmask 255.255.255.0 &
sleep 2
fi
echo "NET_SCRIPT**** ethernet cable OK!!!"
fi
fi
################################# #####################
### alive
################################# #####################
if [ "$ACTION" = "alive" ]; then
rdate -s time.bora.net &
fi
################################# #####################
exit 0
via telnet:
mount-o remount, rw-t ext3 / dev/hda1 / SMP ...... ********** See corrected line in next post
and at the end via FTP script created above to / MMP / usr / bin (replace existing lan_script.sh - for safety initially back up original script)
Azbox restart.
And when network settings, normally set up for wifi with WEP 128bit.
Azbox Settings -> Wireless
(WPA or WPA2) in red script editing worth
for EPA WPAPSK
for WPA2 WPA2PSK
IP for LAN party. In this case is 192.168.2.3
by Kameleon74