Why Your Linux Router Won’t Forward Packets and How to Fix It
This article walks through a Linux routing experiment where misconfigured routes caused ARP failures, explains the root cause, and provides the correct routing commands and packet‑capture analysis that enable successful ping between two hosts through a Linux router.
Recently I performed a network experiment that required Linux packet forwarding; after encountering several issues and consulting Linux networking experts, I resolved them and documented the process for future reference.
Network Topology
Three machines are used: host ①, router ④, and host ⑦. Host ① pings host ⑦ with host ④ acting as the router.
Incorrect Routing Configuration
Initially the following commands were applied to configure the routing tables on the three machines: route add -net 10.0.4.0/24 dev eth1 On host ① the routing table displayed:
On host ⑦ the routing table displayed:
After enabling IP forwarding on the router (setting net.ipv4.ip_forward=1 in /etc/sysctl.conf) the ping from host ① to host ④ fails:
PING 10.0.4.3 (10.0.4.3) 56(84) bytes of data.
From 10.0.1.3 icmp_seq=2 Destination Host Unreachable
...Packet capture on router ④ shows host ① repeatedly sending ARP requests for 10.0.4.3, but the router does not forward ARP packets, so host ① never learns the MAC address of host ⑦.
Correct Configuration
Applying the proper route on host ① resolves the issue: route add -net 10.0.4.0/24 gw 10.0.1.2 The updated routing table on host ① becomes:
[root@h1 ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.4.0 10.0.1.2 255.255.255.0 UG 0 0 0 eth1
...Similarly, host ⑦’s routing table is configured to use the router as gateway.
After these changes, ping from host ① to host ⑦ succeeds. MAC addresses are:
① eth1: 00:16:EC:AF:CB:CB
④ eth1: 40:61:86:32:8F:0B
④ eth4: 40:61:86:32:8F:0E
⑦ eth1: 00:25:90:93:40:79Packet captures on router interfaces (eth1, eth4) show ICMP echo requests and replies traversing correctly.
Conclusion
Linux routers do not forward ARP packets by default; an incorrect static route causes the source host to remain stuck in ARP resolution, preventing communication. Using the correct gateway configuration or enabling ARP proxy on the router resolves the issue.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
