More than 254 hosts on the LAN

Folks

I have two questions:

  1. How can I create more than 254 hosts on the LAN and DHCP still dole out the numbers? Is it by giving static IP address to the Lan interface in the format like 192.168.0.1/255.255.254.0
    Will this work?

  2. I have a vlan 1 for lan and vlan 2 for guests. All our devices like TV are on vlan 1 but if any of our guests is using the guest interface (i.e vlan 2) they are unable to chrome cast some interesting video clips they have.... Is there a way for guest zone to chrome cast to lan zone?

Sorry if my questions are stupid.

Thank you.

it should work
subnet /23

IP Address:|192.168.0.1|
Usable Host IP Range:|192.168.0.1 - 192.168.1.254|
Broadcast Address:|192.168.1.255|
Total Number of Hosts:|512|
Number of Usable Hosts:|510|
Subnet Mask:|255.255.254.0|

2 Likes

Awesome. But how will dhcp be configured. By default it says start is 100 but the 100 will come twice. Once in 192.168.0.100 and second time in 192.168.1.100 So what will this point to. And instead of 150 lease default, can we specify 225?

Appreciate help.

Anil

No, it doesn't. You're thinking too hard about it. If all you did was change/ 24 to /23 - it comes once in the same location (i.e. xxx.xxx.0.100 using the above example).

If you realize that, then you simply realize your avaliable limit simply increased by ~256 addresses.

Hope this helps.

Yes, that was your inquiry.

2 Likes

The limit parameter in the DHCP configuration does not refer to the last address octet but to the number of addresses relative to the start offset.

Example:

  • network: 192.168.0.1/23
  • start: 100
  • limit: 400
  • 192.168.0.1/23 = 192.168.0.0~192.168.1.255
  • 192.168.0.0 + 100 = 192.168.0.100 (first lease address)
  • 192.168.0.100 + 400 = 192.168.1.244 (last lease address)
7 Likes

Fantastic explained! Even people like me can understand this. Thank you thank you.

What would happen to these two addresses: 192.168.0.255 & 192.168.1.0
Will they become valid host addresses? As the broadcast will be 192.168.1.255.

Appreciate.

Yes, within a 192.168.0.0/23 CIDR scheme, these would be completely normal host addresses. There might be broken software however which treats *.*.*.0 and *.*.*.255 special, disregarding the actual netmask.

4 Likes

Thank you. Understood, Best to avoid even if technically valid.

You will need to add a dhcpleasemax 250 line to the global dnsmasq configuration. By default dnsmasq will not issue more than 150 dynamic IPs, even if an interface's limit is more than that.

4 Likes

MK25:

There is /etc/config/dhcp and there is /etc/dnsmasq. My /etc/dnsmasq is all commented out. Just add one line at the end or will it go into /etc/config/dhcp ? Please LMK.

root@r6220-GW:/etc# cat dnsmasq.conf 
# Change the following lines if you want dnsmasq to serve SRV
# records.
# You may add multiple srv-host lines.
# The fields are <name>,<target>,<port>,<priority>,<weight>

# A SRV record sending LDAP for the example.com domain to
# ldapserver.example.com port 289
#srv-host=_ldap._tcp.example.com,ldapserver.example.com,389

# Two SRV records for LDAP, each with different priorities
#srv-host=_ldap._tcp.example.com,ldapserver.example.com,389,1
#srv-host=_ldap._tcp.example.com,ldapserver.example.com,389,2

# A SRV record indicating that there is no LDAP server for the domain
# example.com
#srv-host=_ldap._tcp.example.com

# The following line shows how to make dnsmasq serve an arbitrary PTR
# record. This is useful for DNS-SD.
# The fields are <name>,<target>
#ptr-record=_http._tcp.dns-sd-services,"New Employee Page._http._tcp.dns-sd-services"

# Change the following lines to enable dnsmasq to serve TXT records.
# These are used for things like SPF and zeroconf.
# The fields are <name>,<text>,<text>...

#Example SPF.
#txt-record=example.com,"v=spf1 a -all"

#Example zeroconf
#txt-record=_http._tcp.example.com,name=value,paper=A4

# Provide an alias for a "local" DNS name. Note that this _only_ works
# for targets which are names from DHCP or /etc/hosts. Give host
# "bert" another name, bertrand
# The fields are <cname>,<target>
#cname=bertand,bert
dhcp-lease-max=250

Put the option in the first block (config dnsmasq) of the file /etc/config/dhcp.

And the number should be at least 510 not 250 that I posted before. Large numbers of leases should not take a lot of RAM.

3 Likes

Thank you so much, Mike. Appreciate your help.
It will be like:

config dnsmasq
	option domainneeded '1'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/lan/'
	option domain 'lan'
	option expandhosts '1'
	option authoritative '1'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases'
	option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
	option localservice '1'
	option ednspacket_max '1232'
	option dnssec '1'
	option dnsseccheckunsigned '1'
	option cachesize '8192'
        option dhcpleasemax '1000'

Wonderful the solution has been working without any hiccups. Thanks.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.