I need to rate limit an API server. Is it possible to configure a machine to rate limit requests per MAC address? If not, are there any other viable options?
I want to rate limit per MAC, because multiple users could share one IP.
I need to rate limit an API server. Is it possible to configure a machine to rate limit requests per MAC address? If not, are there any other viable options?
I want to rate limit per MAC, because multiple users could share one IP.
MAC addresses are purely an OSI Layer 2 phenomena. Once a packet passes through a router, MAC address information from the source machine is no longer available.
So as the above person commented, if you're only offering this service to internal users, and those users as well as the service itself are all on the same Layer 2 network, then this might be possible. That seems highly unlikely, though. Conversely, if your users are scattered around the internet, then you'll need to use some other rate limiting scheme (IP, API key, etc.).
You need to redesign your application.
You can't rate limit by MAC address because you have absolutely no way to obtain the user's MAC address, since you are not on the user's local network.
The way everyone else does this is to issue unique API keys to each individual user, and then to rate limit usage by API key.