Using radvd

A while ago I promised to show how to use radvd, so here it goes.

radvd is a daemon that distributes an ipv6 prefix to all nodes on the same network. This is called stateless IP autoconfiguration. It serves the same purpose dhcp does for IPv4 networks, but it is more limited, and just serves the clients with prefixes and a default router. There is no way to assign a specific address to clients, for example from a pool of addresses or based on the MAC address. So, for more specific configurations, dhcpv6 can be used. Still, to quickly configure addresses and default router automatically it is very useful. Supposedly there is alo a way to set the DNS server, but I haven’t tested that yet.

It has to run on the default ipv6 router, and there should be only one node running it it the whole network. Installing it is so simple that it is almost scary. To install it on Debian, do:

# apt-get install radvd

The configuration file is /etc/radvd.conf. It looks like this:

interface ath0
{
        AdvSendAdvert on;
        prefix 2001:db8:0:0::/64
        {
                AdvOnLink on;
        };
};

Just replace the prefix with the prefix assigned to your network. Start it with

# /etc/init.d/radvd start

Now, look at the IP addresses of clients attached to the same network. There is absolutely no configuration necessary on the clients. They will, almost magically, have an IPv6 address composed out of the configured prefix and a part based on the MAC address:

# ifconfig ath0

ath0      Link encap:Ethernet  HWaddr 00:11:22:33:44:55
            inet6 addr: 2001:db8:0:0::0011:2233:4455/64 Scope:Global
            ...

The part after the prefix of the address is not exactly the MAC address, but it is derived from it. You can use the addresses for example to add them to a DNS server.

Also, the default route of the clients will point to the node running radvd.

This works for Mac OS and Linux clients. I do not know about Windows clients.

Advertisements

2 Comments

Filed under debian, ipv6

2 responses to “Using radvd

  1. I have tried radvd in a mixed environment. Linux boxen and some windows XP-SP2 box.
    The MS split stack is a little weird. they have publicly set themselves up as the IPv6 privacy advocates (how that jibes with the marketing and spyware industry they support is quite ironic.).
    In the efforst for that, the IPv6 side does a small dance over self-assigned IPA. Same as any other stack it allocates a HW address using the interface MAC, which if you are lucky you will catch occasionally on the link-local.
    After that it allocates a seemingly random other-HW address which it uses for all outbound requests, and changes every 90 seconds or so.
    Tracking is intentionally a bugger, and with it goes any hope for useful system or user controls (even QoS) based on the source.

  2. lookahead

    “there should be only one node running it it the whole network.”

    According to [1], this is incorrect. This is a rather old blog post, but it’s the first hit when searching for whether it is feasible to run multiple router advertisement daemons on the same network.

    From the post:

    “It’s OK to have multiple routers running radvd on the same LAN, even
    advertising different prefixes.”

    [1] http://lists.litech.org/pipermail/radvd-devel-l/2008-March/000332.html