TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How Do Routers Work, Really?

398 pointsby turingbookover 4 years ago

13 comments

geerlingguyover 4 years ago
I learned how routers <i>really</i> work from Ericsson&#x27;s seminal video on the matter, The Good Warriors of the Net: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=x9XWxD6cJuY" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=x9XWxD6cJuY</a><p>Though I always thought the &quot;router switch&quot; was much more fun.
评论 #24438353 未加载
评论 #24437048 未加载
评论 #24439749 未加载
评论 #24437265 未加载
评论 #24436317 未加载
评论 #24436970 未加载
评论 #24440190 未加载
Cyph0nover 4 years ago
&gt; If that is the case, my condolences.<p>As a software engineer working on IOS-XR, that gave me a chuckle :p<p>In the case of enterprise- and SP-grade routers, the data-plane - i.e., where the actual forwarding and lookups take place - runs entirely on a dedicated network processor (NP), mainly for performance reasons. Information on the NP is populated by the router&#x27;s operating system in response to user configuration, network topology changes, or protocol state updates. On the other hand, the control plane runs mainly on the CPU(s). This is required so that the protocols running on the router OS (e.g., BGP) can receive and send out updates based on their state machines.
评论 #24436900 未加载
评论 #24436869 未加载
xg15over 4 years ago
&gt; <i>Note that the next hop’s IP address is in the router’s memory only: it does not appear in the packet at any time.</i><p>This clears some points that always puzzled me:<p>If the gateway is identified by an IP address, but the destination host is also an IP address, which address exactly is put into the packet? And how can a packet be routed if the gateway&#x27;s IP is itself part of the subnet that&#x27;s supposed to be routed to it. (E.g. 192.168.0.0&#x2F;24 with default gateway 192.168.0.1)<p>So the answer is, if I send the packet to host 1.1.1.1 but the routing table has 2.2.2.2 as the next hop, the packet will have 1.1.1.1 as the destination in the IP part but the <i>MAC of 2.2.2.2</i> as destination of the Ethernet part (or equivalent). It doesn&#x27;t matter which subnet the next hop&#x27;s IP is in, as the routing table isn&#x27;t consulted for it anyway - it&#x27;s only used in ARP)<p>This leaves the question, why the indirection and why the mucking around with ARP and IPs that are never used as the destination to anything?<p>Couldn&#x27;t you simply put the next hop&#x27;s MAC address (instead of IP address) into the routing table and be able to route packets just as well, with a lot less complexity?
评论 #24436947 未加载
评论 #24436471 未加载
评论 #24436507 未加载
评论 #24436552 未加载
评论 #24439809 未加载
评论 #24436764 未加载
评论 #24436486 未加载
评论 #24441036 未加载
评论 #24436417 未加载
评论 #24441010 未加载
评论 #24437723 未加载
评论 #24436525 未加载
评论 #24437307 未加载
anotherkamila_over 4 years ago
Hi, I&#x27;m the author. Uh hi w00t how why what&#x27;s it doing here?! :D<p>I promise to make it better and actually finish it now! Check back in a day or two I guess? Also I should post the code I promised. Hello from the ADHD squirrel!
评论 #24436375 未加载
评论 #24443555 未加载
pfarrellover 4 years ago
I would suggest expanding your terminology section. I know almost nothing about routers and I&#x27;m lost in the first sentence of the High Level Overview section.<p><pre><code> &quot;A switch (or an L2 switch :-) ) is an L2-only thing.&quot; </code></pre> I don&#x27;t know what L2 means. I suspect a definition of the various levels would expand the audience for this post.
评论 #24436141 未加载
评论 #24436451 未加载
评论 #24437109 未加载
评论 #24435998 未加载
评论 #24436062 未加载
评论 #24436030 未加载
评论 #24436730 未加载
评论 #24438760 未加载
评论 #24439555 未加载
评论 #24436374 未加载
icedchaiover 4 years ago
Maybe a mention of other, non-ethernet, links. Serial PPP? Frame Relay? I realize these are mostly historical curiosities these days, but it might help to enforce the differences between L2 and L3.<p>When I first started working with routers, over 25 years ago, it was all ethernet LAN to serial WAN, usually point-to-point T1 or frame relay. On site had a <i>dual</i> T1, load balanced on both ports of a Cisco 2501. Fun times.
rabuseover 4 years ago
I learned a lot about networking when setting up servers in racks. Had to deal with issues arising from terrible UI&#x27;s on a lot of the routers out there, so I just kept digging deeper and deeper into how it all works. Also, if more are looking into how packets are actually routed, look into BGP, and how CDN&#x27;s work. Great stuff.
评论 #24436665 未加载
boryasover 4 years ago
I believe this piece does a good job with forwarding, but would be improved by a discussion of termination.<p>Routing is only triggered when the packet is L2 terminated: the destination MAC of the packet is one of the router&#x27;s own MACs.<p>If the packet&#x27;s destination MAC does not belong to the router, it doesn&#x27;t matter what is in its IP header, it will be switched in the LAN it came in on.<p>This design also generalizes nicely to the case when the destination IP of a routed packet is one of the router&#x27;s IPs.
评论 #24436984 未加载
teleforceover 4 years ago
I teach computer networking class with lab using Linux Switch Appliance (LISA) and Quagga router (based on Zebra) on embedded computer running x86 CPU with multi-port Ethernet. The embedded router need to be dual-boot for its specific function because LISA is based on custom Linux kernel but Quagga is just using normal&#x2F;vanilla kernel.<p>I am looking for a &quot;layer 3 switch&quot; than has switching and routing functionalities without rebooting. If anyone know any software based open source solution for this it will be very helpful. Preferably with Cisco IOS like user command interface but it is optional but not mandatory.<p>Based on the article, it is explaining router internal based on P4. Perhaps I should try to use P4 for the above mentioned requirements?
评论 #24439764 未加载
评论 #24439150 未加载
评论 #24438468 未加载
bogomipzover 4 years ago
&gt;&quot;It needs to be routed: the router, based on L3 information, decides where it needs to go ,in L3 speak – it will decide which host to send it to, but not how. This corresponds to the routing table (or FIB).&quot;<p>This is not correct. The FIB(forwarding information base) is concerned with layer 2. The RIB(routing information base) determines the next hop. The RIB is what is used to populate entries in the FIB with the correct outgoing interface. These two terms are basic router terms. It was kind of surprising to see this statement in a post titled &quot;How Do Routers Work, Really?&quot;
评论 #24436873 未加载
wbsunover 4 years ago
Click is a very good software router to read and learn: <a href="https:&#x2F;&#x2F;github.com&#x2F;kohler&#x2F;click" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;kohler&#x2F;click</a><p>It can be more than a router though.
dnauticsover 4 years ago
this is great if for no other reason that in section 1 it explains the difference between a switch and a router (which took me a decade? to really understand). I really wish someone could have laid it out clearly for me.
mrburtonover 4 years ago
I just have to say this &quot;magnets how do they work&quot;? ;) Anyone get the reference?