22 lines
734 B
Bash
22 lines
734 B
Bash
#!/bin/sh
|
|
echo ============================== >> {{script_log_fp}}
|
|
env >> {{script_log_fp}}
|
|
|
|
# create route table if it does not exist
|
|
if [ $(cat /etc/iproute2/rt_tables | grep {{route_table_name}} | wc -l) -eq 0 ]; then
|
|
echo "{{route_table_id}} {{route_table_name}}" >> /etc/iproute2/rt_tables
|
|
fi
|
|
|
|
# populate route table
|
|
ip route flush table {{route_table_name}}
|
|
ip route add ${route_vpn_gateway} dev ${dev} src ${ifconfig_local} table {{route_table_name}}
|
|
ip route add default via ${route_vpn_gateway} table {{route_table_name}}
|
|
|
|
# add vpn_gateway to main route table
|
|
ip route add ${route_vpn_gateway} dev ${dev} src ${ifconfig_local}
|
|
|
|
|
|
#ip rule add from ${ifconfig_local} table {{route_table_name}} pref {{rule_pref}}
|
|
|
|
exit 0
|