(I'm not a network guy, so please humor me.)
I want to configure a typical consumer router as an open hotspot. However, the router's internet connection has limited bandwidth. Therefore, I'd like to limit how many people can connect to it simultaneously.
I could set DHCP to hand out a small number of addresses, but additional users could still connect if they specified their own IP address. So I'd rather set a hard limit.
I'm wondering if a subnet mask will do the trick. I (sort of) understand that subnet masks are a way of telling the network section of an IP address from the host part, and I think that means I can limit the number of possible addresses, and therefore users, on the router. So:
- Can I do this?
- Might it screw something else up?
- Is anyone patient enough to list the possible subnet masks and how many users would be able to connect for each one?
Update
The list I was looking (sorry, I wasn't very clear) was this: if the first three octets are 255.255.255, what are the possible netmasks and how many hosts they support? I found this from the link Eddy provided. Answer:
- 255.255.255.0: 254 hosts
- 255.255.255.128: 126 hosts
- 255.255.255.192: 62 hosts
- 255.255.255.224: 30 hosts
- 255.255.255.240: 14 hosts
- 255.255.255.248: 6 hosts
- 255.255.255.252: 2 hosts
- 255.255.255.254: 0 hosts
- 255.255.255.255: 0 hosts
Several of you have pointed out that limiting users is not the same as limiting bandwidth. It's a good point, but in this case, I'm just concerned with limiting the number of concurrent users.
So, my question again: if I simply assign one of the netmasks above to the router, will it restrict the number of possible users effectively, as listed above? Might it screw something else up?
Google found this, nifty subnet calculator
A small subnet will limit the number of concurrent users - people trying to hijack addresses may cause problems with duplicate IP addresses. It comes down to how hard you want to limit usage, and how hard people will work to overcome the measures you implement.
Quality of service will go a long ways to helping share the available bandwidth. Google found this link that will give you an idea on whats available.
With wireless it's easy enough to spoof/change mac addresses but you could come up with some scripts to monitor active mac addresses and limit them with iptables and some restrictive qos classes.
Edit To answer the updated question: "if I simply assign one of the netmasks above to the router, will it restrict the number of possible users effectively, as listed above? Might it screw something else up?"
Two things to watch when you do this:
Limiting the number of users that can connect is not the most effective way of limiting bandwidth. What if you have only 2 users connected but one of them is downloading a 500MB file? Limiting the number of connected users does nothing to limit the bandwidth utilization of each connected user. My suggestion would be to find a way to limit the bandwidth utilization of each user. You could try something like NetLimiter running on a gateway machine.
http://www.netlimiter.com/
If you aren't willing to implement a business class system that can allow (free) access with a small registration, then I'd suggest your best bet is to use the DHCP plan AND narrow down the subnet. Set a short lease time of 10-20 minutes. Once all DHCP addresses are used, no others will be given out. people would have to guess the IP range and even then, run the risk of creating an IP conflict.
The big problems you have are
So the result won't be "users have to take turns" it will be a few users getting online at the start of the day and after that most users being unable to connect most of the time for no obvious reason.
1) Yes
2)
Firstly, you must subtract one ip from maximum available hosts, because it will be the IP of your router.
AP can hold only limited number of hosts, otherwise it will start to malfunction.
Limiting by subnetting will work only, if all IP's will be given by DHCP. And you will have to minimize lease time.
You would better limit users by speed(shaping) and by number of concurrent connections(10-20)
Check these links about building wi-fi hot spot and special software: first and second
Can I use a subnet mask to limit the number of users on a router?
with the help, of a subnet mask, you can limit the number of users in the network let's suppose if you want only 14 hosts in the network then you give the CIDR value /28, subnet mask = 255.255.255.240, 2^4=16 (subnet), and 2^4-2 = 14 (hosts). In this subnet mask, only 14 hosts can connect to the network. So yes, By using the subnet mask we can limit the number of users on a router.