V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
xpbhere
V2EX  ›  Linux

Squid 的 tcp_outgoing_address 配置问题

  •  
  •   xpbhere · 2018-03-23 12:03:42 +08:00 · 2069 次点击
    这是一个创建于 2219 天前的主题,其中的信息可能已经有所发展或是发生改变。

    大家好。 Squid 在 /etc/squid3/squid.conf 中的配置 tcp_outgoing_address 是否可以随便设置一个 IP 就能用?

    我现在要实现的需求是让 squid3 出来的数据走另外的路由表 vr,所以添加路由策略时需要制定源 IP, 比如要执行命令:ip rule add from x.x.x.x table vr。 所以现在希望设定 tcp_outgoing_address 为上述命令的"x.x.x.x",但有测试了一些内网的 ip 地址,都不可用。看了官方解释和 squid.conf 自身的注释,仍然不了解这个 IP 地址设置的具体细节,比如是否可以随便设定还是要遵从一定的规则来写。

    谢谢各位赐教,感激不尽!

    3 条回复    2018-03-23 18:24:50 +08:00
    maoyipeng
        1
    maoyipeng  
       2018-03-23 12:53:24 +08:00
    某个网卡上要有这个 ip
    xpbhere
        2
    xpbhere  
    OP
       2018-03-23 13:01:53 +08:00
    @maoyipeng 那比方说我现在网卡信息是这样的,

    eth0 Link encap:Ethernet HWaddr 08:00:27:08:8f:aa
    inet addr:192.168.2.127 Bcast:192.168.2.255 Mask:255.255.255.0
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:23556 errors:0 dropped:0 overruns:0 frame:0
    TX packets:28189 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:7171406 (7.1 MB) TX bytes:8542910 (8.5 MB)

    lo Link encap:Local Loopback
    inet addr:127.0.0.1 Mask:255.0.0.0
    UP LOOPBACK RUNNING MTU:65536 Metric:1
    RX packets:2756 errors:0 dropped:0 overruns:0 frame:0
    TX packets:2756 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:137800 (137.8 KB) TX bytes:137800 (137.8 KB)

    ppp0 Link encap:Point-to-Point Protocol
    inet addr:46.243.204.40 P-t-P:46.243.204.5 Mask:255.255.255.255
    UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1496 Metric:1
    RX packets:2907 errors:0 dropped:0 overruns:0 frame:0
    TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:3
    RX bytes:210385 (210.3 KB) TX bytes:90 (90.0 B)

    -------------------------------------------------
    如果要让 squid 走 ppp0 这个设备,要填写哪个 IP 呢? 46.243.204.40 吗?
    maoyipeng
        3
    maoyipeng  
       2018-03-23 18:24:50 +08:00
    @xpbhere 我认为是的
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2177 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 00:31 · PVG 08:31 · LAX 17:31 · JFK 20:31
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.