Hi all,
I am stuck with a little IP/firewall/routing problem:
If a linux box "A" has the same IP address as another host "B" on
the network, UDP broadcasts from B to 255.255.255.255 seem to be
silently discarded on A in the routing layer (everything works as
expected if A and B have different IPs). Discarding those packets
is reasonable (since TCP/IP forbids this setup), but for my needs
I need a workaround for this problem ("A" is an embedded linux
device which IP address is configured using UDP broadcasts).
I tried using iptables to change the source address of the incoming
broadcast, but SNAT is only possible in POSTROUTING (as mentioned
before, the packet is discarded during routing. iptables can log it
in PREROUTING, but it is gone in INPUT/FORWARD and POSTROUTING).
So I tried to modify the routing tables to pass the packets to my
local server process. Using "ip" I inspected the routing tables and
found the following rules:
192.168.1.0/24 dev eth1 proto kernel scope link src 192.168.1.50
broadcast 192.168.1.0 dev eth1 table local proto kernel scope link src 192.168.1.50
local 192.168.1.50 dev eth1 table local proto kernel scope host src 192.168.1.50
broadcast 192.168.1.255 dev eth1 table local proto kernel scope link src 192.168.1.50
When I remove the "local" entry, the broadcast packets arrive at my
application, but all other network connections fail (obviously).
How must I set up routing so that networking behaves as usual, with
the only difference being that broadcasts from other systems are always
passed to local applications?
Other workarounds are welcome, too (except for: "use different IPs").
Thanks, Thomas
|