Jump to content

How to get subnet mask from an ipv4 address? (college work)

Theminecraftaddict555
Go to solution Solved by Clyne,
Just now, Theminecraftaddict555 said:

So how would you know that 11111110 = 254....I know why 1111 1111 is 255 tho

Its binary

1  is 128

2 is 64

3 is 32

4 is 16

5 is 8

6 is 4

7 is 2

8 is 1

Total all its max of 255

Since I am enrolled in a technical college learning about IT network and stuff...We have to learn about all the addressing

 

OT anyone know how to get an exact subnet mask from just an ipv4 address?  I know how to convert decimal to binary and the other way around but I can't get to know the exact subnet mask from the ipv4 address

Don't call me a nerd, it makes me look slightly smarter than you

Link to comment
Share on other sites

Link to post
Share on other sites

Specs: CPU - Intel i7 8700K @ 5GHz | GPU - Gigabyte GTX 970 G1 Gaming | Motherboard - ASUS Strix Z370-G WIFI AC | RAM - XPG Gammix DDR4-3000MHz 32GB (2x16GB) | Main Drive - Samsung 850 Evo 500GB M.2 | Other Drives - 7TB/3 Drives | CPU Cooler - Corsair H100i Pro | Case - Fractal Design Define C Mini TG | Power Supply - EVGA G3 850W

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, Theminecraftaddict555 said:

Since I am enrolled in a technical college learning about IT network and stuff...We have to learn about all the addressing

 

OT anyone know how to get an exact subnet mask from just an ipv4 address?  I know how to convert decimal to binary and the other way around but I can't get to know the exact subnet mask from the ipv4 address

What IP were you given? 

CPU: AMD Ryzen 5 5600X | CPU Cooler: Stock AMD Cooler | Motherboard: Asus ROG STRIX B550-F GAMING (WI-FI) | RAM: Corsair Vengeance LPX 16 GB (2 x 8 GB) DDR4-3000 CL16 | GPU: Nvidia GTX 1060 6GB Zotac Mini | Case: K280 Case | PSU: Cooler Master B600 Power supply | SSD: 1TB  | HDDs: 1x 250GB & 1x 1TB WD Blue | Monitors: 24" Acer S240HLBID + 24" Samsung  | OS: Win 10 Pro

 

Audio: Behringer Q802USB Xenyx 8 Input Mixer |  U-PHORIA UMC204HD | Behringer XM8500 Dynamic Cardioid Vocal Microphone | Sound Blaster Audigy Fx PCI-E card.

 

Home Lab:  Lenovo ThinkCenter M82 ESXi 6.7 | Lenovo M93 Tiny Exchange 2019 | TP-LINK TL-SG1024D 24-Port Gigabit | Cisco ASA 5506 firewall  | Cisco Catalyst 3750 Gigabit Switch | Cisco 2960C-LL | HP MicroServer G8 NAS | Custom built SCCM Server.

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

 

Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler

What are you looking for?

 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

10 minutes ago, wrathoftheturkey said:

Magic

Don't contribute to this serious topic if you aren't going to help and simply act like a clown 

Don't call me a nerd, it makes me look slightly smarter than you

Link to comment
Share on other sites

Link to post
Share on other sites

10 minutes ago, Abdul201588 said:

What IP were you given? 

an example from my worksheet is 192.168.10.10 /24<< the prefix 

Don't call me a nerd, it makes me look slightly smarter than you

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, Theminecraftaddict555 said:

an example from my worksheet is 192.168.10.10 /24<< the prefix 

Follow this video

 

 

CPU: AMD Ryzen 5 5600X | CPU Cooler: Stock AMD Cooler | Motherboard: Asus ROG STRIX B550-F GAMING (WI-FI) | RAM: Corsair Vengeance LPX 16 GB (2 x 8 GB) DDR4-3000 CL16 | GPU: Nvidia GTX 1060 6GB Zotac Mini | Case: K280 Case | PSU: Cooler Master B600 Power supply | SSD: 1TB  | HDDs: 1x 250GB & 1x 1TB WD Blue | Monitors: 24" Acer S240HLBID + 24" Samsung  | OS: Win 10 Pro

 

Audio: Behringer Q802USB Xenyx 8 Input Mixer |  U-PHORIA UMC204HD | Behringer XM8500 Dynamic Cardioid Vocal Microphone | Sound Blaster Audigy Fx PCI-E card.

 

Home Lab:  Lenovo ThinkCenter M82 ESXi 6.7 | Lenovo M93 Tiny Exchange 2019 | TP-LINK TL-SG1024D 24-Port Gigabit | Cisco ASA 5506 firewall  | Cisco Catalyst 3750 Gigabit Switch | Cisco 2960C-LL | HP MicroServer G8 NAS | Custom built SCCM Server.

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

7 minutes ago, Theminecraftaddict555 said:

an example from my worksheet is 192.168.10.10 /24<< the prefix 

Using /24 prefix, its 8+8+8 which is 24.

24 ones, remaining is 8 which would equal to 32.

So it's 255.255.255.0

Every 8th one counts for 1 (255), so if its /17 then it would be 255.255.128 prefix.

I'm also taking CCNA as well, so I have to remember this anyway. 

Prefix from /24

11111111 11111111 11111111 00000000 which equals to 255.255.255.0

Another way is from a single IPv4 address

162.158.0.0

Yeah that IP address looks like a Class B

Resulting it into 255.255.0.0

 

Link to comment
Share on other sites

Link to post
Share on other sites

13 minutes ago, Bubblewhale said:

Using /24 prefix, its 8+8+8 which is 24.

24 ones, remaining is 8 which would equal to 32.

So it's 255.255.255.0

Every 8th one counts for 1 (255), so if its /17 then it would be 255.255.128 prefix.

I'm also taking CCNA as well, so I have to remember this anyway. 

So following your practice, would ip address of 172.31.45.252 /16 = a subnet mask of 255.255.0.0?

And how would you get .128 in your /17 example?

Don't call me a nerd, it makes me look slightly smarter than you

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, Theminecraftaddict555 said:

So following your practice, would ip address of 172.31.45.252 /16 = a subnet mask of 255.255.0.0?

nvm read it wrong

but yeah it's 255.255.0.0

332337af450f0118c7c7d218edf2e495.png

@Theminecraftaddict555 I read the wrong subnet mask but it's correct for /16 prefix, it's 255.255.0.0

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Bubblewhale said:

nvm read it wrong

but yeah it's 255.255.0.0

332337af450f0118c7c7d218edf2e495.png

Okay but how did you get yours with the odd number /17?  it seems like I know how to get the subnet mask with even /'s 

Don't call me a nerd, it makes me look slightly smarter than you

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, Theminecraftaddict555 said:

Okay but how did you get yours with the odd number /17?  it seems like I know how to get the subnet mask with even /'s 

I'd just use /17 prefix as a example.

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, Bubblewhale said:

I'd just use /17 prefix as a example.

Yeah but i might want to see how you did it so I can find the subnet masks from ip addresses that have an odd number prefix rather than even 

Don't call me a nerd, it makes me look slightly smarter than you

Link to comment
Share on other sites

Link to post
Share on other sites

You can't get a complete subnet off an IPV4 address. Eg best bet would be 192.168.x.x/16. 

Link to comment
Share on other sites

Link to post
Share on other sites

6 minutes ago, Theminecraftaddict555 said:

Yeah but i might want to see how you did it so I can find the subnet masks from ip addresses that have an odd number prefix rather than even 

So if it was a /15 prefix.

We know that IPv4 is 32 bits max

Knowing that /15 is 15 bits out of 32 bits

11111111 11111110 00000000 00000000

Seeing how its the first two are 255.255, the 3rd set only has 1 bit out of it's 8 bits and it would be 128.

255.254.0.0 would be the result.

5b0b5ebc759cb635fb517e1ac24ca2ac.png

Link to comment
Share on other sites

Link to post
Share on other sites

10 minutes ago, Bubblewhale said:

So if it was a /15 prefix.

We know that IPv4 is 32 bits max

Knowing that /15 is 15 bits out of 32 bits, just use binary.

11111111 11111110 00000000 00000000

Seeing how its the first two are 255.255, the 3rd set only has 1 bit out of it's 8 bits and it would be 128.

255.254.0.0 would be the result.

5b0b5ebc759cb635fb517e1ac24ca2ac.png

So how would you know that 11111110 = 254....I know why 1111 1111 is 255 tho

Don't call me a nerd, it makes me look slightly smarter than you

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, Theminecraftaddict555 said:

So how would you know that 11111110 = 254....I know why 1111 1111 is 255 tho

Its binary

1  is 128

2 is 64

3 is 32

4 is 16

5 is 8

6 is 4

7 is 2

8 is 1

Total all its max of 255

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Bubblewhale said:

Its binary

1  is 128

2 is 64

3 is 32

4 is 16

5 is 8

6 is 4

7 is 2

8 is 1

Total all its max of 255

OH I see now every 1's represented in the binaries of the octet is going to be first 128, then adds up to 64 and so on?

Makes much more sense so for example 11111111.11111100.11110000.00000000 would turn out to be 255.252.240.0?

Don't call me a nerd, it makes me look slightly smarter than you

Link to comment
Share on other sites

Link to post
Share on other sites

7 minutes ago, Theminecraftaddict555 said:

OH I see now every 1's represented in the binaries of the octet is going to be first 128, then adds up to 64 and so on?

Makes much more sense so for example 11111111.11111100.11110000.00000000 would turn out to be 255.252.240.0?

Yeah it would be that but that's not a subnet mask...

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, Bubblewhale said:

Yeah it would be that but that's not a subnet mask...

yeah i know a subnet mask doesn't have those wierd numbers and have like 255.255.128.0 or something if ip address is 192.168.20.0 /17 correct?

Don't call me a nerd, it makes me look slightly smarter than you

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, Theminecraftaddict555 said:

yeah i know a subnet mask doesn't have those wierd numbers and have like 255.255.128.0 or something correct?

Yeah more like that...

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Bubblewhale said:

Yeah more like that...

Thanks it helped regardless

Just to make sure for another problem on my sheet

would subnet mask for 192.168.28.45/27 be 255.255.255.224?

Don't call me a nerd, it makes me look slightly smarter than you

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, Theminecraftaddict555 said:

Thanks it helped regardless

Just to make sure for another problem on my sheet

would subnet mask for 192.168.28.45/27 be 255.255.255.224?

Yeah it would be 255.255.255.224.

Are you taking like CCNA? I had to do these labs/worksheets with finding out subnets, boardcast, first/last usable, and the network address.

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, Bubblewhale said:

Yeah it would be 255.255.255.224.

Are you taking like CCNA? I had to do these labs/worksheets with finding out subnets, boardcast, first/last usable, and the network address.

yep ccna 1..Complicated stuff 

Don't call me a nerd, it makes me look slightly smarter than you

Link to comment
Share on other sites

Link to post
Share on other sites

13 minutes ago, Theminecraftaddict555 said:

yeah i know a subnet mask doesn't have those wierd numbers and have like 255.255.128.0 or something if ip address is 192.168.20.0 /17 correct?

Subnet mask bits start from the left and move to the right sequentially, a /17 would mean there are 17 bits masked (1) from left to right with the remaining unmasked (0). To figure out the decimal number for each octet you use binary math conversion, there are 8 bits and is base 2 math and you calculate from right to left.

 

128 64 32 16 8 4 2 1 (all 8 bits, sum total 255)

 

So for your /17 question the last bit in the 3rd octet must be a 1 so the decimal of 10000000 is 128, so 255.255.128.0.

 

Here are some previous threads about subnet masks you might find helpful:

 

https://linustechtips.com/main/topic/599858-cidr-and-number/#comment-7808088

https://linustechtips.com/main/topic/611110-subnetting/#comment-7909923

https://linustechtips.com/main/topic/668967-understanding-the-jist-between-cidr-and-vlsm/#comment-8629688

 

Got any more questions or want examples ask away, or even questions for you to solve.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×