It's not a terribly complicated subject, but you do need a fair understanding of IP and UDP. TCP too, because it is possible to establish direct TCP connection through two NATs using the symmetrical open clause of the TCP handshake. Looks like magic when you see it work for the first time.
Stevens' book is a must read, yes, but it has nothing even on NAT (iirc), leave alone on working around it. Look at how NAT works, what types of it exist, etc. Then look at "hole punching". For bonus points skim through p2p-hackers mailing list archives from 2003 and thereabouts.
Very little has changed in this area since mid-00's, people just rediscover and re-implement the same thing over and over again. Few get it 100% right (IMO) due to sticking to prediction being done client-side. That's inferior to the server doing it, because it gets you more precise timing and better prediction rate.
What do you suggest as a learning resource for things like this? The STUN RFC's? The Stevens' networking book?