[K2P /tmp]# cat on.sh 
nvram set vpnc_enable=1
nvram set vpnc_fw_enable=1
nvram set vpnc_fw_rules=0
#/etc/storage/vpnc_server_script.sh up
/usr/sbin/pppd file /tmp/ppp/options.vpnc
sleep 5
./1.sh up
#!/bin/sh
# 动态添加默认路由到 PPP 接口
sleep 5
# 获取当前的 PPP 接口名称
interface=$(ifconfig | grep -o "ppp[0-9]*" | tail -n 1)

# 检查接口是否存在
if [ -z "$interface" ]; then
    echo "No PPP interface found. Exiting..."
    exit 1
fi

echo "Detected PPP interface: $interface"

# 获取本地 IP 和远程网关 IP
local_ip=$(ifconfig $interface | grep 'inet ' | sed -n 's/.*addr:\([0-9.]*\).*/\1/p')
remote_ip=$(ifconfig $interface | grep 'inet ' | sed -n 's/.*P-t-P:\([0-9.]*\).*/\1/p')

# 打印调试信息
echo "网卡名称: $interface"
echo "本地Local IP: $local_ip"
echo "远程Remote IP (Gateway): $remote_ip"
echo "Adding custom route: default via $remote_ip dev $interface 128.0.0.0/1..."
ip route add default via $remote_ip dev $interface metric 0 proto static
ip route add 128.0.0.0/1 via $remote_ip dev $interface metric 0 proto static
#ip route add default via $remote_ip dev $interface
#/etc/storage/vpnc_server_script.sh up
#./1.sh up
