forked from saratov/infra
13 lines
487 B
Django/Jinja
13 lines
487 B
Django/Jinja
#!/usr/bin/env bash
|
|
if ip rule show | grep -q 'from {{item|ipaddr('address')}}/{{item|ipaddr('prefix')}} lookup tbl_{{nic.key}}'; then
|
|
echo "already exists"
|
|
else
|
|
ip rule add from {{item|ipaddr('address')}}/{{item|ipaddr('prefix')}} lookup tbl_{{nic.key}}
|
|
fi
|
|
|
|
if ip r sh ta all | grep 'default via {{nic.value.default}} dev {{nic.key}} table tbl_{{nic.key}}'; then
|
|
echo "already exists"
|
|
else
|
|
ip route add default via {{nic.value.default}} dev {{nic.key}} table tbl_{{nic.key}}
|
|
fi
|