Hacker News new | past | comments | ask | show | jobs | submit login

Does anyone have book recommendations for like a complete covering of how we get the lower layers working for networking? I believe I understand stuff in isolation but every time I read a full thing I get a lot into “wait but why am I not worrying about packet ordering issues when doing random socket stuff with Python” style existential dilemmas

Thinking of something that might be equivalent to “NAND to Tetris” for networks. I want to know how the wires work fully!




The data on the wires really varies too much to cover like a nand2tetris where you can walk through one way to do it from the ground up and call it good. Generally if there is a way to transmit data it's possible and probably your socket could go over it or some combination. Even taking a narrow scope such as "copper cables carrying ethernet" leads to various collision algorithms, encodings, wire counts, and optional components like PoE to consider and that's not counting "copper cables with something else that can transport encapsulation ethernet data efficiently".

Generally though you really don't care about how the data gets on the wire (I mean it's definitely interesting but it doesn't help you any more at a practical than thinking about what happens at the ethernet frame layer).

Also when it comes down to it not only is the physical encoding wildly different most each step of the way but it's not even ethernet. I.e. the only thing that matters are the guarantees of the socket interface, not the guarantees of what it rides over. The socket may ride over some transport which guarantees in order delivery and no congestion or it may ride over some transport which guarantees nothing, not even in order delivery. What matters is what the socket guarantees, e.g. is it a TCP socket provided by the OS where the OS guarantees it'll reassemble, handle loss, handle out of order, etc for you or is it something like a UDP socket which leaves most of these up to you (or a raw socket where the OS really isn't doing much of anything for you).

That being said if you want to pick a single example just to walk through it bottom to top one time pick 1G RJ45 copper between two PCs which have a TCP session going. There isn't really a need for a book, just the Wikipedia articles on gigabit Ethernet, IPv4, and TCP. It's just that this isn't always the stack so it doesn't really matter what Ethernet/IPv4 happen to give you - all that matters is what the TCP socket says it's going to guarantee.


I don't have good recommendations for a book, but I can recommend spending a few weeks implementing it. libpacp is probably the easiest way to send and receive raw ethernet frames, and you only need to implement ARP, IP, and TCP to have something not unlike telnet.

ARP and IP are fairly easy to implement, and TCP is as well as long as it doesn't need to be fast (e.g., live with a fixed and smallish window size, discard out-of-order packets, don't bother with selective ACK, etc).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: