Log dhcp request and ack details from the router and not wireshark

Hello,
is there an easy way to see a detailed log of my DHCP requests on the wan port ? i would like to see if the dhcp options are sent correctly in the request, and what is received in return in the DHCP ACK. and if possible any error message...

Actualy i have to insert a managed switch between the ONT and the router, and do a port mirroring.
Being able to capture what's going on from the router will make things easier...

  1. Install tcpdump on the OpenWrt router.
    opkg update && opkg install tcpdump

  2. Run a dump session in the background and save the results to a file.
    tcpdump udp and port 67 or port 68 -i any -s 2000 -w /tmp/dhcp.pcap &

  3. Restart the wan interface.
    ifup wan

  4. Kill the tcpdump process.
    killall tcpdump

  5. Download the dhcp.pcap file using winscp.

  6. Open it using Wireshark.

1 Like

thank you very much @pavelgl

It can also be done real time:
ssh root@openwrt.lan tcpdump -i pppoe-wan -U -s0 -w - 'not port 22' | sudo wireshark -k -i -

1 Like