30 ms·
IP addresses and routing
- magicalhippo 8y ago"This post is only about IPv4 because I’ve still never used IPv6." IPv6 almost seems to be the networking equivalent of DAB radio at this point. A once futuristic tech that grew old in the tooth waiting for its moment. At least IPv6 is getting developed and it's is easier to update than DAB, so one can hope that one day in the far future it becomes usable to people like me.
- chungy 8y agoFor most purposes, IPv6 works the same as v4 (only it has bigger addresses: 128-bit instead of 32-bit). Everything in the blog post works identically if you just swap in IPv6 addresses :)
- blattimwind 8y ago> For most purposes, IPv6 works the same as v4 Theoretically yes, in practice not at all. Just one major difference: No NAT any more.
- okket 8y ago> No NAT any more The funny thing is, there will be mandatory NAT on the carrier side during transition to IPv6 because of unwillingness of major websites to announce AAAA (including this one). See [0] for some transition method examples. The common theme of these methods is: They spoof DNS to point to fake IPv6 addresses, which is horrible, HORRIBLE, but hopefully motivates IPv4 holdouts to move to IPv6, announce AAAAs. If you want to see what a wasteland IPv6 still currently is, and why such transition NAT madness will be necessary (sadly): Try disabling IPv4 when you have native IPv6 and your carrier has not enabled such DNS spoofing transition methods yet. [0] https://en.wikipedia.org/wiki/IPv6_transition_mechanism https://en.wikipedia.org/wiki/IPv6_transition_mechanism
- disiplus 8y agoi also disable ipv6 on my servers for abuse purposes, it is to easy to get iv6 addresses
- okket 8y agoPlease do not disable IPv6.
- blattimwind 8y agoDisagree. If you've only got IPv4 experience and have a number of possibly legacy devices on your network, then there is a significant amount of learning and changes required to make it work with IPv6 (securely). It's entirely reasonable to say "It works fine without [=zero business value], no need to invest that amount of work.". This makes IPv6 a negative value proposition for many orgs.
- mirimir 8y agoIt depends on the context. I mostly focus on users of VPN services. It's still rare for them to handle IPv6 traffic. So if you have IPv6 connectivity, IPv6 will leak, bypassing the VPN. Unless you have firewall rules, or disable IPv6 while using the VPN.
- kiallmacinnes 8y agoDo you mean you turn off IPv6, because it's easy for others to get lots of IPs and bypass a IP blacklist? If so, that is a difference from IPv4. Don't block IPs, block subnets. Block the whole /64. It's what you were doing with IPv4 anyway - blocking a whole building / office / etc at once! That's still no reason to turn IPv6 off in my humble opinion...
- ryanlol 8y agoIPv6 ratelimiting can be a bit tricky, you block my /64 and I come back with a /48 and so on. Most stuff defaults to bucketing by /64s.
- rohan1024 8y ago>No NAT I'm in India and my mobile service provider (Jio) is handing out ipv6 addresses. The fascinating thing about this is I was able to access a server hosted on my phone from Internet. Crazy!
- ramshanker 8y agoNext everyone hosting his/her own website from his/her own smartphone. I am loving this era.
- mirimir 8y agoWhat phone? And what scope, local or global? Maybe a firewall would be prudent ;)
- dvfjsdhgfv 8y ago> For most purposes, IPv6 works the same as v4 (only it has bigger addresses: 128-bit instead of 32-bit) That's the understatement of the year. IPv6 is a huge protocol and its complexity is its main weakness and one of the main reasons people and organizations stay away from it.
- ldite 8y agoOff the top of my head, ARP &. NDP are rather different - NDP is an IP protocol, unlike ARP.
- magicalhippo 8y agoIf by "for most purposes" you mean something else than actually using IPv6 in a network. For one, address allocation is entirely different. Devices will have several addresses, and some of them can be temporary addresses. If your ISP assigns you dynamic prefixes (mine does), you can end up with devices not being able to connect to the internet after the router/modem reboots, since they're not told about the new prefix you just got from your ISP and happily keeps using the old one. If your ISP assigns you dynamic prefixes (mine does), dynamic DNS is required for each server box (apparently one can centralize this by using DHCP-PD, but I haven't figured this out for my pfSense router). And if you're writing an IPv6-enabled application, parsing client/server address input is a PITA compared to IPv4. The list goes on and on, but these were the major pain points I found while trying to use IPv6 at home, which are non-existent when using IPv4.
- navaati 8y ago> If your ISP assigns you dynamic prefixes (mine does) Well there goes your problem…
- magicalhippo 8y agoYes it's not what is currently (19 years after IPv6 RFC) considered best practices[1], but that's what my ISP hands me, so that's what I got to work with. [1]: https://www.ripe.net/publications/docs/ripe-690 https://www.ripe.net/publications/docs/ripe-690
- woah 8y agoThis is not true. They changed almost every detail in ipv6, from the address notation, to the fragmentation, to the peer discovery. Some of these may have been improvements, some not. But at the end of the day, all that anyone ever needed was a few more octets on the address. IPv4 with a couple extra dots would have been adopted 15 years ago.
- sp332 8y agoYeah, remember when IPSec was mandatory? And the two different schemes (never standardized I guess) that would have let you have a "home" IP address and a "network"/real IP address, so if you were streaming a video the source would send to one IP even as you hopped networks? Good times.
- sedachv 8y ago> But at the end of the day, all that anyone ever needed was a few more octets on the address. IPv4 with a couple extra dots would have been adopted 15 years ago. You are completely ignoring routing issues. IPv6 is designed from the ground up for efficient route aggregation, and more importantly the processes ARIN and RIR use for allocation are based around this. There is no way IPv4 routing would scale to what IPv6 is going to be in 10 years if you "just added" some octets. What are you going to do, force everyone to re-number?
- fulafel 8y agoWhat's your main issue with its usability? v6 deployment is going up and looks like it's on track to replace v4, so the DAB analogy sounds a little diminuitive. I get v6 on my mobile and on my broadband, and in all respects it seems to work well for making the internet end-to-end addressable again. With the devices like RPis and VMs/containers, the simplicity is refreshing vs hacks involving port forwards or using a for-$$ service as a proxy.
- lgierth 8y agoActually the last RIPE meeting in May had a presentation that analyzed why IPv6 adoption seems to stall since ~beginning of 2018: https://ripe76.ripe.net/presentations/9-2018-05-17-ipv6-reasons.pdf https://ripe76.ripe.net/presentations/9-2018-05-17-ipv6-reas... HN discussion: https://news.ycombinator.com/item?id=17060437 https://news.ycombinator.com/item?id=17060437
- magicalhippo 8y agoSome pain points as a residential user: - IPv6 ready hardware. I went through several routers (Asus and similar), and it wasn't until I ended up with pfSense that IPv6 actually worked for more than a couple of hours. - IPv6 ready software. Some software just gets slower when it first tries IPv6, fails and falls back to IPv4 (especially noticeable browsing the web). Some software gets all confused about IPv6 being present and stops working. - IPv6 requires DNS, even with static prefix (I have dynamic prefix). For servers, that means per-server dynamic DNS entry. Very few DynDNS providers supports dynamic AAAA records, at least when I checked last year. And getting DynDNS clients working on the servers was a nightmare. For IPv4 I just need to keep one DNS entry up to date, with plenty of DynDNS options all around. - Dynamic prefix requires firewall rules to be updated when prefix changes. I wasn't able to figure out how to configure this in pfSense, though I admit I had lost some motivation at this point. As a residential user who still gets a proper IPv4 address from my ISP, IPv6 doesn't really bring that much to the table. I still have to fiddle with my router/firewall, and at this point IPv4 NAT is a lot simpler to configure (linking rules to NAT entires for example).
- sedachv 8y ago
- SpaethCo 8y ago> At least IPv6 is getting developed and it's is easier to update than DAB, so one can hope that one day in the far future it becomes usable to people like me. Millions of people unknowningly use IPv6 every day: smartphone users on mobile networks. You either get an IPv4 address in 100.64.0.0/10 Carrier Grade NAT space or RFC1918 10.0.0.0/8 space, and a fully routeable IPv6 address. Your mobile application experience tends to be far better with services that can take advantage of native IPv6 connectivity.
- cup-of-tea 8y agoI've forgotten so much about networking. I just haven't had any need to use the knowledge since I learnt it in university. Back then I borrowed a copy of Tanenbaum's Computer Networks and it was great. I considered buying a copy for my bookshelf recently but it's very expensive now. It makes me sad because when I was younger I seemed to remember everything forever. Now I realise there are large swathes that I've forgotten and most I probably don't even know I've forgotten.
- barking 8y agoThe only consolation is that you'd likely pick it up a lot more quickly now if you return to it.
- scarecrowbob 8y agoWell, another consolation is that if you're forgetting it, you might not be needing it... so it's not so bad to forget some things.
- fhood 8y agoAt least you learned it (and from the same textbook I used in school. Dope!). It seems like a lot of universities treat their networks classes like an afterthought, but it is such a critical part of computation, and an incredible way to learn, and see demonstrated, principles that are far more general than just networks.
- krallja 8y agoI was just thinking last night about how valuable having taken a 200-level Computer Networks class is for me as a DevOps engineer. I use knowledge from that class almost every work day. TCP/IP and sometimes even Ethernet can be used to reason about all sorts of things.
- karmakaze 8y agoI recently tried using a computer set up with only an IPv6 stack to do some websocket testing. Turned out that the websocket implementation in iOS version of WebKit (including iOS 12 beta4) still has some issues. Also most of the internet isn't connected. Ended up using 'show cached' from Google results a lot.
- Hello71 8y ago> a bunch of other stuff which I don’t understand that well (metric 600, scope link, proto kernel, etc). Not understanding what those things mean hasn’t hurt me yet. These are pretty straightforward. metric 600 means that out of all the otherwise-identical routes, the kernel will prefer this one to one with a metric of 601 or greater. scope link means that this address is only valid on the local link (network interface). scope global means that (the kernel assumes) this address is valid on the wider Internet. proto kernel means that the kernel automatically installed this route for you because you used "ip address add x/y". Now, the "table x" part is actually really interesting, because Linux doesn't just support "a route table", it supports 256 routing tables. These are used in conjunction with policy routing in order to support source address routing, firewall mark based routing, and others. Firewall mark based routing is extremely powerful: for example: MARK all packets on port 53 whose (using BPF) first DNS query question is jvns.ca, and send those using eth1 instead of eth0. More mundanely, wg-quick from WireGuard uses this feature to bypass the VPN for the VPN packets, which allows the VPN to be used for the VPN gateway.
- eximius 8y agoRight, so you need to publish a networking textbook on this stuff, okay? If that sounds too dreary, I'd take a suggestion for one.
- buro9 8y agoRecently I discovered how weird IP addresses are on local machines: Ping the following: 1.1.257 3.141592 0x01000001 198.2742178 All the fault of https://linux.die.net/man/3/inet_aton https://linux.die.net/man/3/inet_aton as everyone follows the implementation and there is no RFC on how to shorthand/collapse an IP address.
- pingofdoom 8y agolol so those ping to two different addresses: ping 192.168.1.64 ping 192.168.1.064 Good material for underhanded c contest...
- akeruu 8y agoThis happens more often then you might think. A lot of people are adding padding when they need to store IPs. So they can be easily sorted using alphanumeric sort: 192.168.001.001 192.168.001.002 192.168.001.003 ... 192.168.001.254 And then use it that way to connect to servers, causing lots of confusions.
- rashkov 8y agowait, really? padding with zeros maps to a different IP address than the non-padded version? Is that because a leading zero causes it to be interpreted as an octal number?
- iooi 8y agoYes. In [2]: socket.inet_aton('226.000.000.037') Out[2]: b'\xe2\x00\x00\x1f' In [3]: socket.inet_aton('226.000.000.37') Out[3]: b'\xe2\x00\x00%' In [4]: socket.inet_ntoa(b'\xe2\x00\x00\x1f') Out[4]: '226.0.0.31' In [5]: socket.inet_ntoa(b'\xe2\x00\x00%') Out[5]: '226.0.0.37'
- kiallmacinnes 8y agoOh, wow. I.. wow. No words come to me! Learn something new everyday!
- PresidentObama 8y ago> a bunch of other stuff which I don’t understand that well (metric 600, scope link, proto kernel, etc). Not understanding what those things mean hasn’t hurt me yet. This is what I like about Julia's writing - she is frank and tells you when she doesn't know.
- djohnston 8y agoyeah she always gives you a really good starting point and if you care about those things you have the foundation you need to dig deeper.
- dfsegoat 8y agoEvery time I read an article or infographic by Julia Evans, I can't help but feel a bit of excitement, because even after 15+ years of linux/programming experience, I still learn something new every time. I genuinely hope there are awards/accolades for people that bring this much value to the linux/programming/computing community.
- mirimir 8y agoYes, I also loved this. Bookmarked it. Amusing anecdote. I'm entirely self-taught about computer stuff. I mean, it barely existed when I was a student. So anyway, descriptions of packet structure seemed so abstract and handwaivy. So for a few Ethernet and TCP/IP packets, I used Wireshark to get bytes from each field as hexadecimal, and crunched the data in Excel. It was incredibly tedious, but ultimately satisfying.
- rconti 8y agoI love her style. She knows a lot, but is VERY open to being wrong or not knowing things fully. That is to say, she's happy to say something that might not be 100% correct but is the way she understands it, or to admit she only knows 10% of this one thing. There's utterly zero arrogance but also there's not really a lack of confidence. It's almost a childlike wonder/excitement about things. In using that approach, it makes the reader appreciate the subject as well, feel happy about the things they know in common with Julia, feel happy about the things the reader knows that she doesn't know YET, and also feel comfortable that "hey, here's somebody else who ALSO doesn't understand this topic that well!" In every way, it's the exact opposite of imposter syndrome, both for the writer and for the reader. I think too many of us (at least, based on my own experience) don't feel like we know enough to share with people. You both don't realize what you know that others don't, but are also anxious about being wrong or presenting yourself as an expert when you are not, for fear of ridicule or judgement or whatever. She's such a great asset to the community.
- knicholes 8y agoI wish there were more clarity in the point where your ISP sends the packet to "your computer." The packet goes to your modem, which is plugged into some network adapter (this is the network "device," right?). Then the network adapter sends the signal to another network device? That doesn't make sense to me. Certainly the network hardware receives the signal before the OS?
- wyldfire 8y ago> The packet goes to your modem, which is plugged into some network adapter (this is the network "device," right?). From the point of view of your OS' routing table, the "network device" is the OS device that represents the local network device. Ms Evans cites three examples; one's a real hardware WLAN device (likely connected to the system via PCIe or USB-via-PCIe). The "modem" you're referring to is probably your or your ISP's "cable modem"? If so, the cable modem function of this device is (very nearly) transparent to the IP layer and we can ignore it for the sake of the routing table. I believe many/most of these modems function as a layer 2 bridge. The sequence of events when packets arrive from the ISP is: 1. packet is forwarded from ISP to your cable modem. 2. cable modem receives the packet, sees that the destination address belongs on "this side" of the bridge and forwards it. 3. Computer's NIC ("network interface card") receives a packet, copies it into memory and interrupts the processor. 4. OS interrupt service routine handles the interrupt by posting a flag and copying the incoming data to another buffer. 5. OS' network stack realizes this packet is an IP packet and starts to process it according to local rules (next layer up, etc). ...lots of details omitted from above for the sake of clarity, but I can add more if you want. Slight variations of the above occur depending on the specific deployment of router-vs-cable-modem-vs-DSL-vs-NIC-config etc.
- knicholes 8y agoAh, there it is! Okay, I know it's being pedantic, but the whole NIC aspect is what I was looking for. Taking my OS theory class at 8am was a bad choice. Thank you so much for the excellent explanation!
- kop316 8y ago
- corndoge 8y agometric 600 if two routes to the same destination exist the kernel will (in general) use the one with the lower metric proto kernel this is where the route came from, for most end user hosts this will be kernel but if your box is running a dynamic routing protocol this might be something like "ospf", "bgp", etc; those protocols learn routes from neighbors and install them into the kernel routing table scope link this is information about the distance to the nexthop, in this case link means the nexthop is on the local network
- SteveNuts 8y agoI've got a bunch of static routes on my linux boxen using iproute2 tables to send traffic down the correct interfaces, do you think there's a better way using dynamic routing? If so what should I start googling?
- corndoge 8y agoIf the topology is simple then managing static routes can be way easier than doing dynamic routing correctly, otherwise I'd start looking at BGP. Your best option right now in terms of software is FRR or bird. But first you should understand dynamic routing and decide if it's right for your use case. https://en.wikipedia.org/wiki/Dynamic_routing https://en.wikipedia.org/wiki/Dynamic_routing
- betaby 8y agoI heavily recommend LARTC http://test.richb-hanover.com/lartc-redesign/ http://test.richb-hanover.com/lartc-redesign/ (looks like main site is down at that moment)
- cproctor 8y agoAs a middle-school CS teacher, I wrote a networking simulation [1] to help my students get a sense of how the packets get routed to their destinations. Importantly, it's vulnerable to spoofing, snooping, and censorship... students figure out how to do this mischief on their own, which leads to some great discussions of technical, policy, and ethical aspects of the Internet. [1] https://github.com/cproctor/tcp-ip-simulation https://github.com/cproctor/tcp-ip-simulation
- kqr 8y agoThank you for your service as a great teacher. We need more people like you! This is absolutely great.