aterenin wrote:
> Hi, I’m trying to move a setup that I had working in Ubuntu over to
> openSUSE. Basically, if I run the following in shell as root, it all
> works fine.
>
> wlanconfig ath0 destroy
> wlanconfig ath0 create wlandev wifi0 wlanmode ap
> iwconfig ath0 mode master
> iwconfig ath0 essid avtnetwork
> brctl addif br0 ath0
> ifconfig ath0 up
> /etc/init.d/hostapd /etc/hostapd/hostapd.conf
>
> Now, the problem’s that all of this needs to be done manually - it
> needs to run as root, thus, a startup shell script won’t work.
>
> Is there some other way to get this working?
You can sudo the shell script… or if you want this
at startup, create a startup script… probably to
be run AFTER the network startup script… those
scripts are housed in /etc/init.d. If you create
a properly formatted script (copy one) then you’ll
be able to enable it in YaST.
Works if I type it in terminal, but does not work if I run it as a script as root. The last two commands fail to execute. But that’s not currently the biggest problem:
If I run this, after 2-3 days, I get a kernel freeze. Where to go from here, I have no idea.
edit: Alternatively, I could avoid the whole script and just do all the config through YaST if the first two commands could be executed before all networking on startup.
Added “options ath_pci autocreate=ap” to /etc/modprobe.conf.local - this causes madwifi to start in AP mode, and eliminates the first two lines from the original script.
Set up the wireless via YaST, with no ip, started at boot, and no wireless encryption. This eliminates lines 3,4,6.
Added ‘ath0’ under BRIDGE-PORTS in /etc/sysconfig/network/ifcfg-br0. This could not be done via YaST without losing wireless config. This eliminates line 5.
Wrote a startup script for hostapd, with help from this guide.
The script:
#!/bin/sh
### BEGIN INIT INFO
# Provides: hostapd-init
# Required-Start: $network
# Required-Stop:
# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Description: Starts hostapd on startup
### END INIT INFO
test -f /usr/sbin/hostapd || exit 5
. /etc/rc.status
rc_reset
case "$1" in
start)
echo "Starting hostapd..."
startproc /usr/sbin/hostapd /etc/hostapd.conf
rc_status -v
;;
stop)
echo "Stopping hostapd..."
killall hostapd || echo "Hostapd was not started in the first place."
rc_status -v
;;
restart)
$0 stop
$0 start
rc_status
;;
status)
test -d /var/run/hostapd && echo "Hostapd running." || echo "Hostapd not running."
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
Put the script in /etc/init.d and enabled it in YaST runlevel services. This eliminates the need for the final line in the original script.