使用netfilter/iptables,命令如下:
-
echo "1" > /proc/sys/net/ipv4/ip_forward
-
iptables -t nat -A OUTPUT -d 修改前的目的地址 -j DNAT --to 修改后的目的地址
OUTPUT:表示本机生成的网络数据
参考(man iptables):
nat:
This table is consulted when a packet that creates a new connection is encountered. It consists of three
built-ins: PREROUTING (for altering packets as soon as they come in), OUTPUT (for altering locally-generated
packets before routing), and POSTROUTING (for altering packets as they are about to go out).
阅读(514) | 评论(0) | 转发(0) |