分类 Linux 下的文章

最近在使用 chatgpt 中发现 ios 端无法登录 app,网页端正常使用。提示信息为:

Something went wrong. You may be connected to a disallowed ISP If youare using VPN, try disabling it. Otherwise try a different Wi-Fi network or data connection。

经过查询发现是我的 vps 服务商只提供网页端 chatgpt 解锁,不支持 app 端。由于 chatgpt 服务也是通过 cloudflare 的 cdn 服务,所以通过将流量转发到 warp 来访问就可以解决问题。

首先需要在服务端安装官方的 warp 命令行工具:warp-cli。

官方教程:https://developers.cloudflare.com/warp-client/get-started/linux/

官方手动添加包仓库教程:https://pkg.cloudflareclient.com/#ubuntu

阅读全文


最近在使用一些服务的时候发现流量没有正确的按照设定的规则走,发现部分网站已经优先支持 quic 也就是 http3 协议了,而这种协议目前一些客户端无法正确解析。解决方法就是将 quic 流量屏蔽掉,让那些网站强制走 http 或 http2 即可。

quic 协议走的是 udp 层,一般是 443 或 80 端口。

openwrt 或其他 linux 系统上使用 nftables 设置规则即可:

新建路由表
nft add table ip tabletest

# 局域网流量屏蔽
# 局域网流量目标地址是外部地址时传输路径为 prerouting -> forward -> postrouting hooks
nft add chain ip tabletest prerouting { type nat hook prerouting priority 0 \; policy accept \; }
nft add rule ip tabletest prerouting udp dport { 80, 443 } drop

# 本机网关流量屏蔽
# 本机网关流量目标地址时外部地址时传输路径为 本机 -> output -> postrouting hooks
nft add chain ip tabletest output { type nat hook output priority 0 \; policy accept \; }
nft add rule ip tabletest output udp dport { 80, 443 } drop

在 Chrome 中禁用 HTTP/3:

  • 打开 Chrome 浏览器
  • 在地址栏输入 chrome://flags 并按回车。
  • 在搜索框中输入 quic。
  • 将 Experimental QUIC protocol 设置为 Disabled。
  • 重启浏览器。

在 Firefox 中禁用 HTTP/3:

  • 打开 Firefox 浏览器。
  • 在地址栏输入 about:config 并按回车。
  • 接受风险提示。
  • 搜索 network.http.http3.enabled。
    -将其值设置为 false。

一键替换命令:

# 清华源
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

# 阿里源
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/

# 腾讯源
pip config set global.index-url http://mirrors.cloud.tencent.com/pypi/simple

# 豆瓣源
pip config set global.index-url http://pypi.douban.com/simple/

# 换回默认源
pip config unset global.index-url


最近升级路由器系统到 openwrt 23,发现 dnsmasq-full 已经默认不支持 ipset 转而支持 nftset 了,所以之前的教程:通过 dnsmasq ipset 和 iptables 对域名流量的控制 已经不适用新版本系统。

下面介绍如何通过 nfset 和 nftables 实现同样的功能。

首先查看 dnsmasq 版本是否支持 nftset:

root@OpenWrt:~# dnsmasq -v
Dnsmasq version 2.90  Copyright (c) 2000-2024 Simon Kelley
Compile time options: IPv6 GNU-getopt no-DBus UBus no-i18n no-IDN DHCP DHCPv6 no-Lua TFTP conntrack no-ipset nftset auth cryptohash DNSSEC no-ID loop-detect inotify dumpfile

阅读全文