Many colleges use Cyberoam to add login system so that everyone connected to network must supply username and password first and Cyberoam can also be used to block websites. I also want to add such kind of system. Suggest some free alternatives.
You can also setup a RADIUS server to add authentication, though it means using a dedicated machine/computer that all devices connect to fit networking and internet access. http://www.nowiressecurity.com/articles/radius_8021x_wireless_authentication_servers.htm
PacketFence is a free Network Access Control solution
The easiest way to realize this is probably the inline installation (as a gateway) which means you need a Linux machine with PacketFence installed that has two network interfaces, one connecting your network (switch, router, access points) and the other connecting to the internet.
If you have a router-modem combo then this won't be possible as the modem needs to be connected directly. It does offer other deployment options (via VLANs) for such cases but I haven't looked at them so I can't give you more details on how this would work or which requirements need to be met ~ looking into it's Documentation should answer that.
Another option for DD-WRT compatible routers is it's Captive Portal feature