You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#nat
no nat log on $ext_if1 from $local_ip to any
nat log on $ext_if1 from $lan_net to any -> $ext_if1
nat log on $ext_if2 from $lan_net to any -> $ext_if2
pass in log on $ext_if1 route-to ($ext_if2 $ext_gw2) proto {tcp udp} from any to {!<BYPASS_SNET> } port {80 443}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
#download chinaip
https://raw.githubusercontent.com/17mon/china_ip_list/master/china_ip_list.txt
#tun2socks
https://github.com/xjasonlyu/tun2socks/releases/download/v2.4.1/tun2socks-darwin-amd64.zip
https://github.com/xjasonlyu/tun2socks/releases/download/v2.4.1/tun2socks-darwin-amd64-v3.zip
https://github.com/xjasonlyu/tun2socks/wiki/Examples#macos
sudo ./tun2socks-darwin-amd64 -device utun123 -proxy socks5://127.0.0.1:1080 -interface en0
sudo ifconfig utun123 198.18.0.1 198.18.0.1 up
pf.conf
#skip lo0
set skip on lo0
#china ip table
table <BYPASS_SNET> persist file "./china_ip_list.txt"
#ip
#本机 ip
local_ip= "192.168.1.2"
#局域网段
lan_net = "192.168.1.3/24"
#本机局域网上网接口
ext_if1 = "en0"
#网关 ip
ext_gw1 = "192.168.1.1"
#tun2socks
ext_if2 = "utun123"
ext_gw2 = "198.18.0.1"
#nat
no nat log on $ext_if1 from $local_ip to any
nat log on $ext_if1 from $lan_net to any -> $ext_if1
nat log on $ext_if2 from $lan_net to any -> $ext_if2
pass in log on $ext_if1 route-to ($ext_if2 $ext_gw2) proto {tcp udp} from any to {!<BYPASS_SNET> } port {80 443}
#加载生效 pf 规则
sudo pfctl -e -f pf.conf
#pflog0
sudo ifconfig pflog0 create
sudo tcpdump -n -e -ttt -i pflog0
保证 dns 结果正确
把 lan 其它设备的网关设置为 macos ip 就可以了
Beta Was this translation helpful? Give feedback.
All reactions