Getting incorrect IP addresses from DHCP

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Author Message
iwootiwoot
DD-WRT Novice


Joined: 06 Jan 2017
Posts: 17

PostPosted: Mon Mar 02, 2020 16:39    Post subject: Getting incorrect IP addresses from DHCP Reply with quote
Hi all.

As the title says. I am getting incorrect IP addresses given out by the DHCP on my R7000P.

My setup was as follows

IP - 192.168.1.1 (router)
mask - 255.255.252.0 (i have seperate modem on *.*.2.1 and other stuff on *.*.3.1)
DHCP - 192.168.1.100 for 25 leases.

all devices are set up like this and everything was working fine.

Now all my leases are getting their IP addresses as 192.168.0.1** instead of 192.168.1.1** and I could not work out why.

I tried restoring defaults, updating the firmware to latest beta, starting with fresh config but I could not get it to stay on 192.168.1.1**

So I thought I would try putting the mask back to 255.255.255.0 and that seems to have sorted it out but that doesn't work accessing the rest of my network on different subnets.

The only thing can think of is that I installed flashrouters.com privacy VPN app

https://www.flashrouters.com/privacy-app

but that slowed the connection right down, but I think the problems started then. Even after a firmware update, there still seems to be a gremlin in there somewhere.

Any help would be amazing, thanks
Sponsor
mrjcd
DD-WRT Guru


Joined: 31 Jan 2015
Posts: 6285
Location: Texas

PostPosted: Mon Mar 02, 2020 16:43    Post subject: Re: Getting incorrect IP addresses from DHCP Reply with quote
iwootiwoot wrote:
mask - 255.255.252.0

WTH Rolling Eyes
That is why you getting the DHCP you are getting Cool
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14207
Location: Texas, USA

PostPosted: Mon Mar 02, 2020 16:45    Post subject: Reply with quote
Your netmask is wrong. It should be 255.255.255.0.
_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
iwootiwoot
DD-WRT Novice


Joined: 06 Jan 2017
Posts: 17

PostPosted: Mon Mar 02, 2020 18:32    Post subject: Reply with quote
if i use 255.255.255.0 i cannot connect to 192.168.2.1 etc which is why i have it set to 255.255.252.0

like i say it worked before.

why would dhcp dish out on 192.168.0.* when its configured to dish out on 192.168.1.*
iwootiwoot
DD-WRT Novice


Joined: 06 Jan 2017
Posts: 17

PostPosted: Mon Mar 02, 2020 18:34    Post subject: Reply with quote
i say that but its actually letting me access 192.168.2.1 using the 255.255.255.0 at the moment
Therameatelf
DD-WRT User


Joined: 31 Jan 2016
Posts: 74

PostPosted: Mon Mar 02, 2020 19:49    Post subject: Reply with quote
Looks like you're trying to build a CIDR supernet. With that subnet mask 192.168.0.0 - 192.168.3.255 is your range. Not sure what the plan is, but bridging the subnets might be a cleaner approach. Much more expertise here than I on the subject.
http://www.subnet-calculator.com/cidr.php
iwootiwoot
DD-WRT Novice


Joined: 06 Jan 2017
Posts: 17

PostPosted: Mon Mar 02, 2020 22:03    Post subject: Reply with quote
Therameatelf wrote:
Looks like you're trying to build a CIDR supernet. With that subnet mask 192.168.0.0 - 192.168.3.255 is your range. Not sure what the plan is, but bridging the subnets might be a cleaner approach. Much more expertise here than I on the subject.
http://www.subnet-calculator.com/cidr.php


Thats cool like calc thanks.

Yeah many different reasons. Bascially wanted subnets for homenetwork, CCTV, Modem and also when abroad to VPN into the network and still be able to use the correct ip address. Have 2 modems connect via VPN on the same subnet conflicts when trying to access files. it also allows all the above to be on the same hardwired network and all talk to each other.

got it to work and keeping the router on 255.255.255.0 seems to nbe working ok for now.

cheers all
flyzipper
DD-WRT Guru


Joined: 21 Feb 2016
Posts: 504

PostPosted: Mon Mar 02, 2020 23:20    Post subject: Reply with quote
When you have a single subnet (no matter how big the mask is), all devices on that subnet communicate via layer 2 (arp'ing for the MAC address).

☝️ This is what you've created with your 255.255.252.0 subnet mask. There is no separation between devices in this sort of network.

When you have multiple subnets, a client device will send packets to its default gateway (for destination that are on a different subnet), and the default gateway sends (routes) the packet to the appropriate subnet. People typically do this on their private networks when they want some devices segregated from other devices.

To properly achieve this segregation, however, you'd need to:

1) create a VLAN for each subnet and place each device on the appropriate subnet (layer 2 segregation).
2) assign an IP range and subnet to each VLAN...

VLAN 1 - 192.168.1.0 (255.255.255.0)
VLAN 2 - 192.168.2.0 (255.255.255.0)

3) create layer 3 rules in your gateway to control the traffic between these subnets
4) since the subnets are both on the same gateway device, no special routing rules need to be created (the gateway already knows).
iwootiwoot
DD-WRT Novice


Joined: 06 Jan 2017
Posts: 17

PostPosted: Tue Mar 03, 2020 0:15    Post subject: Reply with quote
flyzipper wrote:
When you have a single subnet (no matter how big the mask is), all devices on that subnet communicate via layer 2 (arp'ing for the MAC address).

☝️ This is what you've created with your 255.255.252.0 subnet mask. There is no separation between devices in this sort of network.

When you have multiple subnets, a client device will send packets to its default gateway (for destination that are on a different subnet), and the default gateway sends (routes) the packet to the appropriate subnet. People typically do this on their private networks when they want some devices segregated from other devices.

To properly achieve this segregation, however, you'd need to:

1) create a VLAN for each subnet and place each device on the appropriate subnet (layer 2 segregation).
2) assign an IP range and subnet to each VLAN...

VLAN 1 - 192.168.1.0 (255.255.255.0)
VLAN 2 - 192.168.2.0 (255.255.255.0)

3) create layer 3 rules in your gateway to control the traffic between these subnets
4) since the subnets are both on the same gateway device, no special routing rules need to be created (the gateway already knows).


cool, thanks man, going to save the current config and have a play around with this.

Originally it was on stock firmware so was config was limited.

Thanks
mrjcd
DD-WRT Guru


Joined: 31 Jan 2015
Posts: 6285
Location: Texas

PostPosted: Tue Mar 03, 2020 1:20    Post subject: Reply with quote
Back in the day I had my main net on a /23 (255.255.254.0) netmask and it all worked great
but I decided I really didn't need 512 IPs to play with so its only the /24 net mask now days.

However, best I remember DD-WRT had some quirks / limitations on any DCHP that might allow more...
...such as the /22 (255.255.252.0) which should have total of 1024 IPs per that netmask. Seems I remember it would hand out weird IPs
or maybe the first unused IPs NO matter what you set for start DHCP IP.
That was several years back and don't know if that was ever fixed but whomever runs this firmware don't really need it to hand out more than a few hundered IPs per subnet anyways I reckon.
Twisted Evil
iwootiwoot
DD-WRT Novice


Joined: 06 Jan 2017
Posts: 17

PostPosted: Tue Mar 03, 2020 10:56    Post subject: Reply with quote
mrjcd wrote:
Back in the day I had my main net on a /23 (255.255.254.0) netmask and it all worked great
but I decided I really didn't need 512 IPs to play with so its only the /24 net mask now days.

However, best I remember DD-WRT had some quirks / limitations on any DCHP that might allow more...
...such as the /22 (255.255.252.0) which should have total of 1024 IPs per that netmask. Seems I remember it would hand out weird IPs
or maybe the first unused IPs NO matter what you set for start DHCP IP.
That was several years back and don't know if that was ever fixed but whoever runs this firmware don't really need it to hand out more than a few hundred IPs per subnet anyways I reckon.
Twisted Evil


Yeah, that's what I found weird. The DHCP was giving out the first available IP in the subnet mask rather than what the actual set start point was. glad I wasn't the only one.

I originally configured due to VPN from abroad and it didn't like having the same subnets connected together but I had no control over changing it from abroad. Then just separated everything for the sake of it I guess. I very much doubt id ever need 1024 addresses let alone 100!
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12873
Location: Netherlands

PostPosted: Tue Mar 03, 2020 11:05    Post subject: Reply with quote
That is (or was?) a long standing bug, if you set anything other than /24 the routers own IP address defaults to the first IP address of that range.

So you can have a /16 subnet but just set the routers IP as the first address.

That said you can not have multiple subnets which are overlapping!

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum