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 

  • 相关阅读:
    node.js学习
    CSS3——3D效果
    解决HTML5布局,兼容IE问题
    Java 反射调用的一种优化
    jQuery中常用正则表达式
    8种NoSql数据库系统对比
    Java的ClassLoader机制
    Maven / Nexus 的用法和经验
    Spring中BeanFactory和ApplicationContext的区别
    Spring Bean的作用域
  • 原文地址:https://www.cnblogs.com/xuyaowen/p/ssh-bind-interface.html
Copyright © 2011-2022 走看看