From 79aa91da41cc581a145fc4f3117a7214092b73c7 Mon Sep 17 00:00:00 2001 From: xjasonlyu Date: Sun, 7 Feb 2021 10:06:43 +0800 Subject: [PATCH] Chore: optimize docker entrypoint.sh --- docker/entrypoint.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 6a62294..548ecf3 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -39,9 +39,14 @@ config_route() { # policy routing tun=$(ip -4 addr show "$TUN_IF" | awk 'NR==2 {print $2}') eth=$(ip -4 addr show "$ETH_IF" | awk 'NR==2 {split($2,a,"/");print a[1]}') - ip rule add from "$eth" to "$tun" priority 1000 prohibit - ip rule add from "$eth" priority 2000 table main - ip rule add from all priority 3000 table "$TABLE" + ip rule add from "$eth" to "$tun" priority 9998 prohibit + ip rule add from "$eth" priority 9999 table main + ip rule add from all priority 10000 table "$TABLE" + + # reserved IP addresses + ip rule add to 0.0.0.0/8 table main + ip rule add to 192.0.2.0/24 table main + ip rule add to 224.0.0.0/4 table main # add tun included routes for addr in $(echo "$TUN_INCLUDED_ROUTES" | tr ',' '\n'); do