安装依赖
Libsodium加解密库
地址 https://github.com/jedisct1/libsodium
root权限运行:
./autogen.sh -> ./configure -> make -> make install
OpenSSL库
官网 https://www.openssl.org
git clone https://github.com/openssl/openssl.git
root权限运行:
. / Configure darwin64-x86_64-cc -> make -> make install
安装Pcap_DNSProxy
地址:https://github.com/chengr28/Pcap_DNSProxy
增加cmake的include/link路径,因为依赖安装在/usr /local /下,所以要在Source/Pcap_DNSProxy/CMakeLists.txt 文件开头加上:
include_directories("/usr/local/include/")
link_directories("/usr/local/lib/")
进入目录Source / Auxiliary / Scripts,root权限运行:
chmod 755 CMake_Build.sh
./CMake_Build.sh
编译成功后,生成Source/Release/目录及相应程序,此时修改Source/Release/pcap_dnsproxy.service.plist ,把其中程序路径及目录修改为全路径:
/.../Pcap_DNSProxy/Source/Release/Pcap_DNSProxy
/.../Pcap_DNSProxy/Source/Release/
chmod 755 macOS_Install.sh
./macOS_Install.sh
脚本macOS_Install.sh所进行的操作:
* 设置程序、脚本以及 plist 配置文件的基本读写执行权限
* 装载并启动守护进程服务
* 以后每次开机在登录前守护进程服务都将自动启动
打开 "系统偏好设置" 窗口
* 进入 "网络" 部分
* 选中使用的网络适配器,点击 "高级" 按钮
* 切换到 "DNS" 选项卡,并点击 "DNS服务器" 下的 "+" 号
* 输入 127.0.0.1(IPv4)/::1(IPv6)
* 请务必确保只填入这两个地址,填入其它地址可能会导致系统选择其它 DNS 服务器绕过程序的代理
* 按 "好" 再按 "应用" 即可
Reboot service method:
1. Open the terminal, use sudo -i to get the root permission and go to the / Library / LaunchDaemons directory
2. Use the launchctl unload pcap_dnsproxy.service.plist to stop the service, wait a while
3. Use launchctl load pcap_dnsproxy.service.plist to start the service
dnsmasq 安装与配置
采用brew安装,配置文件在/usr/local/etc/dnsmasq.conf
启动服务:sudo brew services start dnsmasq