Skip to content

Commit

Permalink
fix: ip route on darwin when enable tun2socks
Browse files Browse the repository at this point in the history
  • Loading branch information
nange committed Dec 15, 2024
1 parent 9d5c38b commit 91bb4c6
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions scripts/create_tun_dev_darwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ local_gateway_v6=$8

# create tun device
ifconfig "$tun_device" "$tun_ip" "$tun_gw" up
ifconfig "$tun_device" inet6 "$tun_ip_v6" "$tun_gw_v6" up
ifconfig "$tun_device" inet6 "$tun_ip_v6"/64 up

# add ipv4 ip route
route add -net 1.0.0.0/8 "$tun_gw"
Expand All @@ -23,10 +23,8 @@ route add -net 64.0.0.0/2 "$tun_gw"
route add -net 128.0.0.0/1 "$tun_gw"
route add -net 198.18.0.0/15 "$tun_gw"

route add "$local_gateway" "$tun_gw"

if [ -n "$server_ip_v6" ]; then # check if server_ip_v6 is not empty
# add ipv6 ip route
route add -inet6 -net ::/0 -gateway "$tun_gw_v6"
route add -inet6 -net "$local_gateway_v6" -gateway "$tun_gw_v6"
fi

0 comments on commit 91bb4c6

Please sign in to comment.