OpenWrt sur un Asus WL 500g Deluxe

Cette page regroupe diverses informations glanées auprès de différentes sources. Quand les sites web sources sont connus ils sont cités. Cette page me sert d’aide mémoire, elle peut donc contenir des erreurs, voir même de honteux copier-coller d’autres sites.

Matériel

  • Processeur: Broadcom 5365 @ 200MHz
  • Flash: 4Mo
  • RAM: 32Mo
  • 2 * port USB v.2.0

Source: OpenWrt Table Of Hardware

Champs NVRAM

Général

NVRAM SettingMeaning
wl0_ifnameSet by wlconf to the name of the ethernet interface (eth1, eth2)
wl0_hwaddrSet by wlconf, use il0macaddr to change the mac
wl0_modeEither ap, sta or wet for Access Point mode, station mode or wireless ethernet bridge
wl0_ap_isolate(0/1) 0: allow clients to see each other 1: hide clients from each other
wl0_infraSelect operation mode for sta and wet (0=ad-hoc, 1=infrastructure)
wl0_closed(0/1) 0: broadcast ssid 1: hide ssid
wl0_country_codeAU = Worldwide, TH = Thailand, IL = Israel, JO = Jordan, CN = China, JP = Japan, US = USA/Canada/New Zealand, DE = Europe, All = All channels
wl0_macmode(disabled/allow/deny) used to (allow/deny) mac addresses listed in wl0_maclist
wl0_maclistList of space separated mac addresses to allow/deny according to wl0_macmode. Addresses should be entered with colons, e.g.: 00:02:2D:08:E2:1D
wl0_radioEnable / disable the radio (1=enable)
wl0_channelThe channel to use (default 6, 0=auto channel)
wl0_gmodeSet 54g modes (0=Legacy B, 1=auto, 2=G only, 3=B deferred, 4=performance, 5=LRS, 6=afterburner). Note: It may be necessary to use Legacy mode if you want older wireless devices to associate with a WRT access point. If wl0_gmode is not set, the wireless adapter will operate as if it were set to 0.
wl0_gmode_protectionFor situations where not all wifi stations hear each other
wl0_ratesetall
wl0_plcphdrpreamble. long: use long or short preamble, *: use short preamble
wl0_rateSet rate in 500 Kbps units (0=auto)
wl0_txpwrSet transmit power in miliwatts
wl0_fragSet fragmentation threshold (default 2346)
wl0_rtsSet RTS threshold (256-2347 default 2347)
wl0_dtimSet DTIM period (default 1)
wl0_bcnSet beacon period (default 100)
wl0_frameburst(on/off) enable/disable frameburst
wl0_antdivSelect antenna (-1=auto, 0=main[near power jack], 1=aux[near reset button], 3=diversity) Starting with WRT54G v2.0 and WRT54GS V1.1 these are reversed 0=[near reset button] and 1=[near power jack]
wl0_txantSee wl -h
wl0_ssidSet the SSID of the Wrt54g
wl0_distance(per Whiterussian RC5) Adjusts timing for signal propagation time. Unit: [m] (one-way). Setting this variable overrules setting of shortslot/longslot timing. Setting this variable is only needed over distances greater than appr. 1.5 km. The need usually shows when communication throughput is very low although the ratio of signal strength to noise is good.
wl0_wdstimeoutif set, it will enable the WDS watchdog (e. g. wl0_wdstimeout=180, value is in seconds)

WEP

NVRAM SettingMeaning
wl0_wepenabled/disabled
wl0_key1 ... wl0_key4WEP keys (example: wl0_key1=DEADBEEF12)
wl0_keyprimary key index: the wl0_key[1234] used (values: 1,2,3,4)
wl0_auth1 (shared key) / 0 (open); the ‘shared key’ option is the most vulnerable WEP option as it most facilitates an intruder due to a fundamental security flaw in WEP. The ‘open’ setting will allow association but will make it an intruder more difficult to find the encryption key, needed for traffic.

WPA

NVRAM SettingMeaning
wl0_auth_modeobsolete, use wl0_akm NOTE: set to psk or radius because some configurations don’t work without it. See http://www.bingner.com/openwrt/wpa.html, http://wiki.openwrt.org/OpenWrtDocs/Wpa2Enterprise or maybe you can use some other wpa supplicant instead of nas
wl0_akmopen,wpa,psk,wpa2,psk2
wl0_wpa_pskWPA pre-shared key
wl0_wpa_gtk_rekeyWPA GTK rekey interval
wl0_radius_ipaddr
wl0_radius_key
wl0_radius_portDefault value: 1812

Configuration réseau

Nom et rôle des interfaces

Nom Rôle
br0 LAN
eth0 LAN
vlan0 LAN
vlan1 WAN
eth1 WIFI

Configuration de l'interface WAN (br0)

nvram set wan_ifname=vlan1
nvram set lan_ifname=br0
nvram set wan_proto=static
nvram set wan_ipaddr=192.168.0.1
nvram set wan_netmask=255.255.255.0
nvram set wan_gateway=192.168.0.254
nvram set wan_dns="208.67.222.222 208.67.220.220"

nvram commit

Configuration WPA + AES

nvram set wl0_ssid='Prout'
nvram set wl0_channel=3
nvram set wl0_infra=1
nvram set wl0_closed=1
nvram set wl0_akm=psk2
nvram set wl0_crypto=aes
nvram set wl0_mode=ap 
nvram set wl0_wpa_psk='XXXXXXXXXXXX'
nvram commit

Sources:

Configuration logicielle

Configuration de l'heure au démarrage

Créer le fichier /etc/init.d/S55ntpclient

#!/bin/sh
  
# kill any existing ntpclient processes
# (they can get stuck if no route to target host)
/usr/bin/killall ntpclient
        
# do time sync
/usr/sbin/ntpclient -l -h 77.234.200.98 -s 
chmod +x /etc/init.d/S55ntpclient

Stockage sur clef usb

ipkg install kmod-usb-core
ipkg install kmod-usb2
ipkg install kmod-usb-storage
ipkg install kmod-usb-uhci 
ipkg install kmod-ext2
reboot

Pour monter la clef usb sur /opt à chaque démarrage, éditer le fichier /etc/init.d/S11mount:

#!/bin/sh
# Which device needs to be mounted?
MOUNT_DEVICE0=/dev/scsi/host0/bus0/target0/lun0/part1

i=0
# Wait 15 secs, mount when ready, and continue if it dosnt get ready within 15 secs.
while [ $i -le 15 ]
do

if [ -e $MOUNT_DEVICE0 ]
then
mount $MOUNT_DEVICE0 /opt/
echo "Success: $MOUNT_DEVICE0"
exit 0
fi

sleep 1
i=`expr $i + 1`
done 
chmod +x /etc/init.d/S11mount

Source:

Installation des paquets dans /opt avec ipkg

Editer /etc/ipkg.conf:

src whiterussian-nbd http://downloads.openwrt.org/people/nbd/whiterussian/packages
src non-free http://downloads.openwrt.org/whiterussian/packages/non-free
dest root /
dest opt /opt
dest ram /tmp 
ipkg -d opt install < package-name >

Changement du path pour ajouter /opt

Editer /etc/profiles pour ajouter:

export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/opt/bin:/opt/sbin:/opt/usr/bin:/opt/usr/sbin
export LD_LIBRARY_PATH=/lib:/usr/lib:/opt/usr/lib:/opt/lib

Script pour lancer au démarrage des programmes dans /opt/etc/init.d

vi /etc/init.d/S98optfiles
#!/bin/sh

i=0
while [ $i -le 30 ]
do
if [ -d /opt/etc/init.d ]
then
for i in /opt/etc/init.d/S*; do
$i start 2>&1
done | logger -s -p 6 -t '' &
break
fi

sleep 1
i=`expr $i + 1`
done
chmod +x /etc/init.d/S98optfiles

Source:

Installation de screen

ipkg -d opt install screen
ln -s /opt/usr/share/terminfo/ /usr/share/terminfo

Installation de irssi

ipkg -d opt install glib1
ipkg -d opt install irssi

Verifier l'ip d'une interface et refaire la configuration si besoin

#!/bin/sh
#set -xv
WAN_IFACE=vlan1
LAN_IFACE=br0
WAN_PROTO=static
WAN_IP="192.168.0.1"
WAN_NETMASK="255.255.255.0"
WAN_GATEWAY="192.168.0.254"
WAN_DNS="208.67.222.222 208.67.220.220"
IFCONFIG_REGEXP="inet addr:"
SUCCES=0

ip=$(/sbin/ifconfig $WAN_IFACE | grep "$IFCONFIG_REGEXP" | cut -d ':' -f2 | cut -d ' ' -f1)
if [ $? -ne $SUCCES ]
then
        exit 1
fi

if [ $ip = $WAN_IP ]
then
        exit 0
fi

nvram set wan_ifname=$WAN_IFACE
nvram set lan_ifname=$LAN_IFACE
nvram set wan_proto=$WAN_PROTO
nvram set wan_ipaddr=$WAN_IP
nvram set wan_netmask=$WAN_NETMASK
nvram set wan_gateway=$WAN_GATEWAY
nvram set wan_dns=$WAN_DNS

nvram commit
reboot

exit 0

Utilisation de cron

Les scripts à lancer sont sur la clef usb dans /opt/etc/crontabs/

cd /opt/etc/
mkdir crontabs
cd crontabs
mkdir cron.daily
mkdir cron.halfhourly
mkdir cron.hourly
mkdir cron.monthly
mkdir cron.weekly

Création d’un script runparts.sh dans /opt/usr/bin

#!/bin/sh
if [ -z "$1" ]
then
echo "Usage : $0 "
fi

RUNDIR=$1"/*"

for i in $RUNDIR ;do

# Ignore dangling symlinks (if any).
[ ! -f "$i" ] && continue

case "$i" in
*.sh)
# Source shell script for speed.
(
trap - INT QUIT TSTP
set start
. $i
)
;;
*)
# No sh extension, so fork subprocess.
#$i start
;;
esac
done
chmod +x /usr/bin/runparts.sh

Création du script /etc/crontabs/root:

# Syntax for lines is : minute hour day month dayofweek command #
#*/5 * * * * /opt/usr/bin/runparts.sh /opt/etc/crontabs/cron.5mins
*/30 * * * * /opt/usr/bin/runparts.sh /opt/etc/crontabs/cron.halfhourly
* */1 * * *  /opt/usr/bin/runparts.sh /opt/etc/crontabs/cron.hourly
02 4 * * *  /opt/usr/bin/runparts.sh /opt/etc/crontabs/cron.daily
22 4 * * 0  /opt/usr/bin/runparts.sh /opt/etc/crontabs/cron.weekly
42 4 1 * *  /opt/usr/bin/runparts.sh /opt/etc/crontabs/cron.monthly 

Source:

Repos ipkg intéressant

 
linux/openwrt/asus_wl-500g_deluxe.txt · Dernière modification: 2007/07/26 22:13 par phil
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki