kenX
V2EX  ›  服务器

多 ip 前提下如何为 http 代理服务端指定出口 ip

  •  
  •   kenX · Jan 20, 2015 · 5641 views
    This topic created in 4158 days ago, the information mentioned may be changed or developed.

    背景:
    debian系统
    单网卡或多网卡配置同一网段多ip
    用tinyproxy提供http代理服务
    监听多个端口来提供服务。
    请问如何为每个端口的用户指定一个独立的出口ip?默认情况下流量会走eth0的ip

    2 replies    2015-01-20 22:33:29 +08:00
    leif
        1
    leif  
       Jan 20, 2015
    多IP 配多个用户多个tinyproxy实例
    NAT打标签
    例tinyproxy启动的UID 为501,使用1.2.3.4这个IP出站
    iptables -t mangle -A OUTPUT -m owner --uid-owner 501 -j MARK --set-mark 501
    iptables -t nat -A POSTROUTING -m mark --mark 501 -j SNAT --to 1.2.3.4
    kenX
        2
    kenX  
    OP
       Jan 20, 2015
    @leif 试过,但是好像没有效果.客户端一直超时刷不出网页.明天找时间继续分析一下看看.
    另外我系统上是单物理网卡,用eth0:1...子接口来配置多个ip的..有影响?子接口上要不要配网关?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1134 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 18:10 · PVG 02:10 · LAX 11:10 · JFK 14:10
    ♥ Do have faith in what you're doing.