【问题标题】:make different requests forward to different interfaces将不同的请求转发到不同的接口
【发布时间】:2013-01-19 21:18:33
【问题描述】:

我有一台网关计算机,它通过 ADSL 连接 Internet,并获得了一个虚拟接口 ppp0。我通过ADSL建立了一个pptp vpn,得到了一个虚拟接口ppp1。

有几台计算机连接到这台网关计算机,以便共享 Internet 和 vpn 连接。

我想设置一些路由规则或iptables规则,让特定IP范围的特定请求从内部计算机转发到vpn连接(ppp1),其他请求直接通过ADSL连接(ppp0)。

我该怎么办?

【问题讨论】:

    标签: vpn routes iptables gateway ppp


    【解决方案1】:

    您好,您可以通过 PREROUTING 链上的 iptable 中的 DNAT 来做到这一点

    下面的示例将 http 流量从指定的 ips 范围(“start-ip”到“end-ip”)重定向到指定的目标 ip 和端口(gatewayip:vpnportnumber)。

    iptables -A PREROUTING -t nat -m iprange --src-range "start-ip"-"end-ip" -i "interface" -p tcp -m tcp --dport 80 -j DNAT --to -destination "gatewayip:vpnportnumber"

    【讨论】:

      猜你喜欢
      • 2012-12-22
      • 1970-01-01
      • 1970-01-01
      • 2016-05-10
      • 2012-06-19
      • 2022-01-20
      • 1970-01-01
      • 2015-07-24
      • 2015-05-07
      相关资源
      最近更新 更多