Can't set WAN interface subnet bit count to 31

Started by djrocksmith, July 10, 2021, 12:59:54 AM

Previous topic - Next topic
July 10, 2021, 12:59:54 AM Last Edit: July 10, 2021, 01:49:17 AM by djrocksmith
Hi all,

My first time setting this up, but I write software for a living so I'm reasonably ok with technical help.

I set my WAN (which goes to the internet provider) to a non DHCP setup, my ISP can't provide it for some reason.

I enter my IP address *.*.*.201

Then Enter the new Wan IPv4 subnet bit count to 31.  The subnet should be 255.255.255.254.

I get the error:-

"You cannot set network address to an interface"

Any ideas?

Cheers

Clinton

hi
It seems that the setaddr.php script makes no exception for /31, /32 networks on address validation.
you can try to set /24 (or some) network on wizard and then change this settings in web-GUI

Thanks for that idea mate.

I actually edited the conf XML file and put the values in manually.

I also looked at the code on GitHub to see how it works and there is probably a pull request I could do to fix it.

Cheers

/31 has the problem that only two addresses exist and the first is the network address and the second one is the broadcast address. There is no room to fit a host address and both setport.sh and interfaces.php do validate this in the IPv4 case.

Circumventing this restriction is not great...


Cheers,
Franco



Quote from: franco on July 13, 2021, 11:58:21 AM
/31 has the problem that only two addresses exist and the first is the network address and the second one is the broadcast address. There is no room to fit a host address and both setport.sh and interfaces.php do validate this in the IPv4 case.

That is not correct. 31 has two host addresses. The broadcast address is the other host address. Network is probably handled the same way. This special net ask is not supported by all operating systems.

> 31 has two host addresses. The broadcast address is the other host address.

Sorry, this is nonsense. It can't be both.

> This special net ask is not supported by all operating systems.

Which is, um, why it's not supported. I have difficulty grasping your answer as a whole.


Cheers,
Franco

If you want to split hairs on "usabe" hosts fine, but the point remains the same, i.e. https://www.calculator.net/ip-subnet-calculator.html at the bottom.


Okay, I missed the "if ($pconfig['subnet'] < 31) {" ... who wants to do the PR?


Cheers,
Franco



It's a PPP type tunnel setup and while it has some benefits on WAN side it's irrelevant for any LAN you're going to set up.


Cheers,
Franco