(Added wget operation to download patch)
(Configuration)
 
(18 intermediate revisions by one user not shown)
Line 1: Line 1:
  
== Flex: the fast lexical analyser ==
+
== WideDHCP - A DHCPv6 Client ==
  
Flex is a dependency for Wide-DHCPv6.  
+
Before an ISP will route your allocated IPv6 subnet, a lease needs to be acquired. This can be done using DHCPv6 over the PPP interface.
 +
 
 +
[[Cross_Compiling_ISC_dhcp_for_ARM| ISC-DHCP]] currently has no support for the PPP interface.
 +
 
 +
=== Flex: the fast lexical analyser ===
 +
 
 +
Flex is a dependency for Wide-DHCPv6. It requires the [https://www.gnu.org/software/m4/m4.html GNU M4] macro processor & texi2dvi installed on your build system:
 +
 
 +
<PRE>
 +
sudo apt-get install m4
 +
sudo apt-get install texinfo
 +
sudo apt-get install texlive
 +
</PRE>
  
 
Download flex and cross compile for ARM assuming your ARM cross compiler is located at /opt/arm-2011.09/  
 
Download flex and cross compile for ARM assuming your ARM cross compiler is located at /opt/arm-2011.09/  
  
 
<PRE>
 
<PRE>
http://downloads.sourceforge.net/project/flex/flex-2.5.37.tar.bz2
+
wget http://sourceforge.net/projects/flex/files/flex-2.5.39.tar.bz2
tar -xjf flex-2.5.37.tar.bz2
+
tar -xjf flex-2.5.39.tar.bz2
cd flex-2.5.37/
+
cd flex-2.5.39/
./configure --host=arm-none-linux-gnueabi --prefix=/opt/arm-2011.09/arm-none-linux-gnueabi
+
./configure --host=arm-linux-gnueabi --prefix=/usr/arm-linux-gnueabi ac_cv_func_malloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes
 
make
 
make
 
make install
 
make install
 
</PRE>
 
</PRE>
  
== Cross Compiling Wide DHCPv6 for ARM ==
+
Now copy libfl.so.2.0.0 to your target and update the dynamic linker run-time bindings with ldconfig:
 +
 
 +
<PRE>
 +
cp /usr/arm-linux-gnueabi/lib/libfl.so.2.0.0 /home/export/rootfs/lib
 +
</PRE>
 +
 
 +
=== Cross Compiling Wide DHCPv6 for ARM ===
  
 
Wide-DHCPv6 has not been updated for some time and uses structures no longer avaliable in [http://sourceforge.net/tracker/index.php?func=detail&aid=2487489&group_id=153668&atid=788687 glibc without the use of the #define _GNU_SOURCE]
 
Wide-DHCPv6 has not been updated for some time and uses structures no longer avaliable in [http://sourceforge.net/tracker/index.php?func=detail&aid=2487489&group_id=153668&atid=788687 glibc without the use of the #define _GNU_SOURCE]
Line 27: Line 45:
 
cd wide-dhcpv6-20080615/
 
cd wide-dhcpv6-20080615/
 
patch -p1 < ../0004-GNU-libc6-fixes.patch  
 
patch -p1 < ../0004-GNU-libc6-fixes.patch  
./configure --prefix=/home/temp/wide-dhcp --host=arm-none-linux-gnueabi --with-localdbdir=/tmp ac_cv_func_setpgrp_void=yes
+
./configure --prefix=/home/export/rootfs --host=arm-linux-gnueabi --sysconfdir=/etc --with-localdbdir=/var/db ac_cv_func_setpgrp_void=yes ac_cv_lib_fl_yywrap=yes
 
make
 
make
 +
make install INSTALL="install --strip-program=arm-linux-gnueabi-strip"
 +
</PRE>
 +
 +
Many of the makefiles are set up to strip the symbol tables using a X86 version of install -s and throws an error. We pass install the arm-linux-gnueabi-strip executable and where install has not been called without -s (strip), install is likely to display a WARNING: ignoring --strip-program option as -s option was not specified.
 +
 +
=== Configuration ===
 +
 +
Below is a sample /etc/dhcp6c.conf file:
 +
 +
<PRE>
 +
interface ppp0 {
 +
    send ia-pd 0;
 +
    script "/etc/wide-dhcpv6/dhcp6c-script";
 +
};
 +
 +
id-assoc pd {
 +
    prefix-interface eth0 {
 +
            sla-id 0;
 +
            sla-len 8;
 +
    };
 +
};
 +
</PRE>
 +
 +
dhcp6c can be started using:
 +
 +
<PRE>
 +
dhcp6c ppp0
 +
</PRE>
 +
 +
Check your /var/log/messages for any errors. Alternatively to debug, run:
 +
 +
<PRE>
 +
dhcp6c -dDf ppp0
 +
</PRE>
 +
 +
If you get the following error:
 +
 +
<PRE>
 +
get_duid: failed to open DUID file for save
 +
</PRE>
 +
 +
Check a directory exists for the dhcp6c_duid file. With the above configuration, it should be stored in /var/db - check the db subdirectory exists and create it if required.
 +
 +
Please note that once IPv6 forwarding is enabled, linux will ignore subsequent DHCPv6 messages. This prevents your prefix lease being renewed and routing will stop. To prevent this, you need to allow unsolicited UDP traffic coming in on port 546.
 +
 +
This can be achieved using the following ip6tables entry:
 +
 +
<PRE>
 +
/sbin/ip6tables -A INPUT -m state --state NEW -m udp -p udp --dport 546 --sport 547 -s fe80::/10 -d fe80::/10 -j ACCEPT
 
</PRE>
 
</PRE>

Latest revision as of 10:53, 12 July 2014

WideDHCP - A DHCPv6 Client

Before an ISP will route your allocated IPv6 subnet, a lease needs to be acquired. This can be done using DHCPv6 over the PPP interface.

ISC-DHCP currently has no support for the PPP interface.

Flex: the fast lexical analyser

Flex is a dependency for Wide-DHCPv6. It requires the GNU M4 macro processor & texi2dvi installed on your build system:

sudo apt-get install m4
sudo apt-get install texinfo
sudo apt-get install texlive

Download flex and cross compile for ARM assuming your ARM cross compiler is located at /opt/arm-2011.09/

wget http://sourceforge.net/projects/flex/files/flex-2.5.39.tar.bz2
tar -xjf flex-2.5.39.tar.bz2
cd flex-2.5.39/
./configure --host=arm-linux-gnueabi --prefix=/usr/arm-linux-gnueabi ac_cv_func_malloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes
make
make install

Now copy libfl.so.2.0.0 to your target and update the dynamic linker run-time bindings with ldconfig:

cp /usr/arm-linux-gnueabi/lib/libfl.so.2.0.0 /home/export/rootfs/lib

Cross Compiling Wide DHCPv6 for ARM

Wide-DHCPv6 has not been updated for some time and uses structures no longer avaliable in glibc without the use of the #define _GNU_SOURCE

Instead, we patch it with a patch developed by Jeremie Corbier

wget http://downloads.sourceforge.net/project/wide-dhcpv6/wide-dhcpv6/wide-dhcpv6-20080615/wide-dhcpv6-20080615.tar.gz
wget http://wiki.beyondlogic.org/patches/wide-dhcpv6/0004-GNU-libc6-fixes.patch
tar -xzf wide-dhcpv6-20080615.tar.gz 
cd wide-dhcpv6-20080615/
patch -p1 < ../0004-GNU-libc6-fixes.patch 
./configure --prefix=/home/export/rootfs --host=arm-linux-gnueabi --sysconfdir=/etc --with-localdbdir=/var/db ac_cv_func_setpgrp_void=yes ac_cv_lib_fl_yywrap=yes
make
make install INSTALL="install --strip-program=arm-linux-gnueabi-strip"

Many of the makefiles are set up to strip the symbol tables using a X86 version of install -s and throws an error. We pass install the arm-linux-gnueabi-strip executable and where install has not been called without -s (strip), install is likely to display a WARNING: ignoring --strip-program option as -s option was not specified.

Configuration

Below is a sample /etc/dhcp6c.conf file:

interface ppp0 {
    send ia-pd 0;
    script "/etc/wide-dhcpv6/dhcp6c-script";
};

id-assoc pd {
    prefix-interface eth0 {
            sla-id 0;
            sla-len 8;
    };
};

dhcp6c can be started using:

dhcp6c ppp0

Check your /var/log/messages for any errors. Alternatively to debug, run:

dhcp6c -dDf ppp0

If you get the following error:

get_duid: failed to open DUID file for save

Check a directory exists for the dhcp6c_duid file. With the above configuration, it should be stored in /var/db - check the db subdirectory exists and create it if required.

Please note that once IPv6 forwarding is enabled, linux will ignore subsequent DHCPv6 messages. This prevents your prefix lease being renewed and routing will stop. To prevent this, you need to allow unsolicited UDP traffic coming in on port 546.

This can be achieved using the following ip6tables entry:

/sbin/ip6tables -A INPUT -m state --state NEW -m udp -p udp --dport 546 --sport 547 -s fe80::/10 -d fe80::/10 -j ACCEPT