The messages log reports martian packets because the kernel's network stack has received packets with a source address that is impossible on the interface they arrived on—most commonly a private or reserved IP address arriving from the public internet, or a local address arriving from outside the local network. The Linux kernel logs these as "martian source" because they are, from the host's point of view, from another world: they violate the routing and addressing rules the machine expects, so the kernel drops them and records the event for the administrator.
What "Martian" Means in Kernel Networking
In Linux networking, a martian packet is one whose source or destination address is not valid for the interface on which it was received. The term comes from the idea that such a packet appears to come from Mars—nowhere legitimate on the local network topology. The kernel checks incoming packets against its routing table and interface configuration; if the source address falls outside the range of addresses that could legitimately appear on that interface, the packet is flagged.
Typical log lines look like this:
martian source 192.168.1.10 from 203.0.113.5 on eth0ll header: 00:11:22:33:44:55:66:77:88:99:aa:bb:08:00
The first line names the impossible source address, the address it actually came from, and the interface. The second shows the link-layer header, which helps identify the hardware and protocol involved. These messages are generated by the kernel's martian logging facility, controlled by the log_martians sysctl setting.
Why the Kernel Flags Packets as Martian
The kernel performs a reverse-path check: for a packet arriving on an interface, it asks whether the routing table would send a reply to that source address back out the same interface. If the answer is no—or if the source address is one the kernel considers impossible on that link—the packet is deemed martian. Common triggers include:
- Private addresses from the internet: A packet with a source in 10.0.0.0/8, 172.16.0.0/12, or 192.168.0.0/16 arriving on a public-facing interface. These ranges are reserved for private networks and should never appear on the public internet, so their presence usually indicates misconfiguration, spoofing, or a broken NAT device.
- Loopback addresses off-box: A packet claiming to be from 127.0.0.1 arriving on a physical interface. Loopback is only valid locally.
- Link-local or reserved ranges: Addresses such as 169.254.0.0/16 (link-local) or 0.0.0.0 appearing where they should not.
- Asymmetric routing: In networks with multiple paths, a reply may arrive on a different interface than the one the kernel would use to send traffic back, causing the reverse-path check to fail even though the packet is legitimate.
- Bridged or virtual interfaces: Packets crossing between bridged interfaces, containers, or virtual machines can appear to come from an unexpected address range if the bridge or NAT rules are misconfigured.
It is important to note that martian logging is a diagnostic, not an attack detector. A martian packet is dropped by default (unless accept_local or similar settings are changed), so the log entry is a record of something that was already refused.
How the Reverse-Path Check Works
The core mechanism is the reverse-path filter (rp_filter), configured per interface via the net.ipv4.conf. sysctl. Its strict mode (value 1) requires that the source address be reachable via the same interface the packet arrived on. Loose mode (value 2) only requires that the source be reachable via any interface. When the check fails, the kernel increments a counter and, if log_martians is enabled, writes the log entry.
By default, log_martians is often disabled on modern distributions to avoid log noise, but many systems enable it for troubleshooting. The setting can be checked and changed at runtime:
- Read the current value:
sysctl net.ipv4.conf.all.log_martians - Enable logging temporarily:
sysctl -w net.ipv4.conf.all.log_martians=1 - Persist the change by adding a line to
/etc/sysctl.confor a file under/etc/sysctl.d/.
Similar settings exist for IPv6, though the terminology and checks differ slightly.
Common Causes in Real Networks
In practice, martian packets usually point to one of a handful of configuration issues rather than malicious activity. The most frequent culprits are:
- Misconfigured NAT or routing: A router or firewall that forwards traffic without properly translating source addresses can leak private addresses onto the wrong segment.
- Multi-homed hosts with asymmetric paths: A server with two network interfaces may receive a reply on the "wrong" interface, triggering the reverse-path check. This is common in load-balanced or high-availability setups.
- Virtualization and container networking: Bridges, overlay networks, and container runtimes can produce packets whose source addresses do not match the physical interface they traverse. Docker and Kubernetes environments sometimes generate martian logs for this reason.
- Spoofed or malformed traffic: Attackers or scanning tools may send packets with forged source addresses. These are dropped, but the log entry records the attempt.
- Stale or incorrect ARP entries: Occasionally, a host with a wrong IP-to-MAC mapping can cause packets to appear from an unexpected address.
A common misconception is that martian packets always indicate a security breach. In most cases they are benign symptoms of a misconfiguration, and the kernel has already discarded the packet. However, repeated martian logs from the same external source can indicate scanning or spoofing attempts and are worth investigating.
How to Investigate and Reduce Martian Logs
When martian messages appear, the goal is to determine whether they are harmless noise or a sign of a real problem. A systematic approach helps:
- Identify the source and interface: Note the source address and the interface in the log line. Is the source a private address arriving on a public interface? Is it a local address arriving from outside?
- Check routing and NAT rules: Verify that routers and firewalls translate addresses correctly and that no private ranges are leaking onto public links.
- Review rp_filter settings: On multi-homed hosts, strict reverse-path filtering may be too aggressive. Switching to loose mode (value 2) can resolve legitimate asymmetric routing issues, though it weakens spoofing protection.
- Examine virtual network configuration: In container or VM environments, ensure that bridge and overlay networks use consistent address ranges and that NAT is applied where needed.
- Consider disabling logging if benign: If the packets are confirmed harmless and the log noise is excessive,
log_martianscan be turned off. The packets will still be dropped; only the logging stops.
It is generally better to fix the underlying cause than to silence the logs, because martian packets can reveal misconfigurations that affect performance or security.
Martian Packets and Security
While martian logging is not a security feature per se, it can be a useful signal. Spoofed packets with private source addresses are a common technique in some types of network attacks, and their appearance in logs may prompt a review of firewall rules. However, the kernel's default behavior of dropping martian packets already provides a basic layer of protection against certain spoofing attempts. Administrators should not rely on martian logs as their primary intrusion detection mechanism; they are a diagnostic tool, not a comprehensive security control.
Frequently Asked Questions
Are martian packets dangerous?
In most cases, no. The kernel drops them by default, so they cannot reach applications. They are usually a sign of misconfiguration rather than an attack, though repeated attempts from external sources may warrant investigation.
Can I stop martian packets from being logged?
Yes. Setting net.ipv4.conf.all.log_martians=0 disables the logging. The packets will still be dropped according to the reverse-path filter rules; only the log entries stop.
Why do I see martian packets from private IP addresses?
Private addresses (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) should not appear on the public internet. Seeing them on a public interface usually means a router or NAT device is misconfigured and leaking private addresses, or that someone is spoofing them.
Do martian packets affect performance?
The packets themselves are dropped early in the network stack, so the performance impact is minimal. However, excessive logging can fill disk space and add overhead, so it is worth addressing the root cause if the volume is high.
What is the difference between a martian packet and a spoofed packet?
A martian packet is defined by its source address being invalid for the interface it arrives on. A spoofed packet is one with a forged source address. A spoofed packet may or may not be martian, depending on whether the forged address is valid for that interface. Martian logging can help detect some spoofing attempts, but not all.