It only takes a generation or two to build an internet from scratch
Think about it: One of the key predecessors of the Internet, ARPANET started in 1969. Look where we are today - or even 20 years ago. It did not take long to go from "nothing" to the Internet as we know it. That was starting with:
- Low speed modems
- No (or very minimal) networking protocols
- No web servers
- No FTP servers
As I often say, Knowledge is the Key. Even if there was NOTHING left except the very basics (e.g., even a few old 16-bit computers would be enough to get started) and some determined hackers, it would be possible to start essentially from scratch and build up to full 21st-century level internet in a matter of a few years (guesstimating 1 - 30 depending on the hardware issues).
About the only thing that will be really hard to do is to create a chip fab. So a key will be salvaged hardware to get through the first few decades.
Even assuming that all large equipment on-grid and most cell phones and other wireless devices were "fried" by the apocalypse due to EMP and other effects, there would likely be some equipment that survived. It only takes one server with a full LAMP stack to get things jump-started as far as software. A few computers, routers and other equipment (and really a computer can be a router and a router can be a computer - as with the first days of ARPANET, there is no fundamental difference) salvaged from the rubble somewhere and you have all the hardware you need to get started.
DNS and some other pieces will not be so easy. But if you are in a small group then you essentially run as one large local network and, if necessary, hardcoded addresses. Not hard to do with a little bit of surplus equipment.
In addition to hardware, your new Internet will require software. Easiest solution by far is one Linux machine with everything on it. Which is not that unusual. Everything else is copies of copies plus a few hackers that start building useful web sites. No Amazon for a few years - but only because there are no warehouses full of goods and fleets of trucks to deliver them. But basic web sites for social networking, barter & sales, government, etc. can all be done pretty quickly.
If you have to start truly from scratch then it still won't take a generation. The simple knowledge that it CAN be done, together with some basics of how to do it will lead to a few programmers putting together something resembling a web server in a few years. Very different from 1969 when most of us had no idea what we could accomplish.
There are 4 types of connectivity involved. Each has advantages/disadvantages:
Wired connections (e.g., 100 Meg. or 1 Gig. copper) are the easiest. Salvage some cable (every destroyed building is filled with it) and you can put together a network 100 meters at a time very easily. Longer connections are a little tougher because you can't order a line-driver/extender on Amazon, though a few years of work and that can get resolved too. But in the short term, start with a basic 100 Meg. network and you can extend it around town using every switch and router you find.
WiFi is also pretty easy. Get a few salvaged access points running and you're all set. Actually, WiFi will probably work better than it does now because, initially at least, there won't be any interference! But WiFi is range-limited, and again you won't be able to easily get top-quality longer-range access points for a few years.
Fiber is the best. But unless you can find a good cache of cable and top-quality tools, fiber will take longer to get online than copper. You can't just splice together bits & pieces the way you can with copper.
- Cellular and other long-range wireless
This will be the hard one to do. The cell phone network was destroyed in the apocalypse, and even if you can find an occasional functional cell, it is useless without the infrastructure which depends on the phone company's demolished data center. So connectivity will be limited to wires and WiFi for a few years.
Last, but not least, is power. None of this will work without a reliable power source. But everything else in modern civilization needs power too, so that will be one of the top priorities (along with food) for the survivors. Once they have reliable power, the Internet will be easy. While powering the internet will be a lower priority than powering lighting, machinery in factories and many other things, the basic internet will not require much power - a few hundred watts here & there. You won't have big data centers, with their big power requirements, for a while.