Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

(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?

share|improve this question

4 Answers 4

up vote 2 down vote accepted

Is anyone patient enough to list the possible subnet masks and how many users would be able to connect for each one?

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:

  • Account for the IP addresses of the Access Point and Internet Gateway (if the gateway is a different box) when deciding how many hosts to allow.
  • Make sure that the DHCP service will assign addresses with the correct starting address (eg, if your network starts at zero and only has room for 12 hosts, then have the dhcp service start assigning addresses within the range). I would expect the access point to do this automagically but it's something to check.
share|improve this answer
    
Thanks for the link - I can derive the list I was looking for from there. Updating my question. –  Nathan Long Nov 23 '09 at 15:49

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/

share|improve this answer
    
This is a very good point, but not applicable to my situation for two reasons: I can't use a gateway machine, and the actual requirement I've been handed is "limit the number of concurrent users." So even if it's not the best strategy (which I can try to point out), those are the orders I have to follow. –  Nathan Long Nov 23 '09 at 16:02
    
@Nathan: Understood. Thanks for the clarification. Any of the first 6 subnets will work for you, dependent on how many users you want to be simultaneuosly connected. –  joeqwerty Nov 23 '09 at 16:52
    
@joequerty - so doing this will not have unintended side effects for the connected users? –  Nathan Long Nov 23 '09 at 16:59

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.

share|improve this answer
    
What would the short lease time mean? That after that time period, the user would have to ask for a new IP address? If so, wouldn't that imply that they might lose access unexpectedly? –  Nathan Long Nov 23 '09 at 15:59
    
Leases are renewed transparent to the user. There is no interruption –  MDMarra Nov 23 '09 at 16:14
    
Right, but if the number of users is limited, maybe while the user was reading a web page, somebody else got their IP address. Right? –  Nathan Long Nov 23 '09 at 16:23
    
possible, but generally unlikely unless you have a very active site. –  quack quixote Nov 23 '09 at 16:28

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.