LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-28-2021, 08:41 PM   #1
King Arthur
LQ Newbie
 
Registered: Oct 2010
Posts: 23

Rep: Reputation: 1
Question forward UDP Broadcast from one subnet to another with nftables


I'm using a Raspberry Pi 4 (kernel 5.4.51-v7l+) as a router with nftables v0.9.0 (Fearless Fosdick). Routing between 9 subnets including a kind of DMZ works without any problems for several months.

Now I'm facing a problem with a PC in one subnet that needs access an Android App on a phone in another subnet (I'm using a separate subnet for the Raspberry Pi 4 as WLAN AP). The Android app sends a UDP broadcast to Port 24727 that the matching app on the PC should receive and use to display the available devices.

I already tried to use a small relay program on the router that listens on one subnet and forwards the received broadcasts to the PC. But of course this causes the PC to see the router as the source of this packet and although the phone is listed as an available device it is - as I expected - not possible to connect.

How can I forward a broadcast received from one subnet to another subnet (or to a single destination IP) using nftables? I tried e.g.
  • iifname wlan0 udp dport 24727 log prefix "YYYYY:" dnat to 192.168.1.7
  • iifname wlan0 udp dport 24727 log prefix "XXXXX:" ip daddr set 192.168.1.7
in the chain of type "nat" with hook "prerouting". I also added log entries "iifname wlan0 udp dport 24727 log prefix "ZZZZZ:"" to all chains but only got a hit in this prerouting table. I would have expected the forwarded packet to be visible in another chain but it did not show anywhere and on the destination subnet tcpdump also does not show it.

What would be the correct way to forward a UDP broadcast using nftables?

Last edited by King Arthur; 03-01-2021 at 10:32 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
nftables, portA tcp and portB udp in one rule bartgrefte Linux - Security 0 04-27-2020 11:45 AM
Unable to receive UDP broadcast from a UDP socket bound to an interface Sreeram B S Linux - Networking 5 05-03-2012 02:44 PM
Cant browse computer of one subnet from another subnet dearleza Linux - Networking 3 07-05-2011 04:31 PM
udp broadcast from one subnet to another thru a linux router siva_bhavani Linux - Networking 1 12-30-2004 10:20 AM
forward broadcast packets to another subnet VultureCulture Linux - Networking 9 10-25-2003 04:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration