I am currently testing a scenario using Python and scapy.
When I send a packet which has a src mac of 80:CA:0E:BD:60:3B and destination mac of 82:DA:0E:BD:60:3A, the packet is sent out the specified interface.
If I then swap the src and destination macs, the packet is no longer sent.
If I then revert the macs, the original packet is also no longer sent.
Interestingly, if I wait a few minutes, the swapped mac packet is allowed through.
My python code is as follows:
from scapy.all import * # this packet is sent sendp(Ether(src="80:CA:0E:BD:60:3B", dst="82:DA:0E:BD:60:3A")/IP(dst="192.168.0.71",src="192.168.0.75")/UDP(sport=2152,dport=2152), iface="enp0s9") # this packet does not get sent, until after a few mins sendp(Ether(dst="80:CA:0E:BD:60:3B", src="82:DA:0E:BD:60:3A")/IP(dst="192.168.0.71",src="192.168.0.75")/UDP(sport=2152,dport=2152), iface="enp0s9")
Does Linux keep track of the source and destination mac addresses to decide whether to actually send the packet?
What appears to be happening is Linux is not sending the swapped packet because it sees that it is destined for itself based on the previous sent packet.