zoukankan      html  css  js  c++  java
  • ssh 使用指定网卡 连接特定网络

    有时候,当电脑有两个网卡时;一个网卡 连接免费网络,一个网卡连接收费网络。这样当你想使用免费网络与远程服务器建立连接,使用诸如scp命令或者 ssh 隧道之类传输大文件。这时候你需要指定特定的特定的网卡来建立连接了。

    ssh 中 有一个选项可以绑定特定的interface 我们使用 man ssh 查看手册可以看到:

     -B bind_interface
                 Bind to the address of bind_interface before attempting to connect to the destination host.  This is only useful on systems with more than one address.

    可见,使用 ssh -B 选项,可以指定特定的网卡;

    另外还有个选项 -b 可以指定 数据包的源地址 也相当于绑定了网卡。因为 macos 上 ssh 没有 -B 选项;总之具体情况,具体对待吧。更权威的使用方式还是查找文档。

    -b bind_address
                 Use bind_address on the local machine as the source address of the connection.  Only useful on systems with more than one address.

    我在实验室环境测试成功。如果您有什么问题,欢迎留言讨论。

    保持更新,转载请注明出处。更多关于 网络和系统的博客,请关注 cnblogs.com/xuyaowen 

  • 相关阅读:
    HDOJ 1028 母函数分析
    尼姆博弈的典型例题
    HDOJ1232 畅通工程 DFS
    第一个八皇后
    HDOJ 1242
    我的“插入算法”实现
    第五讲 this 类变量 类方法
    我的“二分查找算法”实现
    我对锤子ROM 功能的看法——视觉篇
    第六讲 Java 四大特性:抽象 封装 继承 多态
  • 原文地址:https://www.cnblogs.com/xuyaowen/p/ssh-bind-interface.html
Copyright © 2011-2022 走看看