mirror of
https://github.com/juewuy/ShellCrash.git
synced 2026-09-08 13:46:33 +00:00
~优化新手引导中启用IP转发的提示及实现逻辑
This commit is contained in:
@@ -75,10 +75,13 @@ forwhat() {
|
||||
if [ "$(cat /proc/sys/net/ipv4/ip_forward)" = "0" ]; then
|
||||
separator_line "-"
|
||||
content_line "\033[33m$UG_IP_FORWARD_WARN\033[0m"
|
||||
[ "$systype" = 'container' ] && content_line "\033[31m$UG_CONTAINER_WARN\033[0m"
|
||||
read -r -p "$COMMON_INPUT_R" res
|
||||
[ "$res" = 1 ] && {
|
||||
echo 'net.ipv4.ip_forward = 1' >>/etc/sysctl.conf
|
||||
sysctl -w net.ipv4.ip_forward=1
|
||||
grep -q '^net\.ipv4\.ip_forward' /etc/sysctl.conf \
|
||||
&& sed -i 's/^net\.ipv4\.ip_forward.*/net.ipv4.ip_forward = 1/' /etc/sysctl.conf \
|
||||
|| echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.conf
|
||||
sysctl -p /etc/sysctl.conf
|
||||
}
|
||||
fi
|
||||
# 禁止docker启用的net.bridge.bridge-nf-call-iptables
|
||||
|
||||
Reference in New Issue
Block a user