Files
notebook/docs/技术/旁路由使用/macOS.md
T

69 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# macOS 旁路由使用指南
---
## 接入旁路由
### 1. 设置 DNS(去广告)
1. 打开 **系统设置 → 网络**
2. 选择当前连接的网络(WiFi 或以太网)
3. 点击 **详细信息 → DNS**
4. 点击 **+**,添加:
```
旁路由 IP(如 192.168.31.112
```
5. 再添加备用 DNS`223.5.5.5`
6. 点击 **好**
### 2. 关闭浏览器 DNS over HTTPS
- **Chrome**:设置 → 隐私和安全 → 安全 → 高级 → 关闭 **使用安全 DNS**
- **Safari**Safari 默认使用系统 DNS,无需额外设置
### 3. 设置系统代理(翻墙)
需要翻墙时开启:
1. 打开 **系统设置 → 网络**
2. 选择当前连接 → **详细信息 → 代理**
3. 开启 **SOCKS 代理**,填写:
| 字段 | 值 |
|------|-----|
| SOCKS 代理服务器 | `旁路由 IP`(如 `192.168.31.112` |
| 端口 | `7890` |
4. 点击 **好**
?> 不需要翻墙时关掉即可。也可以使用 **SwitchyOmega**(Chrome 扩展)按规则自动切换,国内网站不走代理。
---
## 终端代理(可选)
```bash
# 临时开启
export ALL_PROXY=socks5://旁路由IP:7890
# 写入 ~/.zshrc 持久化
echo 'alias proxy="export ALL_PROXY=socks5://旁路由IP:7890"' >> ~/.zshrc
echo 'alias unproxy="unset ALL_PROXY"' >> ~/.zshrc
```
---
## 验证
```bash
# 测试代理是否通
curl --socks5 旁路由IP:7890 https://www.google.com -o /dev/null -s -w '%{http_code}'
# 返回 200 → 正常
# 测试 DNS 去广告
nslookup doubleclick.net
# 返回 0.0.0.0 → 广告域名已被拦截
```