科技 > 操作系统 > Linux

ssh 使用指定网卡 连接特定网络

517人参与2019-08-13

有时候,当电脑有两个网卡时;一个网卡 连接免费网络,一个网卡连接收费网络。这样当你想使用免费网络与远程服务器建立连接,使用诸如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 

您对本文有任何疑问!!点此进行留言回复

推荐阅读

猜你喜欢

一些公司还在用的版本控制Svn部署

04-06

用Monit监测Linux 服务器

03-21

VMware中某个虚拟机卡死,单独关闭某个虚拟机的办法

06-15

每天3分钟操作系统修炼秘籍(17):进程间通信(3):套接字

11-18

2018年7月10日

07-12

Linux:Gentoo系统的安装笔记(二)

09-12

Ubuntu 12.10下安装 Oracle Java分享教程

03-19

在Linux系统中使用LFTP的教程

11-08

热门评论