笔记本电脑是配置成一个网桥的,两个网卡配置在一个网段,只需开启内核的转发和Proxy ARP两边网络即可打通,无需用iptables做NAT。
现在要用Dell作透明代理,要把192.168.2.5这边发出的所有对80端口的访问,转到Dell的3128端口。一般是用下面的一条iptables规则:
可是这里没有地址转换,是不是不应该用nat表?经过研究,其实nat表不一定必须要做NAT。iptables的手册里面写着:iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128
- 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).
iptables的报文处理顺序 |