The question remians, where are you getting the routes from? Are you manually putting them in? Are you trying to prevent users on the network from using certain default gateways? Are you wanting your router to not use certain gateways?
I have just one router (with the name ROUTER_A) which users connect to it . The users routes assigned by radius .
In normal situation when a user connected to ROUTER_A we can see this route on ROUTER_A
# DST-ADDRESS PREF-SRC GATEWAY DISTANCE
0 ADS 111.111.173.4/30 111.112.42.50 1
But when the user contract it expired, the radius assigns following route to that user
# DST-ADDRESS PREF-SRC GATEWAY DISTANCE
0 ADS 111.111.173.4/30 172.16.30.12 1
Note: users are connected with pppoe and the gateway ip is dynamic ip from a pool in radius . If user does not have framed-route assigned , then everything work fine because we have a firewall rule to prevent 172.16.30.0/24 dropped . But if the user has framed-route assigned , then firewall could not see that traffic .
The only traffic a router can control is traffic that goes over it. If traffic never goes through/to a router, it has no knowldege of it and cannot do anything about it. So if you are trying to prevent users from having different default gateways than your router, you need to lock down the layer2 network in such a way that the only host they can talk to is your router. If a user does not use your router as their next hop, then there is nothing you can do inside of the router to prevent that.
No this is not the problem . All users connect to ROUTER_A , i want to block them in ROUTER_A if the assigned route in the ROUTER_A contains the gateway ip in range 172.16.30.0/24 . So this is the traffic which goes through the ROUTER_A .
If you are trying to prevent your router from using certain gateways, you need to answer how those routes are being installed and control that. If not through a routing facility, but through something like PPP or RADIUS, then you need to modify the device that is giving you those routes so they match what you want.
Unfortunately changing in radius is not an option but the ppp is ROUTER_A and i want exactly that .
Otherwise you need to manually add a route that either has a smaller weight, or is more specific than the ones recieved and point it to the gateway you want to use.
How ? This is what i tried but no success . Creating the routes are based on src-address or dst-address etc which is variable and unknown here . The only known parameter is the gateway ip which assigned to user !!!