SAGAN
V2EX  ›  问与答

VPS有多个IP,为什么curl指定使用某IP无效?

  •  
  •   SAGAN · Dec 24, 2012 · 5251 views
    This topic created in 4918 days ago, the information mentioned may be changed or developed.
    情况是这样的,VPS有两个IP:

    eth0 A.B.C.56
    eth0:0 A.B.C.57

    两个IP位于同一个/24网段,网关A.B.C.1。两个IP从外部都可以正常访问。


    curl http://checkip.dyndns.org
    curl --interface eth0:0 http://checkip.dyndns.org

    结果两个curl返回的IP都是 A.B.C.56, 为什么第二个curl没有使用A.B.C.57这个IP地址昵?


    路由表:
    Destination Gateway Genmask Flags Metric Ref Use Iface
    0.0.0.0 A.B.C.1 0.0.0.0 UG 0 0 0 eth0
    A.B.C.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5379 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 58ms · UTC 08:54 · PVG 16:54 · LAX 01:54 · JFK 04:54
    ♥ Do have faith in what you're doing.