Skip to contentSkip to conversation

Filtering MAC addresses and Multicast

DISCUSSION Gerard París Aixalà 3 participants 7 messages Aug 1, 2006 – Aug 2, 2006 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hello all,

I have a strange problem using iptables that had been reported yet in this list two years ago, but it has not been solved: http://lists.netfilter.org/pipermail/netfilter/2004-October/056506.html

I emulate a MANET on an Ethernet by adding iptables rules like these (filtering at MAC layer):

/sbin/iptables -t mangle -A PREROUTING -m mac --mac-source 00:06:5B:12:C9:7A -j DROP /sbin/iptables -t mangle -A PREROUTING -m mac --mac-source 00:06:5B:13:4A:69 -j DROP

These rules drop Unicast traffic but they do not drop Multicast traffic. How can I fix it?

Thank you in advance
Kind regards,
Gerard

#2 lore raw
In reply to a message not in the archive
Quoted 7 lines · Martijn Lievaart
Quoted 5 lines · Gerard París Aixalà

Hello all,

/sbin/iptables -t mangle -A PREROUTING -m mac --mac-source 00:06:5B:12:C9:7A -j DROP /sbin/iptables -t mangle -A PREROUTING -m mac --mac-source 00:06:5B:13:4A:69 -j DROP

Quoted 8 lines
Quoted 1 line

These rules drop Unicast traffic but they do not drop Multicast traffic.

Multicast traffic is sent to specific multicast MAC adresses.
Learn how multicast works and drop the corresponding MAC addresses. (No I don't have a link handy, tcp/ip illustrated would be a good, but pricy source).

HTH,
M4

I know how multicast works, but I want to drop packets with the specified MAC source adresses. In multicast, the source address is always a real one, to identify which computer the packet came from (the destination address, both MAC and IP, is a special one).

Gerard

#3 lore raw
Quoted 20 lines · Gerard París Aixalà
Quoted 18 lines · Martijn Lievaart
Quoted 9 lines · Gerard París Aixalà

Hello all,

/sbin/iptables -t mangle -A PREROUTING -m mac --mac-source 00:06:5B:12:C9:7A -j DROP
/sbin/iptables -t mangle -A PREROUTING -m mac --mac-source 00:06:5B:13:4A:69 -j DROP

These rules drop Unicast traffic but they do not drop Multicast traffic.

Multicast traffic is sent to specific multicast MAC adresses. Learn how multicast works and drop the corresponding MAC addresses. (No I don't have a link handy, tcp/ip illustrated would be a good, but pricy source).

Quoted 8 lines
Quoted 3 lines

HTH,
M4

I know how multicast works, but I want to drop packets with the specified MAC source adresses. In multicast, the source address is always a real one, to identify which computer the packet came from (the destination address, both MAC and IP, is a special one).

<blush> Oops, my bad. Should read better. Sorry, Can't help you there. If you don't get a reply on this list in a few days, maybe ask netfilter-devel, because this looks like a bug.

M4

#4 lore raw

Martijn Lievaart írta:

Quoted 21 lines
Quoted 19 lines · Gerard París Aixalà
Quoted 16 lines · Martijn Lievaart
Quoted 6 lines · Gerard París Aixalà

Hello all,

/sbin/iptables -t mangle -A PREROUTING -m mac --mac-source 00:06:5B:12:C9:7A -j DROP /sbin/iptables -t mangle -A PREROUTING -m mac --mac-source 00:06:5B:13:4A:69 -j DROP

These rules drop Unicast traffic but they do not drop Multicast traffic.

Multicast traffic is sent to specific multicast MAC adresses.
Learn how multicast works and drop the corresponding MAC addresses. (No I don't have a link handy, tcp/ip illustrated would be a good, but pricy source).

HTH,
M4

Quoted 10 lines
Quoted 1 line

I know how multicast works, but I want to drop packets with the specified MAC source adresses. In multicast, the source address is always a real one, to identify which computer the packet came from (the destination address, both MAC and IP, is a special one).

<blush> Oops, my bad. Should read better. Sorry, Can't help you there. If you don't get a reply on this list in a few days, maybe ask netfilter-devel, because this looks like a bug.

M4

Try this:

iptables -t mangle -A PREROUTING -j DROP -m mac --mac-source XX:XX:XX:XX:XX:XX -m pkttype --pkt-type multicast

#5 lore raw
Quoted 27 lines · Gáspár Lajos

Martijn Lievaart írta:

Quoted 26 lines
Quoted 12 lines · Gerard París Aixalà
Quoted 10 lines · Martijn Lievaart
Quoted 6 lines · Gerard París Aixalà

Hello all,

/sbin/iptables -t mangle -A PREROUTING -m mac --mac-source 00:06:5B:12:C9:7A -j DROP /sbin/iptables -t mangle -A PREROUTING -m mac --mac-source 00:06:5B:13:4A:69 -j DROP

These rules drop Unicast traffic but they do not drop Multicast traffic.

Quoted 8 lines
Quoted 6 lines

Multicast traffic is sent to specific multicast MAC adresses.
Learn how multicast works and drop the corresponding MAC addresses. (No I don't have a link handy, tcp/ip illustrated would be a good, but pricy source).

HTH,
M4

I know how multicast works, but I want to drop packets with the specified MAC source adresses. In multicast, the source address is always a real one, to identify which computer the packet came from (the destination address, both MAC and IP, is a special one).

<blush> Oops, my bad. Should read better. Sorry, Can't help you there. If you don't get a reply on this list in a few days, maybe ask netfilter-devel, because this looks like a bug.

Quoted 10 lines
Quoted 5 lines

M4

Try this:

iptables -t mangle -A PREROUTING -j DROP -m mac --mac-source XX:XX:XX:XX:XX:XX -m pkttype --pkt-type multicast

I tried this.
And this:
iptables -t mangle -I PREROUTING -d 225.0.0.4 -j DROP # 225.0.0.4 is the multicast address
iptables -t mangle -I PREROUTING -j DROP
But the multicast traffic still arrives at the destination computer.

#6 lore raw
Quoted 5 lines · Gerard París Aixalà

I tried this.
And this:
iptables -t mangle -I PREROUTING -d 225.0.0.4 -j DROP # 225.0.0.4 is the multicast address
iptables -t mangle -I PREROUTING -j DROP
But the multicast traffic still arrives at the destination computer.

How do you know that the traffic arrives ??? :) If you see it with some sniffer programs (tetheral) then that is fake because those programs see the packets BEFORE they reach the filtering system. You can not tell a packet not to enter your network card... :D

BTW.: What does the counters of the packets matching your rules says ??? (iptables -L -v -n -t mangle)

#7 lore raw
Quoted 6 lines · Gáspár Lajos
Quoted 5 lines · Gerard París Aixalà

I tried this.
And this:
iptables -t mangle -I PREROUTING -d 225.0.0.4 -j DROP # 225.0.0.4 is the multicast address
iptables -t mangle -I PREROUTING -j DROP
But the multicast traffic still arrives at the destination computer.

Quoted 6 lines

How do you know that the traffic arrives ??? :) If you see it with some sniffer programs (tetheral) then that is fake because those programs see the packets BEFORE they reach the filtering system. You can not tell a packet not to enter your network card... :D

BTW.: What does the counters of the packets matching your rules says ??? (iptables -L -v -n -t mangle)

I was using a multicast traffic generator (source and receiver). The receiver showed the packets as they arrived. After sending 48 multicast packets the counters say the following:
Chain PREROUTING (policy ACCEPT 3 packets, 724 bytes)

pkts bytes target     prot opt in     out     source               destination
  48 56256 DROP       all  --  *      *       0.0.0.0/0            

0.0.0.0/0 MAC 00:06:5B:13:4A:69
It seems all the packets were dropped, but the receiver application sees them (it maybe acts like a sniffer).

I changed the application and tried VLC. With those rules, multicast traffic was blocked.

Thanks,
Gerard