Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

What Is IP Forwarding? How to Check It on Linux

Understand how Linux forwards packets between networks and check IPv4 and IPv6 forwarding without changing the machine’s settings.

Table of Contents

IP forwarding lets a device pass packets between networks when the packets are addressed to another host. A Linux system that performs forwarding can act as a router. Forwarding packets still requires a route and a firewall policy that allows the intended traffic.

IP Forwarding? How it works and how to check IP Forwarding Picture 1
A router can forward packets whose destination is another network.

How a packet is forwarded

  1. The router receives an IP packet and checks whether the destination is one of its own addresses.
  2. For a packet to be forwarded, it looks up the destination. The most specific matching prefix normally wins within the selected routing table.
  3. It reduces the IPv4 time to live or the IPv6 hop limit and applies relevant forwarding rules. If allowed, it sends the packet toward the next hop or directly onto the destination link.

Static routes are configured manually. Dynamic routing protocols can learn routes. Either can supply routes the device uses to forward packets. See how a router directs traffic and use the CIDR calculator to check which addresses a route covers.

IP Forwarding? How it works and how to check IP Forwarding Picture 2
Routing and forwarding connect different subnets.

Read the Linux forwarding settings

sysctl net.ipv4.ip_forward
sysctl net.ipv6.conf.all.forwarding

A value of 1 means the corresponding global setting is enabled. A value of 0 means it is off. These read-only commands do not require changing the host. Run them in the network namespace that matters for the workload. A missing IPv6 setting may mean IPv6 is unavailable in that environment. Details are in the Linux kernel IP sysctl documentation.

If forwarding is on but traffic still fails

Check the outgoing interface and route, the destination’s return route, and firewall logs for the forwarding path. A TCP or UDP port-forwarding rule is a separate NAT configuration. Enabling IP forwarding alone neither creates a port mapping nor restricts which networks can communicate. On a managed host, have the administrator confirm the intended routes and policy before changing anything.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.