34

Many moons ago, when I was just a wee bairn commencing my career, I had a job interview for a low-level developer role. Having at that time just learned how CIDR was implemented, I was keen to show off my knowledge.

Sadly, that tactic didn't work out too well for me. I recall being completely floored by the very first question that was asked (and, then ruffled, it all went downhill). The question was:

Why are IPv4 addresses 32-bit?

I readily admitted that I didn't know the answer, but I did know that the original protocol design divided the address space into an 8-bit network number and a 24-bit host identifier—so I tried to rationalise it on the grounds that the protocol designers imagined an Internet of a few networks (after all, it was originally intended to link together a specific few) each comprising many hosts and, for simplicity of programming, kept everything aligned to byte boundaries.

I recall the interviewer being unsatisfied with my answer and suggesting to me that the real reason is that it's guaranteed to fit inside a long int in C, so simplifies implementation details. Being young and green at the time, I accepted that as a reasonable answer and (before today) hadn't thought any more of it.

For some reason that conversation has just returned to me and, now that I reflect upon it, it doesn't seem entirely plausible:

  1. Under the original addressing scheme comprising fixed-size network and host fields, it's unlikely that a developer would have wanted to assign the concatenation of the two fields to a single variable (I don't have access to any early IP implementations to verify what they actually did in practice); and

  2. At the time that works on TCP/IP began, C was neither standardized nor the de facto "lingua franca" of low-level software development that it has become today.

Was the interviewer's suggestion actually founded in fact? If not, what were the real reasons that the protocol designers chose 32-bit addressing?

3
  • 3
    Same reason why 640 kB ought to be enough for anybody. Nobody expected toasters and fridges to have internet access.
    – user5694
    May 15, 2014 at 17:32
  • 1
    @afwe: Hm. The question wasn't why didn't they choose a bigger number to begin with? aka why only 32-bits? (which is really the point that \@Jens' excellent answer addresses), but more what was so special about 32-bits (rather than, say, 16-bits or 24-bits or 48-bits)?
    – eggyal
    May 15, 2014 at 18:01
  • 1
    @Downvoter: Care to comment?
    – eggyal
    May 23, 2014 at 21:51

3 Answers 3

23

Here's a link to a Hangout with Vint Cerf (Apr. 2014) where he explains how he thought that this internet was supposed to be an experiment only:

As we were thinking about the Internet (thinking well, this is going to be some arbitrary number of networks all interconnected — we don't know how many and we don't know how they'll be connected), but national scale networks we thought "well, maybe there'll be two per country" (because it was expensive: at this point Ethernet had been invented but it wasn't proliferating everywhere, as it did do a few years later).

Then we said "how many countries are there?" (two networks per country, how many networks?) and we didn't have Google to ask, so we guessed at 128 and that would be 2 times 128 is 256 networks (that's 8 bits) and then we said "how many computers will there be on each network?" and we said "how about 16 million?" (that's another 24 bits) so we had a 32-bit address which allowed 4.3 billion terminations — which I thought in 1974/3 was enough to do the experiment!

I had already posted this as a comment to Jens Link's answer, but I felt it shoud surface a bit more.

2
  • More than "surface a bit more", I think that this answers the actual question more directly than Jens's answer.
    – eggyal
    May 19, 2014 at 8:21
  • 1
    This feels like someone rationalising a descision they had already made. Really 32-bits is the obvious answer, 16 bits is obviously too small and few if any platforms at the time would have had support for 64-bit numbers, so a 64-bit address would have to be split up and handled in multiple parts. Jan 22, 2020 at 18:12
34

Easy answer: because Vint Cerf decided so. He thought that he was designing an experimental protocol and considered 32-bits to be more than sufficient for that purpose; he did not expect IPv4 to be used in production systems and so no greater thought was given to the size of the address space.

At the Google IPv6 Conference 2008, he hosted a panel discussion titled What will the IPv6 Internet look like? during which he recounted:

The decision to put a 32-bit address space on there was the result of a year’s battle among a bunch of engineers who couldn’t make up their minds about 32, 128 or variable length. And after a year of fighting I said — I’m now at ARPA, I’m running the program, I’m paying for this stuff and using American tax dollars — and I wanted some progress because we didn’t know if this is going to work. So I said 32 bits, it is enough for an experiment, it is 4.3 billion terminations — even the defense department doesn’t need 4.3 billion of anything and it couldn’t afford to buy 4.3 billion edge devices to do a test anyway. So at the time I thought we were doing a experiment to prove the technology and that if it worked we’d have an opportunity to do a production version of it. Well — [laughter] — it just escaped! — it got out and people started to use it and then it became a commercial thing.

Transcript by Peter E. Murray.

16
  • 7
    Agh, how foolish of me! Occam's razor strikes again. At least you have given me the smug satisfaction of knowing that the interviewer was wrong.
    – eggyal
    May 15, 2014 at 15:43
  • 2
    @user5025: Yes, it is possible (in the general case). But if Vint says those were his reasons for choosing 32-bits for IPv4, then it's hard to argue that he also had others.
    – eggyal
    May 15, 2014 at 15:56
  • 5
    @user5025: Okay, that's a fair point. Indeed, he mentions that the engineers were squabbling over what the length should be, with some advocating 32-bit. So I suppose the question is what were their motivations for advocating 32-bit (i.e. what made it acceptable to Vint)?
    – eggyal
    May 15, 2014 at 16:15
  • 2
    @eggyal: My point is not that 32 bit integers were "definitely" a motivating factor, but rather to suggest that I would consider it highly plausible that enough of the engineers suggesting that size might have considered that a factor that, absent evidence to the contrary, I don't think it could be ruled out as a factor in the eventual choice.
    – supercat
    May 15, 2014 at 23:20
  • 2
    @eggyal: You asked what might have motivated engineers to pick 32 bits. My intention was to answer that particular question. I've written a TCP/IP stack on "bare metal" and had to deal with addresses on various occasions but was never interested in parsing them--only in determining whether they matched [this particular stack only handled incoming TCP/IP connections, so it had to deal with ARP, but not gateways].
    – supercat
    May 15, 2014 at 23:32
0

Word size. They were writing software, not designing computer hardware - although I'm sure they had performance and portability in mind. At that time, 32 bit was the word, the longword, or int or longInt or whatever. See Word Size Choice.

They wrote this software "during the first decades of 32-bit architectures (the 1960s to the 1980s)." -Wikipedia

2
  • 3
    Unless you're suggesting that the architects of TCP/IP had a particular machine architecture in mind, I'm not sure where you're going with this argument... do you have any evidence that they were using/designing for 32-bit architectures, or even that the word size was a relevant consideration to the length they selected for the network address?
    – eggyal
    Jan 8, 2017 at 18:01
  • @eggyal: Languages for 8-bit and 16-bit machines often included a 32-bit integer data type, but it was far less common for languages on 32-bit machines to have multi-word integer data types. At least at the source-code level, working with 32-bit values is essentially as convenient as working with 16-bit values, and is definitely more convenient than working with larger types. Further, for devices that have limited communications needs, 32-bit addressing could be just fine if they communicate through more sophisticated gateways.
    – supercat
    Oct 16, 2018 at 17:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.