You could implement a delegating handler (docs) and throw an exception if the IP address doesn't match.
You can inject the HttpContext in the constructor - IHttpContextAccessor - and then get the source address by using httpContext.Connection.RemoteIpAddress?.ToString(), it's not bullet proof though.
Specifications
TargetFramework: net6.0 Ocelot Version: 17.0.0
Description
Is there any feature to restrict a route so that only specific IP addresses will be able to access it?