$linuxjunkies
>

forwarding rewriting

also: NAT rewriting, packet rewriting, address rewriting

A networking technique where a system (usually a router or firewall) intercepts packets destined for one address and transparently rewrites them to send to a different address, then rewrites the response packets to return to the original requester.

Forwarding rewriting is commonly used in network address translation (NAT), port forwarding, and load balancing scenarios. Instead of simply routing packets unchanged, the system modifies the packet headers—typically the destination IP address and/or port—before sending them onward.

A classic example is a home router receiving traffic on port 8080 and rewriting it to forward to a web server on a private IP (192.168.1.100:80), while also rewriting the response packets' source address back to the router's public IP so the client sees a seamless connection.

In Linux, forwarding rewriting is implemented through iptables/nftables using NAT rules (PREROUTING, POSTROUTING chains) or through dedicated tools like netfilter. This allows a single public IP to serve multiple internal services and protects internal network topology from external visibility.

Related terms