Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
yjsslab
V2EX  ›  Linux

Linux 网卡出口 ip 设定

  •  
  •   yjsslab · Oct 9, 2017 · 2742 views
    This topic created in 3146 days ago, the information mentioned may be changed or developed.

    ubuntu 系统,两个公网 ip 同一个物理网卡上

    eth0      Link encap:Ethernet  HWaddr 88:23:ac:07:5a:7c  
              inet addr:118.118.182.89  Bcast:118.118.182.255  Mask:255.255.254.0
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:122222 errors:0 dropped:0 overruns:0 frame:0
              TX packets:122222 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:36394218 (30 MiB)  TX bytes:42491387 (40 MiB)
    
    eth0:0    Link encap:Ethernet  HWaddr 88:23:ac:07:5a:7c  
              inet addr:118.118.182.90  Bcast:118.118.182.255  Mask:255.255.254.0
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
    

    问题,如何让流量从哪个 ip 进就从哪个 ip 出?

    1 replies    2017-10-19 18:22:19 +08:00
    raysonx
        1
    raysonx  
       Oct 19, 2017 via Android
    发送方的 socket 如果 bind 了某个 IP,那么出口就是那个 IP。
    否则看路由表`ip r`
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4768 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 05:37 · PVG 13:37 · LAX 22:37 · JFK 01:37
    ♥ Do have faith in what you're doing.