小编Lig*_*ard的帖子

使用 iptables 将 http 流量转发到另一个 IP 地址

我们希望将所有 http 流量转发到 Amazon EC2 股票 Linux 机器(基于 CentOS)上的另一个 IP 地址。我知道如何使用代理规则和 apache 来做到这一点,但我假设 iptables 将是一个更快的解决方案(也许不是!)

命令

须藤 iptables -P 输入接受
须藤 iptables -F
sudo iptables -A PREROUTING -t nat -p tcp -i eth0 --dport 80 -j DNAT --to 208.68.208.81:80
sudo iptables -A FORWARD -p tcp -d 208.68.208.81 --dport 80 -j ACCEPT

iptables -t nat -L -v -n

链 PREROUTING(策略接受 0 数据包,0 字节)
 pkts 字节目标 prot 选择退出源目标
    0 0 DNAT tcp -- eth0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 到:208.68.208.81:80

Chain INPUT(策略接受0包,0字节) …

linux web-hosting iptables

6
推荐指数
1
解决办法
9710
查看次数

标签 统计

iptables ×1

linux ×1

web-hosting ×1