Please help me understand IP4 address and subnet mask and subnetting

Hello,

It will be really helpful if you guys guide to good source for understanding.
I
IP4 addresses
Subnet Mask
and subnetting.
It is so confusing.
Please if possible post a link.

Thank you,

To be honest a forum post to replace a web search for such a basic topic might not be the best

The first entry there looks like a good starting point

6 Likes

sorry :slightly_frowning_face:
i find it really confusing that's why asked here

@neil1 If you have a particular question then it would make sense to post it (though that's probably more suited for a general network forum not a specific forum like this one).

4 Likes

Anyway, a typical home router would use IP address like 192.168.1.1 with subnet mask of 255.255.255.0. Valid IP addresses for this network world be from 192.168.1.1 to 192.168.1.254.

If you have another network (for example a parent router and a child router, or several VLANs on the same router), then you can use addresses from 192.168.2.1 to 192.168.2.254 for the second network.

That should get you by for a typical setup. If you want more complicated setup, you will have to do some reading.

2 Likes

Hi @neil1,

I am a confused noob too. This readymade calculator helped me to understand a few things.

Hope this helps you.

Thank you!
-Gamma

3 Likes

I want to ask about DHCP lease and static ip
DHCP range is from 192.168.1.100-192.168.1.150
buy my router ip is 192.168.1.2
how my router is still working?
I have a printer and two access points. But i dont see them in connected devices.
they have static IPs.
Should i add them as static dhcp lease in the openwrt settings?
to see them in connected devices and what IPs i should assign them?

Static IPs (means static configured on the client device) will not be shown on the DHCP server

Yes it would be better to configure a static lease for them and then put them on DHCP so that they receive the same IP you before had configured statically on them

2 Likes

one more question.
DHCP lease range is from 192.168.1.100-192.168.1.150
and i have assigned static IPs to devices but these IP addresses are outside DHCP lease range.
What if i remove static IP settings from those devices?
Will these devices be getting the static IP i assigned them or they will get a IP from DHCP lease range?

The lease range is only for dynamically assigned IP's so if the devices you are assigning IP statically are outside this range they still get it from the DHCP server.

2 Likes

I have a printer with static IP in printer settings 192.168.1.3
and DHCP lease range is 192.168.100-192.168.1.150
I like to setup 192.168.1.3 IP for printer in the router DHCP settings.
Printer will get 192.168.1.3 from DHCP assigned as static lease or from DHCP lease range?
sorry for asking same question again.

That is correct just assign 192.168.1.3 to the MAC address of the printer in static leases and then configure the printer to use DHCP and everything is as before.

2 Likes

If you mean the default DHCP range for OpenWrt then it's 192.168.1.100 to 192.168.1.249. The numbers you see 100 is the beginning of DHCP pool and the 150 is the range of the pool, or the number of the addresses.

People will have different opinions about that. Personally I set static IP for network devices (e.g. routers and APs) so they are always accessible via the same IP even if they are not connected to the main router, and set static leases for the rest of my devices (e.g. PCs and printers).

But you could also have the printer as static IP if it allows that. It's good practice though to arrange the static IPs of your devices and leave room for future expansion. For example, reserve 192.168.1.1 to 192.168.1.9 for routers, 192.168.1.1 to 192.168.1.19 for printers, etc.

2 Likes

OK thank you. It is working.
Printer got the IP as assigned in static lease.
What is the good practice? Assign static IP in the dhcp lease range or outside lease range.
And should i assign static IP addresses to my WiFi access points too? in openwrt static leases

Outside

If they are manageable via the IP Address then that makes sense.
I would use Static Leases for any device that offer services in your LAN or for which you want to give specific Firewall rules

2 Likes

why it doesn't start from 192.168.1.0 to 192.168.1.255
because subnet mask is 255.255.255.0
you can use all addresses in this range from 0 to 255?

It doesn't start at 192.168.1.0 so that you can use the addresses below 100 for the static leases

1 Like

oh :thinking: ok that's nice! thanks for telling this. I will keep it in mind.
that's why routers always have dhcp lease range set as 192.168.1.100 - 192.168.1.199 or 150.
and one more question why ip range is from 0-255 why not 0-999 or something like that. I know it has something to do with 8 bit size but why not go 9-10 or even more big or small bit size for it? Why only 8 bit size.

That's just the commonly used 'default' size for a LAN. You can go bigger or smaller depending on your own requirements. But for most domestic/small business networks you don't really need more than 254 available addresses.

what if i need 500 addresses?
then what should i do?
divide them in 2 routers with 254 addresses each?
what if i need them on same network?