[Babel-users] Questions on the "new" AHCP

Gabriel Kerneis kerneis at pps.jussieu.fr
Fri Jan 15 07:18:40 UTC 2010


On Thu, Jan 14, 2010 at 07:20:00PM +0100, ZioPRoTo (Saverio Proto) wrote:
> 1) AHCP is a stand alone program, so does not depend on olsr or babel,
> so its configuration is autonomous, correct ?

Yes.

> In openwrt I expect to configure everything in /etc/conf/ahcp

The relevant files are (currently):
/etc/config/ahcpd               (basic client configuration)
/etc/init.d/ahcpd               (more complex things, including server)
/usr/lib/ahcp/ahcp-config.sh    (could move in a near future - the
                                 default is /etc/ahcp/ahcp-config.sh but
                                 this has been changed in OpenWrt for no
                                 good reason)

> 2) is node_id necessary ?

This has nothing to do with ahcpd.

> 3) If I use AHCP to configure ONLY IPv6, then everything is stateless
> as in the old AHCP and I don't have to make a difference between
> server instances and client instances ?

Yes, you have to: a client does not know the network prefix, so you need
at least one server.  You could have as many servers as you like:
- IPv6: provided they all advertise the same prefix,
- IPv4: provided they advertise mutually exclusive ranges of addresses.

> 4) Il possible to use AHCP only IPv6 + OLSR IPv6 ?

Of course.  Ahcp is agnostic w.r.t. the routing protocol.  All it does
(by default) is configuring your addresses (and NTP, DNS, ...).

> 5) How do I tell the mesh node what is the IPv6 prefix of the network
> in /etc/config/ahcp ?

Currently, you cannot.  I implemented it a while ago but unfortunately
forgot to commit it and lost the changes.  I will send a patch to the
OpenWrt mailing-list in the next few days.

Meanwhile, you can edit /etc/init.d/ahcpd as follow (/!\ not tested):

========================================================================
#!/bin/sh /etc/rc.common

START=71

pidfile=/var/run/ahcpd.pid

ahcpd_config() {
	local cfg="$1"
	config_get interfaces "$cfg" interfaces
    config_get server "$cfg" server
	config_get_bool no_config "$cfg" no_config 0
	config_get_bool ipv4_only "$cfg" ipv4_only 0
	config_get_bool ipv6_only "$cfg" ipv6_only 0
	config_get_bool no_dns "$cfg" no_dns 0
}

start() {
	config_load ahcpd
	config_foreach ahcpd_config ahcpd
	mkdir -p /var/lib
	if [ "$no_config" -eq 0 ]; then
		unset no_config
	fi
	if [ "$ipv4_only" -eq 0 ]; then
		unset ipv4_only
	fi
	if [ "$ipv6_only" -eq 0 ]; then
		unset ipv6_only
	fi
	if [ "$no_dns" -eq 0 ]; then
		unset no_dns
	fi
	if [ -e $pidfile ] ; then
		echo "$pidfile exists -- not starting ahcpd." >&2
	elsif [ "x$server" -eq "x" ] ; then
		/usr/sbin/ahcpd -s /usr/lib/ahcp/ahcp-config.sh -D -I $pidfile \
		${ipv4_only:+-4} ${ipv6_only:+-6} ${no_dns:+-N} ${no_config:+-n} \
		$interfaces
	else
		/usr/sbin/ahcpd -s /usr/lib/ahcp/ahcp-config.sh -D -I $pidfile \
		-S $server $interfaces
	fi
}

stop() {
	[ -e $pidfile ] && kill $(cat $pidfile)
	[ -e $pidfile ] && sleep 2
	[ -e $pidfile ] && sleep 4
	[ -e $pidfile ] && echo "Failed to stop ahcpd ($pidfile still exists)."
}
========================================================================

Then, in /etc/config/ahcpd, use:
========================================================================
config ahcpd
	option interfaces "wl0"
	option server "ipv6,first,last,dir,name-server,ntp-server"
========================================================================
(See http://www.pps.jussieu.fr/~jch/software/ahcp/ahcpd.html option -S)

This will turn your access-point into an ahcpd server.

Regards,
-- 
Gabriel Kerneis



More information about the Babel-users mailing list