You are not logged in.

#1 2013-05-06 17:37:09

hotvic
Member
Registered: 2013-02-11
Posts: 109

[Solved] netctl profile + hostapd

I use hostapd for share my connection with other computers on my home, ok, I installed and configured and it's working perfect. (following wiki)

but I've a problem, is that I need manually set ip after boot up (ip addr addr ...), I want to do this using netctl profile, I've tried this:

/etc/netctl/victor_ap
-------------------------
Description='Victor Access Point configuration'
Interface=wlp0s3f3u3
Connection=ethernet
IP=static
Address=('192.168.0.1/24')
SkipNoCarrier=yes
#Routes=('192.168.0.0/24 via 192.168.1.2')
#Gateway='192.168.1.1'
#DNS=('192.168.1.1')

## For IPv6 autoconfiguration
#IP6=stateless

## For IPv6 static address configuration
IP6=static
Address6=('fdba:2aa0:165a:3a7c:1:1:1:1/128 nodad')
#Routes6=('abcd::1234')
#Gateway6='1234:0:123::abcd'

but it's not work because after hostapd start it's put the infarce UP, then netctl fail to start profile...

What I'm doing incorrect ?

Thanks in advance!

Last edited by hotvic (2013-05-11 13:27:09)

Offline

#2 2013-05-11 13:24:18

hotvic
Member
Registered: 2013-02-11
Posts: 109

Re: [Solved] netctl profile + hostapd

I got it big_smile

I did created a new connection type(called hostapd) and it's working now!

/usr/lib/network/connections/hostapd
----------------------------------------------
# Hostapd connection support for netctl

hostapd_up() {
    if ! is_interface "$Interface"; then
        report_error "Interface '$Interface' does not exist"
        return 1
    fi

    # Disable IPv6 before bringing the interface up to prevent SLAAC
    if [[ $IP6 == "no" ]]; then
        sysctl -q -w "net.ipv6.conf.${Interface/.//}.disable_ipv6=1"
    fi

    for addr in ${Address}; do
        if ! do_debug ip addr add $addr brd + dev $Interface; then
            return 1
        fi
    done
}

hostapd_down() {
    for addr in ${Address}; do
        if ! do_debug ip addr del $addr dev $Interface; then
            return 1
        fi
    done
}

# vim: ft=sh ts=4 et sw=4:
/etc/netctl/victor_ap
-------------------------
Description='Victor Access Point configuration'
Interface=wlp0s3f3u3
Connection=hostapd
IP=static
Address=('192.168.0.1/24')

## For IPv6 autoconfiguration
#IP6=stateless

## For IPv6 static address configuration
#IP6=static
#Address6=('fdba:2aa0:165a:3a7c:1:1:1:1/128 nodad')

Need some adjusts on 'hostapd' connection but it's working.

Last edited by hotvic (2013-05-11 13:26:49)

Offline

#3 2013-05-11 18:08:27

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 999

Re: [Solved] netctl profile + hostapd

FYI, this has already been solved in the past: https://bbs.archlinux.org/viewtopic.php?id=161816 .

I also don't understand what is the difference between your "hostapd" connection type and the usual ethernet/ip. If ethernet doesn't work it is not because hostapd starts ahead of netctl. Unless you messed with configuration, the order is netctl@<profile>.service -> network.target -> hostapd.service.

There is indeed some activity about implementing a proper hostapd support for netctl, but it involves actually starting hostapd from a netctl profile + setting interfaces, bridges, etc...


Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd

Offline

#4 2013-05-12 01:37:09

hotvic
Member
Registered: 2013-02-11
Posts: 109

Re: [Solved] netctl profile + hostapd

Leonid.I,

When I get some spare time I will read your message again and try something based on your answer... Tnx!

Offline

Board footer

Powered by FluxBB