How many ip addresses/hosts in a /32 subnet?

thomas_thomas_ Member Posts: 1,012 ■■■■■■■■□□
I had an interview recently and was asked, "How many ip addresses/hosts in a /32 subnet?" I can't remember if the interviewer said hosts or ip addresses because I was confused about the question. A /32 isn't a valid subnet as you need at least a subnet id, a subnet broadcast and addresses for hosts.. A /32 only has one ip address so you don't have enough addresses for a subnet id, subnet broadcast or hosts.

A /31 will give you two ip addresses, so you can have a subnet id and a subnet broadcast. However, you won't have any ip addresses for hosts.

I told the interviewer "zero" to which he responded that there were four possible addresses in a /32 subnet, but only two usable. I remember being completely confused about why he would say there are four possible ip addresses in a /32 subnet.

Today while thinking about the interview the only thing I can think of to make sense of the situation is that either he said "/32 subnet" but really meant to say "/30 subnet" or he said "/30 subnet" and I heard "/32 subnet". However, I'm almost certain that he said "/32 subnet".

This is a crappy situation because no matter which one it was, I look like an idiot. If he said "/32 subnet" but meant "/30 subnet" and he didn't realize that he misspoke then in his mind I'm stupid for not knowing how many ip addresses are available in a "/30 subnet". If he said "/30 subnet" and I heard "/32 subnet"(unlikely) then I still look like an idiot for not knowing how many ip addresses are available in a "/30 subnet."

Anyone else have a similar situation happen in an interview?

Comments

  • DeathmageDeathmage Banned Posts: 2,496
    A /32 would be used for either a loopback IP or a 255.255.255.255 is also referred to as a broadcast address.

    It's actually a trick question. If you don't know it you'd definitely scratch you're head and think about it..which is what I believe they we're looking for...

    As for the lowest range you can use that would be a /30. As you know you minus two for Network and Broadcast ID's and since a /30 has 4 addresses you are only left with two usable addresses. A /31 wouldn't work but I've heard rumors in higher levels of Cisco you can use a /31. Perhaps a higher Cisco Engineer could explain better.

    As for himself if he said a /32 has 4 addresses and only two are usable then he himself is the moron and not you. That would only work with a /30 unless he is a IEEE board member and he's reinventing IP Subnetting and forgot to leave a memo.
  • NetworkVeteranNetworkVeteran Member Posts: 2,338 ■■■■■■■■□□
    How many IPs map to a /32? I would answer ONE. The all ones mask means it matches exactly one address. /32's are commonly used for loopbacks, and routes to those loopbacks. Four is an odd answer--the precise phrasing may make a difference.
    A /31 will give you two ip addresses, so you can have a subnet id and a subnet broadcast. However, you won't have any ip addresses for hosts.
    A better choice and one supported by RFCs is that a /31 allows two hosts and no all-zeroes or all-ones broadcast addresses. It's suitable for point-to-point links, where any message is clearly meant for the "other" side, and there's little need for broadcasts.
  • thomas_thomas_ Member Posts: 1,012 ■■■■■■■■□□
    How many IPs map to a /32? I would answer ONE.

    At that point you changed the question. :) I understand that a /32 CIDR represents a single ip address, but would that single ip address also be considered a subnet?
    Four is an odd answer--the precise phrasing may make a difference.

    This is what baffled me the most. If he would have said one Ip address maps to a /32 I could have seen where he was coming from. This is why I think he either misspoke or I heard the question wrong. I really think it's the former, but do concede the possibilty exists for it to be the latter(however small.)
    A better choice and one supported by RFCs is that a /31 allows two hosts and no all-zeroes or all-ones broadcast addresses. It's suitable for point-to-point links, where any message is clearly meant for the "other" side, and there's little need for broadcasts.

    Interesting, I learned something new today. Will router's let you configure the ip address of an interface with a /31 subnet mask?
  • networker050184networker050184 Mod Posts: 11,962 Mod
    Yes you can use /31s on routers. You will get a little warning to use it carefully on Ethernet interfaces.
    An expert is a man who has made all the mistakes which can be made.
  • aderonaderon Member Posts: 404 ■■■■□□□□□□
    A better choice and one supported by RFCs is that a /31 allows two hosts and no all-zeroes or all-ones broadcast addresses. It's suitable for point-to-point links, where any message is clearly meant for the "other" side, and there's little need for broadcasts.


    That's really interesting. Didn't know that. You got me interested enough to read the RFC icon_thumright.gif
    2019 Certification/Degree Goals: AWS CSA Renewal (In Progress), M.S. Cybersecurity (In Progress), CCNA R&S Renewal (Not Started)
  • BlackBeretBlackBeret Member Posts: 683 ■■■■■□□□□□
    As far as subnetting goes, it sounds like your theory is the only one that makes sense. He said /32 and meant /30, or you misheard him.

    As far as uses for /32, I've seen and used a few scripts where they require an IP address range listed in CIDR notation. I use /32 when I want to specify a single IP address. For simplicity's sake it could be referred to as the /32 subnet since you're specifying a netmask. You seem to be focusing on the word "subnet" that he used, but his question was about how many hosts/ip addresses there were total.

    This is one of those times where asking for clarification or giving a complete answer to demonstrate your knowledge rather than a simple answer would be good. "I'm sorry sir, did you ask how many hosts are in a /32 subnet? A /32 would point to a single IP address, but that wouldn't constitute a valid subnet."

    I've known some managers to purposefully use impossible scenarios to see how a candidate would respond. At a certain point people should be able to admit when they don't know something and ask for clarification or assistance. If you're working on something and realize you're not sure what's going on, will you bulldoze ahead and risk screwing things up, or will you stop and ask for help? You seemed to realize something wasn't right, why not ask for clarification. It definitely seems he meant /30.
  • W StewartW Stewart Member Posts: 794 ■■■■□□□□□□
    In this type of situations I would usually explain with a lot of detail how a /32 is a mask used to represent a single host. I always be sure to back up my answers with detailed explanations rather than just a simple answer to demonstrate why my answer is right since I typically know more than the people interviewing me anyway.
  • Know_WonKnow_Won Member Posts: 2 ■■□□□□□□□□
    Know it's an old question but /32 is often used in firewall setup to say that something is only allowed access to that 1 IP address.
    So if you are NATing a public IP say 1.2.3.4 and say server 1 is on 192.168.0.1 and is web server, then 192.168.0.2 is email server you might set up the firewall to something like 1.2.3.4:80/32->192.168.0.1:80/32 and 1.2.3.4:25/32->192.168.0.2:25/32. another example could be if you have an office with a fixed public IP that you will connect remotely to your network then in the firewall you may tell it to only accept external connections from the remote office IP. so say the remote office is 4.3.2.1 and you ssh into equipment you might block all IPs and then allow 4.3.2.1:22/32->1.2.3.4:22/32
    another time I have seen it was when getting a single public static IP  from an ISP which I am not sure how it worked but have seen a /32 public IP address assigned to a circuit and then a default gateway outside the subnet, some equipment can handle this, other devices can't, but have seen it several times and not just with /32 public IPs but even with /29 (6 host ips with a dedicated network address) which is even more confusing, it is not common but I have seen it a few times and when it does happen
  • JDMurrayJDMurray Admin Posts: 13,023 Admin
    /32 = 1 IP address
    /31 = 2 IP addresses
    /30 = 4 IP addresses
    /29 = 8 IP addresses
    etc.
  • mgeoffriaumgeoffriau Member Posts: 162 ■■■□□□□□□□
    Necro thread but oh well we're discussing it now. 

    As many others have pointed out, /32 defines a single IP. The term "subnet" is a bit confusing, but there are valid references to a /32 mask.

    Regarding the interview, he was either confused, misspoke, or was intentionally laying a trap to see how you'd react. I had a colleague recently reveal that during my team interview (in which he participated as an interviewer), he intentionally mispronounced a term to see how I would react.
    CISSP || A+ || Network+ || Security+ || Project+ || Linux+ || Healthcare IT Technician || ITIL Foundation v3 || CEH || CHFI
    M.S. Cybersecurity and Information Assurance, WGU
  • Swift6Swift6 Member Posts: 268 ■■■■□□□□□□
    JDMurray said:
    /32 = 1 IP address
    /31 = 2 IP addresses
    /30 = 4 IP addresses
    /29 = 8 IP addresses
    etc.
    Can't think of a better answer. I don't see how else you could have more than 1 IP in a /32.
  • ruthbeckruthbeck Member Posts: 5 ■■□□□□□□□□
    JDMurray said:
    /32 = 1 IP address
    /31 = 2 IP addresses
    /30 = 4 IP addresses
    /29 = 8 IP addresses
    etc.
    Does this rule work here?
  • kaijukaiju Member Posts: 453 ■■■■■■■□□□
    /32 = no zero bits therefore 2(0 power) = 1
    Work smarter NOT harder! Semper Gumby!
Sign In or Register to comment.