Pages

Sunday, 17 April 2011

DD-WRT and wide-dhcp6-server

Hi all, it's been a little while since my last DD-WRT related post, but this will help anyone trying to fit all these extra features on a space budget.

Previously, I built ISC DHCP to get DHCPv6 onto my DD-WRT router. This is all well and good, but the required files to make it run are a little on the large side, considering the small amount of flash available on consumer routers. Wide is a whole 250k, making it much more suitable. It's also a lot simpler to compile.

As I mentioned before, my Netgear died, and I now have a Buffalo, therefore the --host section from here on will be different from my previous posts. So, lets get started by downloading and extracting the source:

# wget http://downloads.sourceforge.net/project/wide-dhcpv6/wide-dhcpv6/wide-dhcpv6-20080615/wide-dhcpv6-20080615.tar.gz
# tar xzvf dhcpv6-20080615.tar.gz
# cd dhcpv6-20080615

First thing we need to do is add this line to a new file called config.cache, to sort out things the configure script cannot for itself:

ac_cv_func_setpgrp_void=yes

From here, it's pretty much a simple configure and make, then copy the binary to the router:

# ./configure --prefix=/opt --host=mips-linux-uclibc --cache-file=config.cache LDFLAGS="-L -L/opt/lib -static" --with-localdbdir=/tmp
# make

That's that! If all went well, you should have a dhcp6s binary to copy to your router. Configuring it to serve just dns details is a single line config file, mine is /opt/etc/dhcp6s.conf. Simply replace with your IPv6 DNS servers.

option domain-name-servers 2001:db8::1;

To start the server, it's just a quick

# dhcp6s -c /opt/etc/dhcp6s.conf br0

Which you can also add to your startup script. That's it, you should now have a smaller working DHCPv6 server dishing out IPv6 DNS servers!

14 comments:

  1. These instructions do not work for me. I get an undefined reference to yywrap. if I add the -lfl ld flag the toolchain ld cannot find -lfl. Either failure means game over. I am about to give up after 3 days of playing with this.

    Posting your binary could prove useful.

    ReplyDelete
  2. Hi Nick, it looks like I neglected to add instructions for compiling flex, which appears to be a prerequisite to building this package. In all seriousness I already had it built and probably totally forgot about it.

    I'll check through my other posts now, If there aren't instructions to do it I'll make some. I'll also look at uploading some binaries. Please note that I am building binaries for the WZR-HP-G300NH and may work on others but I cannot guarantee that.

    ReplyDelete
  3. Wow, actually didn't think I would get a response.

    I looked on my compilation system and flex is indeed installed. If I use the regular gcc compiler installed on the system (and remove all configure parameters) all is well and i get 443B dhcp6s binary; obviously built with the wrong compiler. If I pre-pend my PATH variable with the path to the toolchain bin directory and specify --host during the configure procedure; that is when I get compile errors.

    ReplyDelete
  4. Hi Nick, sorry for the delayed response. Whilst you may have flex installed on your system it's specific to the hardware you're using, so you'd need to cross-compile that for DD-WRT too. I've checked my other posts, and it seems I've left out instructions. I'll get them sorted out when I have a free moment.

    ReplyDelete
  5. Any chance you a building a mipsel binary and you can post that to the web?

    A DHCPv6 server is the last item on my todo list and I've been bashing my head against the wall trying to figure out how to do it for DD-WRT...

    ReplyDelete
  6. I'll post them all when I get chance. Anyone that wants a binary post me the output of `uname -a` so I know which toolchain to use. Also you guys will be testing them, as I have no means to do so!

    ReplyDelete
  7. I have no problem being a beta (or even alpha) tester.

    I'm currently using a vintage version of dd-wrt r13064, which is a pity as I'd love stateful firewall rules, but it runs the most stable on my router.

    # uname -a
    Linux gw 2.4.35 #3396 Mon Nov 2 13:46:15 CET 2009 mips unknown

    ReplyDelete
  8. Don't suppose you've had a chance to do this by any chance?

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. Sorry mate, not really had much of a chance. Thanks for stopping by again to remind me, though.

    I have had chance to sit down and look at it briefly tonight, I've got as far as building flex (which required config.cache hacks), but it's on the way, passed the -lfl problems.

    I'm now having ifaddrs.h related problems, but I'm going to have to call it a night.

    If you're interested in continuing to try yourself, the flex config.cache file needs these two lines:

    ac_cv_func_malloc_0_nonnull=yes
    ac_cv_func_realloc_0_nonnull=yes

    then use --cache-file=config.cache when you ./configure.

    ReplyDelete
  11. I also have issues with if ifaddrs.h. If I use the one from ./missing I get as far as ./missing/getifaddrs.c

    This looks to be due to "checking for getifaddrs... no" during ./configure. So something is missing which causes ./missing/getifaddrs.c to be used.

    If you get yywrap issues you might want to try adding the following line %option noyywrap to cftoken.l See https://dev.openwrt.org/browser/packages/ipv6/wide-dhcpv6

    ReplyDelete
  12. Hi RomMon,

    Thanks for the info. Unfortunately the different toolchains can give different results, and it's likely this page is also slightly out of date now anyway!

    I got around yywrap by compiling and linking in flex too, but that option seems more suitable for an embedded system.

    ReplyDelete
  13. How do you choose the best choose the best product among the ones listed here?
    https://buywirelessrouternow.com/best-rangefinder/

    ReplyDelete
  14. For that purpose, we ask that you don't send confidential info 바카라사이트 similar to Social Security, credit card, or account numbers to us via an unsecured e-mail. The Problem Gambling Network of Ohio strives to generate awareness, promote training, and be an advocate for quality remedy of problem gamblers within the state of Ohio. There is not any sector-specific EU laws within the area of playing providers.

    ReplyDelete