Traffic collection with OpenWrt, Raspberrry Pi & Ntopng

Hi all,

I am trying to place a router with OpenWrt between my main modem and another router that supplies WiFi access to a large property, I thought a diagram would explain it better

Putting the traffic collection aspect aside for a minute, when I plug everything in, I cannot ping 192.168.1.x from the Asus router at the end of the chain. I think I may need to set up a firewall rule or a bridge on the OpenWrt box to allow this? I am stumped.

Any advice would be very welcome.

Configuration files on the OpenWrt box are as follows
/etc/config/network

config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'fd62:2ca0:1449::/48'

config interface 'lan'
	option type 'bridge'
	option ifname 'eth0.1'
	option proto 'static'
	option netmask '255.255.255.0'
	option ip6assign '60'
	option ipaddr '192.168.3.2'
	list dns '192.168.3.21'

config interface 'wan'
	option ifname 'eth0.2'
	option proto 'static'
	option gateway '192.168.1.1'
	option ipaddr '192.168.1.4'
	option netmask '255.255.255.0'
	list dns '192.168.3.21'

config interface 'wan6'
	option ifname 'eth0.2'
	option proto 'dhcp'

config switch
	option name 'switch0'
	option reset '1'
	option enable_vlan '1'

config switch_vlan
	option device 'switch0'
	option vlan '1'
	option ports '1 2 3 4 8t'

config switch_vlan
	option device 'switch0'
	option vlan '2'
	option ports '0 8t'

/etc/config/firewall

config defaults
	option syn_flood	1
	option input		ACCEPT
	option output		ACCEPT
	option forward		REJECT
# Uncomment this line to disable ipv6 rules
#	option disable_ipv6	1

config zone
	option name		lan
	list   network		'lan'
	option input		ACCEPT
	option output		ACCEPT
	option forward		ACCEPT

config zone
	option name		wan
	list   network		'wan'
	list   network		'wan6'
	option input		REJECT
	option output		ACCEPT
	option forward		REJECT
	option masq		1
	option mtu_fix		1

config forwarding
	option src		lan
	option dest		wan

# We need to accept udp packets on port 68,
# see https://dev.openwrt.org/ticket/4108
config rule
	option name		Allow-DHCP-Renew
	option src		wan
	option proto		udp
	option dest_port	68
	option target		ACCEPT
	option family		ipv4

# Allow IPv4 ping
config rule
	option name		Allow-Ping
	option src		wan
	option proto		icmp
	option icmp_type	echo-request
	option family		ipv4
	option target		ACCEPT

config rule
	option name		Allow-IGMP
	option src		wan
	option proto		igmp
	option family		ipv4
	option target		ACCEPT

# Allow DHCPv6 replies
# see https://dev.openwrt.org/ticket/10381
config rule
	option name		Allow-DHCPv6
	option src		wan
	option proto		udp
	option src_ip		fc00::/6
	option dest_ip		fc00::/6
	option dest_port	546
	option family		ipv6
	option target		ACCEPT

config rule
	option name		Allow-MLD
	option src		wan
	option proto		icmp
	option src_ip		fe80::/10
	list icmp_type		'130/0'
	list icmp_type		'131/0'
	list icmp_type		'132/0'
	list icmp_type		'143/0'
	option family		ipv6
	option target		ACCEPT

# Allow essential incoming IPv6 ICMP traffic
config rule
	option name		Allow-ICMPv6-Input
	option src		wan
	option proto	icmp
	list icmp_type		echo-request
	list icmp_type		echo-reply
	list icmp_type		destination-unreachable
	list icmp_type		packet-too-big
	list icmp_type		time-exceeded
	list icmp_type		bad-header
	list icmp_type		unknown-header-type
	list icmp_type		router-solicitation
	list icmp_type		neighbour-solicitation
	list icmp_type		router-advertisement
	list icmp_type		neighbour-advertisement
	option limit		1000/sec
	option family		ipv6
	option target		ACCEPT

# Allow essential forwarded IPv6 ICMP traffic
config rule
	option name		Allow-ICMPv6-Forward
	option src		wan
	option dest		*
	option proto		icmp
	list icmp_type		echo-request
	list icmp_type		echo-reply
	list icmp_type		destination-unreachable
	list icmp_type		packet-too-big
	list icmp_type		time-exceeded
	list icmp_type		bad-header
	list icmp_type		unknown-header-type
	option limit		1000/sec
	option family		ipv6
	option target		ACCEPT

config rule
	option name		Allow-IPSec-ESP
	option src		wan
	option dest		lan
	option proto		esp
	option target		ACCEPT

config rule
	option name		Allow-ISAKMP
	option src		wan
	option dest		lan
	option dest_port	500
	option proto		udp
	option target		ACCEPT

config rule                           
        option name 'Allow-WAN-SSH'   
        option src 'wan'              
        option dest_port '22'         
        option target 'ACCEPT'        
        option proto 'tcp'            
                                      
config rule                           
        option name 'Allow-WAN-HTTP'  
        option src 'wan'              
        option dest_port '80'         
        option target 'ACCEPT'        
        option proto 'tcp'         

# include a file with users custom iptables rules
config include
	option path /etc/firewall.user

you say the asus WAN port is plugged... you show one cable yet you list it as having a 3.x address also? confusing... ( i do appreciate the diagram tho' thanks for making the effort )

i'm guessing that you can't ping it cause your facing it's(86U) wan interface... which would be firewalled.

1 Like

Yeah, the Asus is using the 192.168.3.x. addresses for WiFi connections, sorry I didn't make that clear. So if I switch off the firewall on the Asus I should be able to ping 192.168.1.1 and basically the internet?

A picture does paint a thousand (or a few) words in this case. It was done with LibreOffice draw and these extensions if anyone is interested

Does anyone have any ideas about this pls?

You may want to edit the title to more accurately reflect your question.

hi Jason,

I am trying to do the exact thing...
Did you get anywhere with this thing ?

I have comcast/xfinity, and my openwrt router is the main router, so I am in a bit of fix, as I guess I need nProbe which is a expensive product to buy with ntopng

G

Sorry but I gave up! I did not solve it.

if the asus router was running openwrt, you could create an interface. this is my setting to access modem page from lan, modem set to 192.168.3.1

config interface 'lan'
option type 'bridge'
option ifname 'eth0'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'

config interface 'wan'
option ifname 'eth0.10'
option proto 'dhcp'
list dns '1.1.1.1'
option peerdns '0'

config interface 'modem'
option proto 'static'
option ipaddr '192.168.3.2'
option netmask '255.255.255.0'
option ifname 'eth0.10'

hope it helps

Hi thanks for this.

Unfortunately if the Asus is running openwrt, I cannot use aimesh which is a bit of a problem.

I got a

https://www.friendlyarm.com/index.php?route=product/product&path=69&product_id=282

thinking I will run native linux and run ntop on the device, but not yet gotten to it.. that way I can use the free version...

dont plan to use any firewall and stuff, plain simple linux with all open networking from port0 to port1, and ntop just collecting and monitoring data.

Actually I used PI4 with raspbian. I had to set PI4 ip address as "router address" in my DHCP server running on openwrt and ran masquerade (welcome to double NAT!) to make sure received frames don't bypass PI4. I had to filter out PI4 address from the ntopng to avoid double traffic analysis.

If you have a USB stick, then you can insert physically in the path and collect traffic.

1 Like