1、背景:
hyper-v虚拟机安装Ubuntu,需要在cmd命令下连接ssh,并走主机的代理
2、cmd连接ssh命令:
ssh {ubuntu的用户名}@{Ubuntu的ip地址}
注意这里的
{ubuntu的用户名}是我们安装Ubuntu时配置的用户名
{ubuntu的IP地址} 需要在ubuntu里,通过 ifconfig 命令查看ip
3、开启主机的“允许局域网代理”,如图:
4、ssh中执行命令:
export http_proxy=http://{ip地址}:7890
export https_proxy=http://{ip地址}:7890
注意:这里的 {ip地址} 是指主机的IP地址
5、测试是否连通:
curl www.google.com
有响应即代表走的连上代理
6、取消代理:
unset http_proxy
unset https_proxy