解决Connecting to 127.0.0.1:7890... failed: Connection refused.

解决Connecting to 127.0.0.1:8118… failed: Connection refused.

错误背景:
安装wsl的Ubuntu20,但是和clash冲突了,关了代理才能上网。

解决:
在/home/用户名/.bashrc上加入:

unset http_proxy
unset https_proxy

同时,为了是的Ubuntu内也能连接代理,在.bashrc加入:

export hostip=$(cat /etc/resolv.conf |grep -oP '(?<=nameserver\ ).*')
export https_proxy="http://${hostip}:7890";
export http_proxy="http://${hostip}:7890";

要让wsl连上主机的代理可以直接使用下面的方法
打开或创建WSL配置文件(位于C:/User/%你的用户名/.wslconfig),并添加以下内容:

[experimental]
autoMemoryReclaim=gradual  
networkingMode=mirrored
dnsTunneling=true
firewall=true
autoProxy=true

参考:
[1] 配置 WSL2 使用 Windows 代理上网 _ https://solidspoon.xyz/2021/02/17/%E9%85%8D%E7%BD%AEWSL2%E4%BD%BF%E7%94%A8Windows%E4%BB%A3%E7%90%86%E4%B8%8A%E7%BD%91/

[2] 解决Connecting to 127.0.0.1:8118… failed: Connection refused.
https://www.cnblogs.com/xiaogongzi/p/12743571.html

[3] https://blog.csdn.net/weixin_62355896/article/details/134458330

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值