OpenWrt: Installing tcpdump from opkg

For troubleshooting deep rooted network issues, you may be accustomed to using tcpdump against a network interface on Linux.

This same utility can be used on OpenWrt to troubleshoot network issues.   The Opkg Package manager makes this easy to install.

Opkg repositories

The “/etc/opkg/distfeeds.conf” file contains the list of repositories that opkg can pull from.  As long as this is populated with the generic base packages for your OpenWrt release, you should have access to the tcpdump package.

opkg update
opkg list | grep tcpdump

Install tcpdump

opkg install tcpdump

Run tcpdump

# get list of interfaces
ifconfig

# do tcpdump on lan interface 'br-lan'
tcpdump -i br-lan -n

# dump for http traffic
tcpdump -i br-lan port 80

# dump for ssh traffic on wan, but do not show self
tcpdump -i eth0 port 22 and not host 192.168.1.7

For more detailed usage of tcpdump, see its man page.

 

REFERENCES

Opkg official docs

Installing tcpdump using opkg