diff --git a/scripts/clash.sh b/scripts/clash.sh index 0398793..f96bcbc 100644 --- a/scripts/clash.sh +++ b/scripts/clash.sh @@ -670,7 +670,7 @@ setipv6(){ setfirewall(){ set_cust_host_ipv4(){ echo ----------------------------------------------- - echo -e "当前已自动设置透明路由的网段为: \033[32m$(ip a 2>&1 | grep -w 'inet' | grep 'global' | grep 'br' | grep -v 'iot' | grep -E ' 1(92|0|72)\.' | sed 's/.*inet.//g' | sed 's/br.*$//g' | tr '\n' ' ' && echo ) \033[0m" + echo -e "当前已自动设置透明路由的网段为: \033[32m$(ip a 2>&1 | grep -w 'inet' | grep 'global' | grep 'br' | grep -v 'iot' | grep -E ' 1(92|0|72)\.' | sed 's/.*inet.//g' | sed 's/br.*$//g' | sed 's/metric.*$//g' | tr '\n' ' ' && echo ) \033[0m" echo -e "当前已添加的自定义网段为:\033[36m$cust_host_ipv4\033[0m" echo ----------------------------------------------- echo -e "\033[33m自定义网段不会覆盖自动获取的网段地址,无需重复添加\033[0m" diff --git a/scripts/start.sh b/scripts/start.sh index ab610fa..50a5ed3 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -141,7 +141,7 @@ mark_time(){ getlanip(){ i=1 while [ "$i" -le "10" ];do - host_ipv4=$(ip a 2>&1 | grep -w 'inet' | grep 'global' | grep 'br' | grep -Ev 'iot|metric' | grep -E ' 1(92|0|72)\.' | sed 's/.*inet.//g' | sed 's/br.*$//g' ) #ipv4局域网网段 + host_ipv4=$(ip a 2>&1 | grep -w 'inet' | grep 'global' | grep 'br' | grep -Ev 'iot' | grep -E ' 1(92|0|72)\.' | sed 's/.*inet.//g' | sed 's/br.*$//g' | sed 's/metric.*$//g' ) #ipv4局域网网段 [ "$ipv6_redir" = "已开启" ] && host_ipv6=$(ip a 2>&1 | grep -w 'inet6' | grep -E 'global' | sed 's/.*inet6.//g' | sed 's/scope.*$//g' ) #ipv6公网地址段 [ -f $TMPDIR/ShellClash_log ] && break [ -n "$host_ipv4" -a -n "$host_ipv6" ] && break @@ -715,6 +715,7 @@ start_output(){ #设置dns转发 [ "$dns_no" != "已禁用" ] && { iptables -t nat -N clash_dns_out + iptables -t nat -A clash_dns_out -m owner --gid-owner 453 -j RETURN #绕过本机dnsmasq iptables -t nat -A clash_dns_out -m owner --gid-owner 7890 -j RETURN iptables -t nat -A clash_dns_out -p udp -s 127.0.0.0/8 -j REDIRECT --to $dns_port iptables -t nat -A OUTPUT -p udp --dport 53 -j clash_dns_out @@ -880,7 +881,7 @@ start_nft(){ [ "$local_proxy" = "已开启" ] && [ "$local_type" = "nftables增强模式" ] && { #dns nft add chain inet shellclash dns_out { type nat hook output priority -100 \; } - nft add rule inet shellclash dns_out meta skgid 7890 return && \ + nft add rule inet shellclash dns_out meta skgid {453,7890} return && \ nft add rule inet shellclash dns_out udp dport 53 redirect to $dns_port #output nft add chain inet shellclash output { type nat hook output priority -100 \; }