0

I have added some rules to my PREROUTING chain in NAT. Usually at the beginning of a new machine joining the network, these matches don't always match correctly?

Im using iptables v1.4.21 on OpenWRT Barrier Breaker This is on a linux bridge where ebtables is sending packets through iptables

net.bridge.bridge-nf-call-iptables=1

In it's simplest form

    -A PREROUTING -m mac --mac-source <my mac> -j ACCEPT
    -A PREROUTING -m limit --limit 1/min -j LOG --log-prefix "id=Unknown-Device " --log-level 5

But I get log messages showing that it didn't match. The mac addresses are definitely correct

id=Unknown-Device IN=br-lan OUT= PHYSIN=wlan0 MAC=<dst>:<src>:08:00 SRC=192.168.0.105 DST=15.72.255.5 LEN=64 TOS=0x00 PREC=0x00 TTL=64 ID=1 DF PROTO=TCP SPT=23058 DPT=80 WINDOW=8688 RES=0x00 SYN URGP=0
Adam Mills
  • 25
  • 8

1 Answers1

0

If I correctly understand you, your setup is working, and sometimes, when a new machine is connecting, some logs shows up. You are tring to understand why. Is that true?

I have several ideas about your issues, although I can't provide an answer yet.

First, I want to be sure there are some "good" connections. To confirm this, you could disable the 1 packet per minute limitation in the log rule, and add another log rule before the accept one :

-A PREROUTING -m mac --mac-source <my mac> -j LOG --log-prefix "id=Well-known-Device " --log-level 5
-A PREROUTING -m mac --mac-source <my mac> -j ACCEPT
-A PREROUTING -j LOG --log-prefix "id=Unknown-Device " --log-level 5

In order to dismiss some hypothesis, can you confirm that:

  1. you are not using DNAT in the nat table (it looks like you aren't)
  2. packets are going through FORWARD chain (it looks like they are)
  3. it occurs over ethernet (it looks like it does)
setenforce 1
  • 1,200
  • 6
  • 10