where2go
V2EX  ›  问与答

除了用虚拟机或 lxc 之类的容器, 还有办法对某个进程设置单独默认路由么

  •  
  •   where2go · Sep 29, 2018 · 1784 views
    This topic created in 2812 days ago, the information mentioned may be changed or developed.
    局域网内 192.168.0.1 - 192.168.0.5 是五台路由器, 都有各自的外网线路
    这些路由器的 lan 口通过交换机连接在一起, 但是只有其中一台开启了 dhcpd

    局域网内的机器如果要切换线路就自行更改默认路由, 部分是静态配置的。

    还可以通过开虚拟机或者 lxc 容器来使用不同的网关。

    但是即便 lxc 容器还有有些不方便,有没有办法对某个进程指定不同网关呢
    6 replies    2018-09-29 20:19:53 +08:00
    oovveeaarr
        1
    oovveeaarr  
       Sep 29, 2018   ❤️ 1
    ip rule 就可以实现
    先新增一张路由表
    然后通过 ip rule 设置规则就好了
    cxh116
        2
    cxh116  
       Sep 29, 2018 via Android
    lxc 的网络使用桥接?然后自行配置不同网关?
    zbinlin
        3
    zbinlin  
       Sep 29, 2018
    网络命名空间
    ip netns
    where2go
        4
    where2go  
    OP
       Sep 29, 2018
    @cxh116 你说的这是虚拟机的配置 lxc 和流行的 docker 用的是 #3 说的 网络命名空间
    @zbinlin lxc 也是用的这个方法么, 有具体的操作方法么
    where2go
        5
    where2go  
    OP
       Sep 29, 2018
    @oovveeaarr 请问能说具体点么
    hullopanda
        6
    hullopanda  
       Sep 29, 2018
    策略路由
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1019 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 45ms · UTC 22:40 · PVG 06:40 · LAX 15:40 · JFK 18:40
    ♥ Do have faith in what you're doing.