I have a linux vpn server. It also used as a BGP router, so it routes many subnets.
I use ccd to give to each of my clients special ips or networks they buy.
So now if clilent buys three IPs a put in his ccd:
ifconfig-push IP1 vpn_gate_ip
iroute IP2 255.255.255.255
iroute IP3 255.255.255.255
And then to make them work on the client besides the up script i have:
/sbin/ip rule add from $4 table vpn
/sbin/ip ro ad default via $5 table vpn
... which forces the packet with src ip equals to vpn ip to go throught the vpn tunnel,
i have to add to the up script additional the policy routing rules and ifconfig directives:
/sbin/ip rule add from IP2 table vpn
/sbin/ip rule add from IP3 table vpn
/sbin/ifconfig tun0:0 IP2
/sbin/ifconfig tun0:1 IP3
And every time i change these IPs in ccd i have to go to the client, correct the up script by removing old ips, adding new ones.
Also if the entire network is iroute`d to the client i do not have to call ifconfig commands because client will do it hisself. I need only to execute "ip rule"
So somehow on the client i need to get all iroute directives which has been added to his ccd file and then according to the netmask perform needed actions.