5.5. Destination NAT with netfilter (DNAT)
Destination NAT with netfilter is commonly used to publish a service from an internal RFC 1918 network to a publicly accessible IP. To enable DNAT, at least one iptables command is required. The connection tracking mechanism of netfilter will ensure that subsequent packets exchanged in either direction (which can be identified as part of the existing DNAT connection) are also transformed.
In a devilishly subtle difference, netfilter DNAT does not cause the kernel to answer ARP requests for the NAT IP, where iproute2 NAT automatically begins answering ARP requests for the NAT IP.
Example 5.5. Using DNAT for all protocols (and ports) on one IP
|
In this example, all packets arriving on the router with a destination of 10.10.20.99 will depart from the router with a destination of 10.10.14.2.
Example 5.6. Using DNAT for a single port
|
Full network address translation, as performed with iproute2 can be simulated with both netfilter SNAT and DNAT, with the potential benefit (and attendent resource consumption) of connection tracking.
Example 5.7. Simulating full NAT with SNAT and DNAT
|
本文介绍了如何利用netfilter进行目的地址转换(DNAT),包括为所有协议和端口转换单一IP,为特定端口设置DNAT,以及通过SNAT和DNAT模拟完整的网络地址转换。netfilter DNAT不会响应NAT IP的ARP请求,而iproute2 NAT则会自动响应。
517

被折叠的 条评论
为什么被折叠?



