Voxel R7800/Voxel replay captured packets or simulate DHCPv6 client

  • ATTENTION! As of November 1, 2020, you are not able to reply to threads 6 months after the thread is opened if there are more than 500 posts in the thread.
    Threads will not be locked, so posts may still be edited by their authors.
    Just start a new thread on the topic to post if you get an error message when trying to reply to a thread.

HELLO_wORLD

Very Senior Member
Hi,

I do have an ISP that is giving me static IPv4 and IPv6 addresses, however, the infrastructure requires DHCP to allow my IP, and the lease is 5 minutes because of the setup of the DHCP relay between my ISP and me...

Basic NG configuration was giving me frequents micro cuts.

I was able to easily overcome this for IPv4 by assigning static IP, and using Entware udhcpc with the -T option in a cron job to keep the DHCP relay happy, but not do anything on my side:
/opt/sbin/udhcpc -q -n -t 17 -T 10 -i brwan -r MY IP >/dev/null 2>&1

This is working perfectly.

However, I was unable to reproduce that for IPv6 as neither firmware dhcp6c or Entware dhclient offers the -T option (or equivalent).
Firmware dhcp6c is able to retrieve and set the IP address for brwan and delegation (after changing DAD sysctl in net6conf scripts): /usr/sbin/dhcp6c -c /tmp/dhcp6c.conf -3 brwan and I changed the setup in these scripts for the LAN side: /opt/sbin/dhcpd -6 -cf /opt/bolemo/etc/dhcpd6.conf br0

I still have a few micro cuts everyday for IPv6, and I would like to finally use the same trick as I do for IPv4.
Since there are no DHCPv6 clients with the -T option (not changing the interface), I captured the packets sent by dhcp6c with tcpdump.
If I can simply replay these packets every 2 minutes, it should work, and I could then get rid of any DHCPv6 client and use a static configuration for IPv6.

Now, to replay these packets, I need either tcpreplay (not available on Entware, and I fail to build it), or tcptrace that would allow me to replay using netcat ( https://gist.github.com/qbein/e936fc6afd524c901af4 ). Also not available and was not able to compile.

Any ideas on how I could replay these 4 pcap packets I saved on a file from tcpdump?
And/or how I could successfully compile tcpreplay?

Here is what I get:
Code:
[email protected]:/tmp/mnt/sda1/tcpreplay/tcpreplay-4.3.3$ source /opt/bin/gcc_env.sh
--prefix=/opt
checking whether to enable maintainer-specific portions of Makefiles... yes
checking if malloc debugging is wanted... no
checking build system type... armv7l-unknown-linux-gnueabihf
checking host system type... armv7l-unknown-linux-gnueabihf
checking target system type... armv7l-unknown-linux-gnueabihf
checking for cygwin development environment... no
checking for a BSD-compatible install... config/install-sh -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... config/install-sh -c -d
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... configure: error: in `/mnt/optware/tcpreplay/tcpreplay-4.3.3':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
I followed these directions: https://github.com/Entware/Entware/wiki/Using-GCC-for-native-compilation
 

R. Gerrits

Senior Member
If I were to compile it, I would do something like:

./configure --prefix=/opt
make
make install

i.e. I never used that source /opt/bin/gcc_env.sh.

And I don't see you doing that ./configure ....

Just quickly gave it a go on my R7800 -> ./configure fails because it doesn't find libpcap.
Normally solution would be to install libpcap-dev. But that is not available in entware. Probably first need to compile that as well. Or perhaps give the ./configure the correct option to point it to the libpcap location.
 

HELLO_wORLD

Very Senior Member
I must have something broken in my Entware.

The config.log of compiling is saying that:
Code:
configure:4478: checking whether we are cross compiling
configure:4486: gcc -o conftest    conftest.c  >&5
conftest.c:11:10: fatal error: stdio.h: No such file or directory
#include <stdio.h>
          ^~~~~~~~~
compilation terminated.
I do have libc installed...

EDIT: removed and reinstalled some Entware packages. Now I do have the correct /opt/include content, and I do have the same result as @R. Gerrits :)

Now, I can move forward...
 
Last edited:

HELLO_wORLD

Very Senior Member
Ok, now that my compiling environment is working, I was able to compile bittwist, very lightweight and seems to do its job

Will have to test now if it works for what I need it for.
 

Voxel

Very Senior Member
My project to compile firmware for R7800 is deployed (i.e. already compiled). Cross-compiling. So I am able to compile some add-ons from source codes if you need them. If they do not require a lot of additional dependences. P.M. ?


Normally solution would be to install libpcap-dev.

libpcap-dev is available in my deployed project, but not so fresh. Version 1.1.1. I cannot upgrade it (as it was done in R9000/ORBI firmware). Reason: libpcap is used in R7800 QoS pre-built modules, so binary incompatible.

Voxel.
 
Last edited:

HELLO_wORLD

Very Senior Member
@Voxel : thank you very much, I do appreciate your offer and will keep it in mind if needed. However, I will always try to find a way before adding more to your tasks.

bittwist seems to be working fine :)
I have WAN IPv6 static, LAN IPv6 DHCP, and this cron job:
*/2 * * * * /opt/bolemo/scripts/bittwist -i brwan /opt/bolemo/etc/dhcpv6-client.pcap

Rebooted the router, all seems fine so far. DHCP infra relay is happy and keeping my IP in network whitelist.
 

HELLO_wORLD

Very Senior Member
Well, it worked for a while, then ping6 to ipv6.google.com from router became longer with a weird route.
Ping from LAN was good.
Then later, no more IPv6. Doing a /etc/init.d/init6 restart fixed it, but then the problem occurs again.
So the problem is likely on the router, some sysctl config...

I reverted to using dhcp6c for now. Maybe I will try to compile a more recent dhcp6c with the -T option.
 

HELLO_wORLD

Very Senior Member
Ok, I was able to modify (adding -t test option to not change interfaces, and -q quit option to quit once lease is received by server) and compile a version of dhcp6c I found on GitHub.

Testing it was successful (server sends back the lease) and I will try later to go back to fixed setup and calling my dhcp6c every 5 minutes (lease time from server is 600 seconds for IPv6).

This dhcp6c I found does not support DUID type 3 (LL), only type 1 (LLT), while the dhcp6c in the NG (and @Voxel ) firmware has the extra option -3.
My ISP only accept DUID LL, and for now I can easily feed the dhcp6c_duid file created by native dhcp6c (type 3) to my custom dhcp6c, and it does not complain (and dhcp server is happy too).

However, if someone has the source for the dhcp6c modified NG version, I would be interested, so I can add the -3 option to mine.

PS: I have to precise that the native -i option does not write on interface, but only sends INF_REQ dhcp requests to the server, and it is not enough to allow my IP, it had to be a REQUEST or RENEW request, hence why I needed to customize the client.
 

HELLO_wORLD

Very Senior Member
I was able to recreate the -3 option from scratch, so my dhcp6c now supports DUID LL the same way the native NG dhcp6c does.

Compiled it with Entware and works like a charm.

Source for my fork: https://github.com/bolemo/dhcp6c

I also completely rewrote the IPv6 scripts to work exactly as I want for my config/ISP (/etc/init.d/init6, part of /etc/init.d/net-lan, /etc/net6conf/*).

Now I know exactly what is going on, and it works great.
 

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top