【问题标题】:Using other Network Interface for apt使用其他网络接口进行 apt
【发布时间】:2019-10-12 04:30:18
【问题描述】:

我的情况如下:

我通过 eth0 连接到我们的数据中心。有一个代理可以上网,但确实受到限制。 使用 wlan0,我在我们的非代理环境中,我无法访问我们的数据中心。

我的问题:我不想在 eth0 接口上使用 apt-get,因为我们的内部 apt 镜像不支持我的本地 ubuntu 版本并且它按设计工作,我得到一个网络无法访问的错误。 我想在 wlan0 接口上使用 apt-get install,因为它可以不受限制地连接到 Internet。但是不要关闭 et0,因为我不想重新启动到我们数据中心的所有会话。

【问题讨论】:

    标签: ubuntu interface proxy apt


    【解决方案1】:

    尝试以下方法:

    # Add a new namespace called test_ns
    ip netns add aptwifi
    
    # Set test to use eth0, after this point eth0 is not usable by programs
    # outside the namespace
    ip link set wlan0 netns aptwifi
    
    # Bring up eth0 inside test_ns
    ip netns exec aptwifi ip link set wlan0 up
    
    # Use dhcp to get an ipv4 address for eth0
    ip netns exec aptwifi dhclient wlan0
    
    # Ping google from inside the namespace
    ip netns exec aptwifi apt update
    

    来源:https://unix.stackexchange.com/questions/210982/bind-unix-program-to-specific-network-interface

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-04-23
      • 2012-11-20
      • 1970-01-01
      • 1970-01-01
      • 2016-07-08
      • 1970-01-01
      • 2021-06-01
      • 1970-01-01
      相关资源
      最近更新 更多