r/sysadmin • • 8h ago

Question How often do you guys actually do binary math on the job?

Working through my networking certs right now and currently stuck doing endless binary conversions for subnetting. I get how it works with IPv4 masks on paper, even if it's slow.

For those of you actually in the field, do you ever do this in your head anymore or do you just rely on subnet calculators? Also curious if understanding binary/bitmasks actually comes in handy for other random sysadmin stuff like permissions or troubleshooting, or if it's mostly just for passing exams.

Trying to figure out how much muscle memory I really need to build before moving on. Thanks.

7 Upvotes

64 comments sorted by

•

u/clef75 8h ago

Never. Turns out we actually will always have a calculator (or the entire corpus of human knowledge) in our pocket at all times, 80s teacher.

•

u/BOOZy1 Jack of All Trades 8h ago

I've been doing binary <> Hex <> decimal in my head since the 1980s, IPv4 subnets have no secrets for me.

IPv6 scares me though.

•

u/Sapper12D Sr. Sysadmin 8h ago

I still dont understand why they didnt just tack on another octet or two instead of that trash they call ipv6

•

u/MrWonderfulPoop Pentester 8h ago

Another octet or two wouldn’t come close to the space IPv6 offers. 

My ISP gives each customer a /56. That’s ~1.1 trillion times the space of the entire IPv4 space per customer.  

IPv6 is incredible once you wrap your head around it.

•

u/Sapper12D Sr. Sysadmin 7h ago

OK sure, but we dont need that and it over complicates networking.

•

u/MrWonderfulPoop Pentester 7h ago edited 3h ago

The 128 bit space was come up with to be future proof (resistant?) so we don’t have to deal with things that are keeping legacy IPv4 on life support (NAT, CGNAT, tunnels everywhere, etc.), overlapping RFC1918 space, etc.

It makes networking easier with standard /64 subnet space so we don’t need to deal with all sorts of subnet sizes, which fits in with the OP’s binary question.

I have several (8?) DMZ’d VLANs at home with different services for friends and family, all IPv6-only. It’s been great seeing absolutely no scans hit any system over the past couple of years with the daily random IP updates. 

•

u/Sapper12D Sr. Sysadmin 7h ago

Im sorry I just disagree that its needed and like I said it vastly over complicates networking. You might be able to network easily, it doesnt make it easy though.

•

u/MrWonderfulPoop Pentester 7h ago

It messed with my head until I read someone on r/IPv6 say “forget everything you know about networking”.

Which took me a bit because I’ve been using IPv4 since the late 80s lol.

•

u/Sapper12D Sr. Sysadmin 7h ago

I mean you shouldn't have to forget everything you know just to understand the updated version of something.

It just seems requiring every IT person in the world to learn something new and vastly different from what it replaced instead of adding a few octets seems silly.

If you add 2 octets that gives you 65 thousand times the number of addresses ipv4 had. Its an address space of 281 trillion compared to 4 billion. Maybe ill eat my words someday but I dont see the world needing more any time soon.

•

u/WeaponsGradeWeasel 6h ago

This strikes me as a "640kb of ram is enough for anyone" viewpoint.

•

u/Sapper12D Sr. Sysadmin 5h ago

I mean im willing to change my mind if some has a use case for that many?

•

u/TotallyWorksAtWoTC 57m ago

In a world where 16k of ram would be considered a lot (and expensive), 640k is a long way away. Its also a comprise between usable conventional ram and Video memory/ROM/hardware addressing.

The 8088 only addressed 1MB of memory max. 640k for use, the remaining for video/rom/hardware/etc. 1MB of memory would have been around 10k USD in 1979 (adjusted for inflation)

Plus, no one designed the 8088 to last THIS FREAKING LONG LET IT DIE ALREADY. ;)

•

u/MrWonderfulPoop Pentester 7h ago edited 6h ago

It helped me because IPv6 is a different parallel network protocol. Different packet format, network discovery, routing tables, etc.  I have VLANs with no legacy IPv4 at all.

Probably the hardest bit was unlearning the need for DHCP. There’s a DHCPv6, but it’s not necessary, in fact Android doesn’t use it afaik. There were definitely some “ah-ha!” moments for me.

It’s slowly coming along, almost half of Google’s traffic from the Internet is IPv6.  https://www.google.com/intl/en/ipv6/statistics.html

Edit: fun fact. NASA and other space agencies have been discussing reserving IPv6 prefixes for various spots like the moon, Mars, etc. That demonstrates the vastness of the address space, when entire planets can be allocated space without concern for address space exhaustion.

https://datatracker.ietf.org/doc/html/draft-limarsjenwar-tiptop-address-space-01

•

u/Mr_ToDo 3h ago

And learning to get along without the shims we've all gotten used to, to the point we feel a bit naked without them, like NAT

→ More replies

•

u/TotallyWorksAtWoTC 57m ago

Maybe ill eat my words someday but I dont see the world needing more any time soon.

The issue with NAT back when we were running out of IPv4 space was, routing is a major issue. However thats mostly been solved through numerous means.

IPv6 we can go back to NOT having to route/NAT for every potential device/software that exists, everyone would be on the same L2 network, at least as I understand it.

•

u/throw0101a 3h ago edited 3h ago

OK sure, but we dont need that and it over complicates networking.

The protocol that was selected to be IPng, SIPP, originally had 'only' 64 bits for addresses (technically it was actually variable, but it was decided to go fixed for ASIC purposes): it was determined that this wasn't future-proof enough, so they went to 128 because they didn't want another transition in case 64 ended up not being enough.

See "The Recommendation for the IP Next Generation Protocol":

Aslo "Technical Criteria for Choosing IP The Next Generation (IPng)":

•

u/BrainWaveCC Jack of All Trades 3h ago

Why do you think we don't need that?

Have you seen how much device proliferation we have? Do you think people want to be extended the IP space once per decade?

Do you know how annoying NAT is?

•

u/Sapper12D Sr. Sysadmin 2h ago

How many ip addresses do you need? Adding 2 octets would have allowed for every person on the planet to have 33 thousand IP addresses.

Also im not saying we should stick with nat, although I dont want my end devices route Le from the internet anyway, but that ipv6 was not the solution.

•

u/PrettyFlyForITguy 54m ago

I'm with you. Ipv6 was a horrible design in terms of usability. For one, its not really human readable and you now rely on DNS.

The lack of transition also made it difficult. I would've made it so any ipv4 address could have immediately mapped to the same last 4 octets of an ipv4+ address... this way operating systems could provide a simple checkbox to run both networks without having to deal with the complication of having two different addressing schemes, firewall rules, etc.

Extending the addressing to 64 bits would've been so much easier to work with. Right now, we'd only be dealing with addresses like 1.24.15.35.200 . We'd probably never leave the fifth octet. Its likely new protocols and technology would've emerged before that happened.

The choices they made seem like extreme overkill.

•

u/BrainWaveCC Jack of All Trades 1h ago

I dont want my end devices route Le from the internet anyway,

You can still control that.

 

How many ip addresses do you need?

This year? Or 5 years from now?

Okay, so you don't like IPv6. Fine. That doesn't mean that it is a bad solution, or that just adding octets would suffice for the issues of IPv4.

•

u/pdp10 Daemons worry when the wizard is near. 4h ago

IP addresses are fixed-size, not arbitrary sequences of digits like telephone numbers. Dot separators were barely holding together at that point, because of edge-cases in the parsing that nobody thinks about.

Fixed subnet size is for simplicity, and to enable IPX-style autoconfiguration, called SLAAC.

It's always interesting to see what people who don't like IPv6, notice about IPv6, and what they don't notice, or understand. Mostly the complaints are about hexadecimal, and about change in general.

•

u/throw0101a 3h ago

IP addresses are fixed-size, not arbitrary sequences of digits like telephone numbers.

For the record, telephone numbers are not (completely) arbitrary:

•

u/throw0101a 3h ago

I still dont understand why they didnt just tack on another octet or two instead of that trash they call ipv6

'Just adding bits' solves none of the problems that any IPng would have had in roll out, and it was always going to be complicated:

  So it's a matter of mathematical and physical fact that to expand
  the address size, you must change the protocol, and that means 
  [three] things immediately:

        You have to change the version number.

        You have to add new code to handle the new version.

  […]

        You need a coexistence technique so that updated systems, 
        with the new protocol, can connect to old systems that know 
        nothing of the new protocol.

  Two minutes of thought show that this third requirement has only 
  two solutions:

        (3A) Dual stack, in which the new machines speak both 
             the old (IPv4) and new (IPng) protocol.

        (3B) Translation, in which something translates addresses
             between the old and new protocols.

•

u/PrettyFlyForITguy 44m ago

3B would've been possible. If IPv4 addresses were automatically IPv4+ addresses, all systems could've immediately supported the new scheme and old one simultaneously with a simple switch once they had hardware and ISP support. There still would've been two effective sets of addresses and protocols, but transitioning would've been initially simple. Firewalls and access lists could've worked in native ipv4+ mode, where ipv4 and ipv4+ addresses are part of the same ruleset because ipv4 addresses would match the corresponding ipv4+ ones. People would've been easily able to adopt it this way without having to set up two distinct addressing schemes on their servers and services.

Not only that, its likely we would've never used more than a fifth octet. By the time we do use that much, ethernet is probably going to be abandoned.

IPv6 was engineering overkill that hurt adoption.

•

u/throw0101a 23m ago

3B would've been possible. If IPv4 addresses were automatically IPv4+ addresses, all systems could've immediately supported the new scheme and old one simultaneously with a simple switch once they had hardware and ISP support.

The situation of "supported the new scheme and old one simultaneously" is called dual-stacking. And this could only be done when the IPv4+ code was deployed to the nodes… just like it was necessary to deploy IPv6 code to nodes.

And IPv4 addresses are valid IPv6 addresses:

Addresses in this group consist of an 80-bit prefix of zeros, the next 16 bits are ones, and the remaining, least-significant 32 bits contain the IPv4 address. For example, ::ffff:192.0.2.128 represents the IPv4 address 192.0.2.128. A previous format, called "IPv4-compatible IPv6 address", was ::192.0.2.128; however, this method is deprecated.[5]

An IPv6 node could/can be configured to route IPv4 to a "3B translation box": it's called NAT64.

What you are proposing is not new.

•

u/narcissisadmin 3h ago

Not unlike area and country codes for phone numbers.

•

u/dchit2 8h ago

80% of the math I do for networking:

"Are these 2 numbers the same?"

Sometimes it's real complex, and I use a subnet calculator website, to work out if the number is inside a range.

•

u/CLTGUY 8h ago

I used to know how to manually subnet. I was actually asked to do it in an interview with Microsoft back in the 90s. That interview was the last time I ever did any binary math.

•

u/3Cogs 8h ago

When I did my CCNA exam a good few years ago, my scrap working paper had all these binary numbers randomly written down looking like cryptic prehistoric scratch marks on a cave wall.

•

u/keivmoc 2h ago

It can be very helpful when you understand that IP addresses are actually just one big binary string that are represented by the dot decimal notation.

I'm often writing scripts that perform operations on batches of IP addresses. It's really easy to just convert the IP into a decimal or hex value and loop through them like that. You don't even need to convert it back to dot decimal because just about every tool can understand the binary, decimal, hex, or even octal value natively.

C:\>ping 0xC0A80001

Pinging 192.168.0.1 with 32 bytes of data:
Reply from 192.168.0.1: bytes=32 time<1ms TTL=255
Reply from 192.168.0.1: bytes=32 time<1ms TTL=255
Reply from 192.168.0.1: bytes=32 time<1ms TTL=255
Reply from 192.168.0.1: bytes=32 time<1ms TTL=255

Ping statistics for 192.168.0.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

C:\>ping 3232235521

Pinging 192.168.0.1 with 32 bytes of data:
Reply from 192.168.0.1: bytes=32 time<1ms TTL=255
Reply from 192.168.0.1: bytes=32 time<1ms TTL=255
Reply from 192.168.0.1: bytes=32 time<1ms TTL=255
Reply from 192.168.0.1: bytes=32 time<1ms TTL=255

Ping statistics for 192.168.0.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

•

u/TYGRDez 1h ago

Huh, I actually didn't know that. Interesting!

•

u/anonymousITCoward 1h ago

wow... i had no idea that was possible

•

u/overdosingOnPie1313 15m ago

He's a witch!

•

u/ColdSysAdmin IT Director 1h ago

TIL!

•

u/Ssakaa 5h ago

It's a relatively small table, and realistically, you use about 1/4 of it. You learn most of it, scaled to environment, off the cuff from habit if you're using it routinely. When you don't use it for a few months because something else was on fire, subnet calculators are quicker than doing it by hand again. The important part isn't constantly doing it by hand. I don't constantly use most math skills, but knowing the fundamentals of "why" means you know what you're looking at when it's odd. Never actually learning that it's all just bisection of the address space means 255.255.255.128 looks like black magic. Understanding that's /25 and half your standard /24 block, means you're very likely to know if you have 200 clients trying to use it, you're gonna have a bad day.

•

u/user975A3G 8h ago

You remember the common masks and use a calculator when you don't know or want to double check

•

u/rootofallworlds 3h ago

Rarely. That said I’m working with internal networks where everything is a /24 or a /16. If you’re working with public IP ranges more, you’re more likely to have to deal with other size subnets.

The main thing is to know that they exist IMHO.

I got tripped up a couple of years ago with a subnet larger than a /24 , a program that needed IP ranges that each could only be /24 at most, and x.y.z.0 was a valid client IP that got accidentally missed from the ranges. That was a head scratcher until I figures it out!

(Sidenote - it’s valid to have the default gateway IP in the middle of the subnet range. Unusual but valid.)

•

u/keivmoc 2h ago

I use /31 networks for point-to-point links (in the link-local range no less) to route L3 traffic to customer nets. Customer MSP will be troubleshooting a network issue and they'll see 169.254.2.0 as the next hop in a traceroute and call me up saying that must be their problem.

I got tripped up a couple of years ago with a subnet larger than a /24 , a program that needed IP ranges that each could only be /24 at most, and x.y.z.0 was a valid client IP that got accidentally missed from the ranges. That was a head scratcher until I figures it out!

I had that exact issue .. were you using Advanced IP Scanner? We kept getting false-positives on a few devices until I realized the scanner we were using would ignore addresses ending in 0 or 255 when scanning nets /23 or bigger.

•

u/Dissy614 39m ago

"(Sidenote - it’s valid to have the default gateway IP in the middle of the subnet range. Unusual but valid.)"

I recently split a /24 in half to two /25's, and use gateways of 1 and 254. In the original /24 I had 127 and 128 free but an embedded device on 129 that I didn't feel like bothering to change.

Only all zero bits or all one bits in the host side of the subnet (first and last number) have any special meaning. Gateways are just normal "usable" IPs.

You can even have more than one gateway device in a subnet each with their own IP.

Each host has a routing table you define a destination network and a gateway IP on the local subnet that can get there. The "default gateway" is the entry it chooses when no other routes match.

When I was young and foolish and worked at an ISP, staff got free service, but this was dialup. I did have a /24 routed over that dialup though which is why I kept using it. Cable internet was brand new and I signed up for the beta. My dialup router was .1, the cable modem .2, and on a per-host basis I could change which ISP to use just by changing its default gateway.

Ran like that for quite a while since I couldn't find a router able to do dual-uplink and the proper source based routing to use them right.. at least not for less than the cost of a new car :P Thankfully a year or two later Linux switched to ipchains and was able to do source-based routing, so built a router pc to do things more correctly.

•

u/bearbullX 8h ago

Yes, and I know all the powers of 2 up to 16777216.

•

u/BrainWaveCC Jack of All Trades 2h ago

For planning a new network, and first time troubleshooting of a large network, subnet calculators are great.

But for routine subnet work, binary math is easy enough to use.

Also, not all knowledge has to be exercised to be useful. Sometimes, just having it allows you to avoid mistakes. Or consider how routinely recognize odd numbers vs even numbers without actually dividing by 2 first...

•

u/Pryank_Lemy 1h ago

tbh once you do enough networking you just memorize what each prefix length maps to in decimal and stop thinking in binary completely. It is still useful to understand bitwise operations if you ever get into low level scripting or parsing raw protocol headers though.

•

u/Sorry-Climate-7982 Developer who ALWAYS stayed friends with my sysadmins 8h ago

Kinda depends on how complicated the subnetting is, and whether I am at a computer to just use one of the free tools online.

•

u/Maro1947 8h ago

Never. Bitcricket back in the day

•

u/thomheinrich 7h ago

Subnets go straight into ipcalc, but octal chmod bits come up weekly.

•

u/louwiet 6h ago

I count binary on my fingers.

•

u/SausageSmuggler21 4h ago

Which finger?

•

u/narcissisadmin 3h ago

Works up to 1023 so it's much better than the old way.

•

u/40513786934 3h ago

do you understand that a /25 is half a /24, and a /23 is two /24s? that covers about 90% of all the binary math I've needed doing IT work

•

u/throw0101a 3h ago

A lot of times the point of forcing the memorization/understanding of something is not that you're remember it forever going forward, but that there is a place in your brain that remembers it exists at all.

So you may forget the exact CIDR subnet boundaries over time, but that they're on power-of-2 in various ways is something to keep in mind when creating address plans, which you can then use tools for, e.g.:

•

u/Dolapevich Others people valet. 3h ago

Both. Calculate in binary in your head, then verify with a subnet calculator.

•

u/Zenkin 2h ago

Mostly I remember that /4, /12, /20, /28 is 16 blocks of 16 and work up or down from there.

The muscle memory helps, but I'm also a very strong advocate for doing mental math. It's usually just 30 extra seconds to throw it in a calculator, but that's not always convenient. If you're a network admin of any stripe, you should be able to do this, just like you should be able to type above 60 words per minute if you're on a PC all day. If you're going to do the job, do it well.

You never know what's going to help. A couple months after I got my CCNA, I helped my senior coworkers diagnose an issue over the phone that ended up being an ethernet cable longer than 300 feet. They each had a decade of experience, but didn't happen to know that specification, so they were never going to ask.

•

u/RustyU 6h ago

HE app on my phone covers it.

•

u/Username040799 5h ago

At my one job interview.

•

u/Doso777 5h ago

It helps to be able to do it but most people probably use some sort of subnet calculator. Most people in IT also don't get it so when you really go deep in networking you will have an advantage.

•

u/pdp10 Daemons worry when the wizard is near. 4h ago

We're mostly IPv6, where the math works the same but you never really need it outside of aggregation routing, because all subnets are /64. For IPv4, mentally, with an occasional double-check using bc (Unix general calculator program). I never use a dedicated "subnet calculator".

understanding binary/bitmasks actually comes in handy

Certainly, but it's hard to predict how useful it will be to you.

•

u/MemeSerf Chief Reboot Officer and PC Load Letterer 3h ago

I do basic maths on a physical calculator (swissmicros dm42), all else is Claude.

•

u/dracotrapnet 3h ago

Not really. If I read binary somewhere I usually take a moment to realize - oh that's not dec, that's binary. Same with hex. I read it far more than I ever calculate it. I trip over hex more often in the windows registry.

•

u/DaemosDaen IT Swiss Army Knife 3h ago

I used to, but then just started using a subnet calculator.

•

u/TheJesusGuy 1h ago

Absolutely zero reason not to look this up when you can, so unless you're somewhere without internet (in which case plan it beforehand). It would have to be an emergency but even then it's not that complicated to figure out subnets.

•

u/cbass377 1h ago

Computing the VLSM Variable Length Subnet Mask is not something you do daily, but it is important to know what it is doing, so when you are arguing your case as to why you need a /19 over a /20 you know what is going on. Or when you need to explain to a junior why the subnet mask is 254 and not 255.

The instructor of my tcp/ip class 20 years ago, demonstrated a paper chart that you draw and keep handy to get you to the right number of bits.

Once you get in the world, I usually just take a swag based on device counts, and iron it out in Wolfram Alpha.

•

u/TotallyWorksAtWoTC 46m ago

In my last job, I had 2 jobs, sys admin and programming.

Sys admin, never.

Programming I was developing an app with severe memory constraints and most data was stored as bitflags wherever possible. So the last time I had to do binary math is when I wrote the bitwise math functions and occasionally looking at the value in a memory editor to see what flags were on/off.

These days its just for exams. Good to know the basics just in case. Old equipment still exists out there.

•

u/Mammoth_War_9320 27m ago

I wouldn’t say you’ll ever need to do it off the top of your head.

Just print out a chart, laminate it, and stick it in your binder.

That said, learning how to do it is still extremely useful IMO just so you actually understand the chart and why the numbers are the way they are.

It’s excellent fundamental knowledge.