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

1 minute ago, leadeater said:

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.

Thanks! 

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

I am always up for a private chat if you need any more help with this kind of stuff, kind of topic I love the most now days... I have a few blogs on understanding binary to decimal conversion and vice versa (but many online... I just wrote one to help a friend understand it) (edit: I see leadeater had also said if you have any more questions, trust him if you want a depth understanding ;) )

I'm going to put a link to my PC specs which actually aren't my PC specs and I cry myself to sleep everyday so I can have these PC specs but I can't afford these PC specs so PC specs PC specs PC specs PC specs PC specs PC specs.

Link to comment
Share on other sites

Link to post
Share on other sites

I also loved people giving me examples in class to work out, so if you now understand from all the previous posts that everyone had kindly put here are some exercises:

 

What is the subnet mask of the following? (Do them all and double check with some tool online)

 

11111111.11100000.00000000.00000000

11111111.11111111.11100000.00000000

11111111.11111111.11111110.00000000

11111000.00000000.00000000.00000000

11111111.11111111.11111111.11111000

 

Try to convert the following into binary:

255.255.192.0

255.224.0.0

255.255.255.252

240.0.0.0

255.255.255.248

 

While you are on a role, after examples like this working out a wildcard was extremely easy since I was in the zone (danger zone, da.. daa.. da.. dun dun)

255.255.255.0 wildmask is 0.0.0.255     (its somewhat looks like the exact opposite doesn't it? (I felt like it was))

255.255.192.0 wildmask is 0.0.63.255

 

Don't worry if you don't know what it is used for etc... Just work it out maybe when you are doing subnet mask practise and it will come in handy in the future....

11111111.11111111.11111111.00000000 = 255.255.255.0

00000000.00000000.00000000.11111111 = 0.0.0.255

 

11111111.11111111.11100000.00000000 = 255.255.224.0

00000000.00000000.00011111.11111111 = 0.0.31.255

 

 

Now just a little tip if you are interested.... You don't have to be a genius to sit down and look at something like:

 

00000000.00000000.00111111.11111111 and in under 3 seconds tell me that in decimal... You really don't..... Just look at 00111111

 

Just remember the first binary value to the left of the first 1 (00111111) which is.... 64?..... Well matey, I shit you not... Look below and see a pattern which you should understand (but I'll explain after)

 

Examples:

 

    32

00(0)11111 = 31 (16 + 8 + 4 + 2 + 1?)

 

128

(0)1111111 = 127 (64 + 32 + 16 + 8 + 4 + 2 + 1?)

 

  64

0(0)111111 = 63 (32 + 16 + 8 + 4 + 2 + 1?)

 

 

Maybe notice the pattern: take the 0 to the left of the following 1's... Remember the decimal value of that single positional bit in an octet... and maybe... -1 to get your answer?

 

 

P.S hopefully I didn't make a mistake or confuse it too much....

I'm going to put a link to my PC specs which actually aren't my PC specs and I cry myself to sleep everyday so I can have these PC specs but I can't afford these PC specs so PC specs PC specs PC specs PC specs PC specs PC specs.

Link to comment
Share on other sites

Link to post
Share on other sites

10 hours ago, BSpendlove said:

I also loved people giving me examples in class to work out, so if you now understand from all the previous posts that everyone had kindly put here are some exercises:

 

What is the subnet mask of the following? (Do them all and double check with some tool online)

 

11111111.11100000.00000000.00000000

11111111.11111111.11100000.00000000

11111111.11111111.11111110.00000000

11111000.00000000.00000000.00000000

11111111.11111111.11111111.11111000

 

Try to convert the following into binary:

255.255.192.0

255.224.0.0

255.255.255.252

240.0.0.0

255.255.255.248

 

While you are on a role, after examples like this working out a wildcard was extremely easy since I was in the zone (danger zone, da.. daa.. da.. dun dun)

255.255.255.0 wildmask is 0.0.0.255     (its somewhat looks like the exact opposite doesn't it? (I felt like it was))

255.255.192.0 wildmask is 0.0.63.255

 

Don't worry if you don't know what it is used for etc... Just work it out maybe when you are doing subnet mask practise and it will come in handy in the future....

11111111.11111111.11111111.00000000 = 255.255.255.0

00000000.00000000.00000000.11111111 = 0.0.0.255

 

11111111.11111111.11100000.00000000 = 255.255.224.0

00000000.00000000.00011111.11111111 = 0.0.31.255

 

 

Now just a little tip if you are interested.... You don't have to be a genius to sit down and look at something like:

 

00000000.00000000.00111111.11111111 and in under 3 seconds tell me that in decimal... You really don't..... Just look at 00111111

 

Just remember the first binary value to the left of the first 1 (00111111) which is.... 64?..... Well matey, I shit you not... Look below and see a pattern which you should understand (but I'll explain after)

 

Examples:

 

    32

00(0)11111 = 31 (16 + 8 + 4 + 2 + 1?)

 

128

(0)1111111 = 127 (64 + 32 + 16 + 8 + 4 + 2 + 1?)

 

  64

0(0)111111 = 63 (32 + 16 + 8 + 4 + 2 + 1?)

 

 

Maybe notice the pattern: take the 0 to the left of the following 1's... Remember the decimal value of that single positional bit in an octet... and maybe... -1 to get your answer?

 

 

P.S hopefully I didn't make a mistake or confuse it too much....

In my CCNA class, sometimes we play binary blitz to practice..fun way to practice.

Link to comment
Share on other sites

Link to post
Share on other sites

9 hours ago, Bubblewhale said:

In my CCNA class, sometimes we play binary blitz to practice..fun way to practice.

My problem is that my class isn't even CCNA! So if we ever get a question about subnetting, everyone just stops and stares at me like :ph34r:

I'm going to put a link to my PC specs which actually aren't my PC specs and I cry myself to sleep everyday so I can have these PC specs but I can't afford these PC specs so PC specs PC specs PC specs PC specs PC specs PC specs.

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

×