当前位置: 首页> 科技> 能源 > WLS2(ubuntu22.04)使用windows2的代理上网

WLS2(ubuntu22.04)使用windows2的代理上网

时间:2025/7/15 9:23:24来源:https://blog.csdn.net/bglmmz/article/details/142203164 浏览次数:1次

1. 在wls2中,vim /etc/profile,添加如下配置后,source /etc/profile

```

export hostip=127.0.0.1
export socks_hostport=10800
export http_hostport=10800
alias proxy='
    export https_proxy="https://${hostip}:${http_hostport}"
    export http_proxy="http://${hostip}:${http_hostport}"
    export ALL_PROXY="socks5://${hostip}:${socks_hostport}"
    export all_proxy="socks5://${hostip}:${socks_hostport}"
'
alias unproxy='
    unset ALL_PROXY
    unset https_proxy
    unset http_proxy
    unset all_proxy
'
alias echoproxy='
    echo $ALL_PROXY
    echo $all_proxy
    echo $https_proxy
    echo $http_proxy
'
#end proxy

```

2. 想开代理,就在ubuntu中输入:proxy,想关闭就输入:unproxy,查看输入: echoproxy

3. 打开代理,测试,输入:

```

wget --no-cookie --no-check-certificate  https://www.google.com

```

看到如下输出表示正常:

```

Connecting to 127.0.0.1:10800... connected.
Proxy request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘index.html.2’

index.html.2                                             [ <=>                                                                                                                ]  21.73K  --.-KB/s    in 0.1s

2024-09-13 10:23:17 (181 KB/s) - ‘index.html.2’ saved [22251]

```

关键字:WLS2(ubuntu22.04)使用windows2的代理上网

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: