使用 Brook 两条命令把任意 Linux 变成路由器

https://www.txthinking.com/talks/
Updated at: 2023-03-19
cloud@txthinking.com

x

Text to Image 生成

需要

一个使用有线网络的 Linux,比如 Ubuntu,推荐先配置一个静态 IP,比如 192.168.1.10

理论上,虚拟机也可以。使用有线网络的 macOS 或 Windows 是宿主机,里面安装一个虚拟机 Ubuntu,但是性能可能不好。

关闭占用 53 端口的 systemd-resolved

systemctl stop systemd-resolved
systemctl disable systemd-resolved
echo nameserver 8.8.8.8 > /etc/resolv.conf

把 Linux 变成网关

brook tproxy --link 'brook://...' --dnsListen :53

然后把其他机器的 DNS 和 网关都配置成这台 Linux 的 IP 即可

把 Linux 变成 DHCP Server

😡 关闭局域网里的其他 DHCP 服务,比如关闭你的硬件路由器的 DHCP 功能

brook dhcpserver --serverip 192.168.1.10 --start 192.168.1.100 --gateway 192.168.1.10 --dnsserver 192.168.1.10