PDA

View Full Version : autoconnect on startup



HaVaNa7
01-04-2009, 02:36 PM
hi to all.
i've set up rc.inet1 file in this way:


#! /bin/sh
# /etc/rc.d/rc.inet1
# This script is used to bring up the various network interfaces.
#
# Modified for SLAX by Tomas M.
#
iwconfig wlan0 rate auto
iwconfig wlan0 ap 00:19:5B:BF:2C:E1
iwconfig wlan0 mode managed channel 6 essid dlink
ifconfig wlan0 192.168.0.10 netmask 255.255.255.0 broadcast 192.168.0.255
iwconfig wlan0 key 0123-4567-89
route add default gw 192.168.0.2
echo "nameserver 212.216.112.112" >> /etc/resolv.conf
echo "nameserver 212.216.172.162" >> /etc/resolv.conf

if [ "$1" = "start" -o "$1" = "" ]; then

ifconfig lo down 2>/dev/null
/sbin/ifconfig lo 127.0.0.1 2>/dev/null
/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo 2>/dev/null

# here is how to setup winfi device easily.
# First type 'iwconfig' command to see which devices are WIFI-enabled
# In this example, eth0 is our wifi device:
#
# mac address of your access point
#iwconfig wlan0 ap 00:19:5B:BF:2C:E1

# channel value. You may skip this one, but some drives require this
#iwconfig wlan0 channel 6

# security key for WEP, if you are using it
#iwconfig wlan0 key 0123456789

# your network name
#iwconfig wlan0 essid dlink
#ifconfig wlan0 192.168.0.10 netmask 255.255.255.0
#route add default gw 192.168.0.2 wlan0
# now enable the device so dhcpcd can see it in the next step
#ifconfig wlan0 up
#
# end of wifi sample configuration

for eth in `ls /sys/class/net | grep -v sit`; do
# check if dhcpcd is not already running for $eth interface,
# in that case it was started by hotplug? so don't start it again

if [ "$eth" != "lo" -a ! -e /etc/dhcpc/dhcpcd-$eth.pid ]; then
echo "Auto Configure IP address for $eth: /sbin/dhcpcd -t 60 $eth &"
/sbin/dhcpcd -t 60 $eth &
fi

done

fi

but it's not working even if when i type iwconfig and ifconfig all is correctly setted.
any idea?