#!/bin/bash

# 添加路由表
if ! grep -q "custom_table" /etc/iproute2/rt_tables; then
    echo "1    custom_table" >> /etc/iproute2/rt_tables
fi

# 添加路由,将gwip替换为国内IP的网关IP，eth1替换为国内IP对应的网卡
ip route add default via gwip dev eth1 table custom_table

# 添加规则，将cnip替换为国内IP
ip rule add from cnip table custom_table