<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Routing on datahacker</title>
		<link>https://datahacker.blog/reference/networking/routing/</link>
		<description>Recent content in Routing on datahacker</description>
		<generator>Hugo</generator>
		<language>en-us</language>
		
		
		
		
			<lastBuildDate>Tue, 24 Nov 2026 00:00:00 +0000</lastBuildDate>
		
			<atom:link href="https://datahacker.blog/reference/networking/routing/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>Netmask/Genmask Conversion Table</title>
				<link>https://datahacker.blog/reference/networking/routing/netmask-genmask-conversion-table/</link>
				<pubDate>Sun, 25 Aug 2019 00:00:00 +0000</pubDate>
				<guid>https://datahacker.blog/reference/networking/routing/netmask-genmask-conversion-table/</guid>
				<description>&lt;p&gt;This chart converts IPv4 prefix lengths to dotted decimal, hexadecimal, inverse, and binary masks. It also separates the number of addresses in a prefix from the number commonly assigned to hosts.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span id=&#34;section-1&#34;&gt;&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;migration-heading-1&#34;&gt;Static Chart&lt;/h2&gt;&#xA;&lt;p&gt;An IPv4 prefix of length &lt;code&gt;p&lt;/code&gt; contains &lt;code&gt;2^(32-p)&lt;/code&gt; addresses. The inverse mask is the bitwise complement of the netmask.&lt;/p&gt;&#xA;&lt;p&gt;For a conventional subnet with distinct network and broadcast addresses, the familiar host-count calculation subtracts two. &lt;strong&gt;That calculation is not universal:&lt;/strong&gt; &lt;a href=&#34;https://datatracker.ietf.org/doc/html/rfc3021&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34; title=&#34;Opens in a new tab&#34;&gt;RFC 3021&lt;/a&gt; permits both addresses of a &lt;code&gt;/31&lt;/code&gt; on a point-to-point link. A &lt;code&gt;/32&lt;/code&gt; identifies one address, commonly used for a host route.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Linux Network Routing Best Practices</title>
				<link>https://datahacker.blog/tutorials/networking/routing/linux-network-routing-best-practices/</link>
				<pubDate>Wed, 14 Aug 2019 00:00:00 +0000</pubDate>
				<guid>https://datahacker.blog/tutorials/networking/routing/linux-network-routing-best-practices/</guid>
				<description>&lt;p&gt;Here are some brief concepts to keep in mind when adding new routes and routing tables.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span id=&#34;section-1&#34;&gt;&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;migration-heading-1&#34;&gt;Routing Table Names and IDs&lt;/h3&gt;&#xA;&lt;p&gt;The &lt;code&gt;rt_tables&lt;/code&gt; file assigns names to numeric table IDs; it does not contain routes or determine lookup order. Keep these conventions in mind:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Use unambiguous names and IDs that do not conflict with existing configuration.&lt;/li&gt;&#xA;&lt;li&gt;Keep the built-in mappings intact: local is 255, main is 254, and default is 253.&lt;/li&gt;&#xA;&lt;li&gt;IDs between 100 and 200 are a possible local convention, not a kernel requirement.&lt;/li&gt;&#xA;&lt;li&gt;Gaps between table IDs are optional. Rule priorities, not table IDs, control lookup order.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The &lt;a href=&#34;https://man7.org/linux/man-pages/man8/ip-route.8.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34; title=&#34;Opens in a new tab&#34;&gt;ip-route manual&lt;/a&gt; describes table IDs and reserved values; &lt;a href=&#34;https://man7.org/linux/man-pages/man8/ip-rule.8.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34; title=&#34;Opens in a new tab&#34;&gt;ip-rule&lt;/a&gt; describes policy order.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Split Gateway Tutorial</title>
				<link>https://datahacker.blog/tutorials/networking/routing/split-gateway-tutorial/</link>
				<pubDate>Wed, 14 Aug 2019 00:00:00 +0000</pubDate>
				<guid>https://datahacker.blog/tutorials/networking/routing/split-gateway-tutorial/</guid>
				<description>&lt;p&gt;Thinking of creating split routes or split gateways? This article introduces the building blocks of directing different traffic through different gateways, using a simple VPN and direct Internet connection as the intended example.&lt;/p&gt;&#xA;&lt;aside class=&#34;dh-callout dh-callout-important&#34; aria-label=&#34;Important&#34;&gt;&lt;strong class=&#34;dh-callout-label&#34;&gt;Important&lt;/strong&gt;&lt;div&gt;&#xA;&lt;p&gt;&lt;strong&gt;Recovery Guidance&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Changing routes or gateways can disconnect you from your server, even if you&amp;rsquo;re connected through another machine on the same LAN. Before you begin, make sure you have a way to recover that doesn&amp;rsquo;t depend on the network configuration you&amp;rsquo;re changing. That could be a local console, your hosting provider&amp;rsquo;s console, or a separate management connection.&lt;/p&gt;&#xA;&lt;p&gt;Keep a copy of the working configuration and confirm how you would restore it through that independent access. Test the recovery connection before making changes.&lt;/p&gt;&#xA;&lt;p&gt;A reboot may undo changes made only to the running configuration, provided nothing saves or reapplies them at startup. Once you&amp;rsquo;ve made the changes persistent, rebooting can bring the same problem right back. Don&amp;rsquo;t rely on a restart unless you know the startup configuration will restore working connectivity.&lt;/p&gt;&#xA;&lt;/div&gt;&lt;/aside&gt;</description>
			</item>
			<item>
				<title>Gateways</title>
				<link>https://datahacker.blog/reference/networking/routing/gateways/</link>
				<pubDate>Thu, 08 Aug 2019 00:00:00 +0000</pubDate>
				<guid>https://datahacker.blog/reference/networking/routing/gateways/</guid>
				<description>&lt;p&gt;In an IP route, a &lt;em&gt;gateway&lt;/em&gt; is a next-hop router used to reach destinations beyond the directly reachable link. That link can be physical or virtual. This article explains how to recognize gateway routes and distinguish them from local delivery.&lt;/p&gt;&#xA;&lt;p&gt;Analyzing the output of network route inspection tools such as &lt;strong&gt;ip route&lt;/strong&gt;, &lt;strong&gt;route&lt;/strong&gt;, and &lt;strong&gt;netstat&lt;/strong&gt; will allow you to identify network gateways. The details of how to use those tools are discussed in several other articles on this website, including:&lt;/p&gt;</description>
			</item>
			<item>
				<title>Routing Prefixes</title>
				<link>https://datahacker.blog/reference/networking/routing/routing-prefixes/</link>
				<pubDate>Mon, 05 Aug 2019 00:00:00 +0000</pubDate>
				<guid>https://datahacker.blog/reference/networking/routing/routing-prefixes/</guid>
				<description>&lt;p&gt;Additional, related information may be found in the following articles:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://datahacker.blog/reference/networking/routers-routes-subnets-and-netmasks/&#34;&gt;Routers, Routes, Subnets, and Netmasks&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://datahacker.blog/reference/networking/brief-history-of-linux-networking/&#34;&gt;A Brief History of Linux Networking&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://datahacker.blog/reference/networking/routing/iproute-and-routing-tables/&#34;&gt;iproute and Routing Tables&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://datahacker.blog/reference/networking/routing/route-and-netstat/&#34;&gt;route and netstat&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;aside class=&#34;dh-callout dh-callout-note&#34; aria-label=&#34;Note&#34;&gt;&lt;strong class=&#34;dh-callout-label&#34;&gt;Note&lt;/strong&gt;&lt;div&gt;&#xA;&lt;p&gt;Familiarity with Linux network routing principles is recommended, including &lt;strong&gt;route&lt;/strong&gt; and &lt;strong&gt;iproute2&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;/div&gt;&lt;/aside&gt;&#xA;&lt;p&gt;&lt;span id=&#34;routing_prefix&#34;&gt;&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;migration-heading-1&#34;&gt;Routing Prefixes&lt;/h2&gt;&#xA;&lt;p&gt;An IPv4 routing prefix describes a destination range using a network address and a length from 0 to 32 bits. &lt;a href=&#34;https://datatracker.ietf.org/doc/html/rfc3222&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34; title=&#34;Opens in a new tab&#34;&gt;RFC 3222&lt;/a&gt; discusses the terminology.[&lt;a href=&#34;#end1&#34;&gt;1&lt;/a&gt;]&lt;/p&gt;</description>
			</item>
			<item>
				<title>Introduction to Split Gateways</title>
				<link>https://datahacker.blog/reference/networking/routing/introduction-to-split-gateways/</link>
				<pubDate>Sat, 20 Jul 2019 00:00:00 +0000</pubDate>
				<guid>https://datahacker.blog/reference/networking/routing/introduction-to-split-gateways/</guid>
				<description>&lt;p&gt;Having explained &lt;a href=&#34;https://datahacker.blog/reference/networking/routing/gateways/&#34;&gt;gateway routes&lt;/a&gt;, this article examines what the series calls a &lt;em&gt;split gateway&lt;/em&gt;: routes or policies that send selected traffic through different paths.&lt;/p&gt;&#xA;&lt;p&gt;It focuses on reading the configuration and reasoning about route selection. The &lt;a href=&#34;https://datahacker.blog/tutorials/networking/routing/split-gateway-tutorial/&#34;&gt;Split Gateway Tutorial&lt;/a&gt; covers configuration examples. “Split gateway” here is descriptive terminology, not a special Linux route type or a way to bypass routing validation.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span id=&#34;section-1&#34;&gt;&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;migration-heading-1&#34;&gt;Gateway or Route?&lt;/h2&gt;&#xA;&lt;p&gt;A route is a table entry describing a destination prefix and how matching traffic should be handled. It can lead directly through an interface or via a next-hop router. A host route describes one address; it is not restricted to a physically attached host.&lt;/p&gt;</description>
			</item>
			<item>
				<title>route and netstat</title>
				<link>https://datahacker.blog/reference/networking/routing/route-and-netstat/</link>
				<pubDate>Sat, 20 Jul 2019 00:00:00 +0000</pubDate>
				<guid>https://datahacker.blog/reference/networking/routing/route-and-netstat/</guid>
				<description>&lt;p&gt;This section describes the use of alternative tools to the &lt;em&gt;iproute2&lt;/em&gt; suite for viewing the status of a network. They may be old, but &lt;strong&gt;route&lt;/strong&gt; and &lt;strong&gt;netstat&lt;/strong&gt; can still be useful when troubleshooting IPv4 routing tables.&lt;/p&gt;&#xA;&lt;p&gt;The examples below use one illustrative IPv4 topology throughout: &lt;code&gt;eth0&lt;/code&gt; has address &lt;code&gt;192.168.10.10/24&lt;/code&gt;, and its next-hop router is &lt;code&gt;192.168.10.6&lt;/code&gt;. They are explanatory output, not a capture from the reader&amp;rsquo;s host. These legacy tools show only part of modern Linux routing state; use &lt;code&gt;ip route&lt;/code&gt; and &lt;code&gt;ip rule&lt;/code&gt; for policy routing.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Special Routing Use-Case Scenarios (iproute2)</title>
				<link>https://datahacker.blog/tutorials/networking/routing/special-routing-use-cases-iproute2/</link>
				<pubDate>Sat, 20 Jul 2019 00:00:00 +0000</pubDate>
				<guid>https://datahacker.blog/tutorials/networking/routing/special-routing-use-cases-iproute2/</guid>
				<description>&lt;p&gt;Linux routes can select a path, return a terminal error, or supply a preferred source address for locally generated traffic. These functions are different from firewall filtering and Network Address Translation (NAT).&lt;/p&gt;&#xA;&lt;p&gt;&lt;span id=&#34;section-1&#34;&gt;&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;migration-heading-1&#34;&gt;Dropping Packets&lt;/h2&gt;&#xA;&lt;p&gt;A route can reject or discard traffic without specifying an output device. This affects packets whose policy lookup selects that route; an earlier matching policy rule or a more specific route can change the result.&lt;/p&gt;</description>
			</item>
			<item>
				<title>iproute and Routing Tables</title>
				<link>https://datahacker.blog/reference/networking/routing/iproute-and-routing-tables/</link>
				<pubDate>Fri, 19 Jul 2019 00:00:00 +0000</pubDate>
				<guid>https://datahacker.blog/reference/networking/routing/iproute-and-routing-tables/</guid>
				<description>&lt;p&gt;Routes describe how the kernel reaches destinations. Policy rules decide which routing tables to consult. Together they provide Linux policy routing; iptables is a separate packet-filtering interface, not a third component of the RPDB.&lt;/p&gt;&#xA;&lt;h2 id=&#34;section-1&#34;&gt;Routes&lt;/h2&gt;&#xA;&lt;p&gt;&lt;code&gt;ip route&lt;/code&gt; belongs to iproute2 and manages kernel routing tables. The older &lt;code&gt;route&lt;/code&gt; command belongs to net-tools. It can still help when reading historical output, but it does not provide iproute2&amp;rsquo;s policy-table controls.&lt;/p&gt;&#xA;&lt;p&gt;Use &lt;code&gt;ip -4 route show table all&lt;/code&gt; to inspect all IPv4 tables, or name one table explicitly. Modern Linux table identifiers are 32-bit values, not a limit of 256 tables. The reserved identifiers and optional names are explained below.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Policy Based Routing</title>
				<link>https://datahacker.blog/reference/networking/routing/policy-based-routing/</link>
				<pubDate>Fri, 19 Jul 2019 00:00:00 +0000</pubDate>
				<guid>https://datahacker.blog/reference/networking/routing/policy-based-routing/</guid>
				<description>&lt;p&gt;A routing table describes paths to network destinations. Linux can use several tables, with a Routing Policy Database (RPDB) deciding which table to consult. The policies are expressed as rules; the tables hold the routes.&lt;/p&gt;&#xA;&lt;p&gt;The RPDB provides a way to choose among several routing tables based on traffic attributes. Rules and routes are separate. Several rules can consult the same table, or different rules can consult different tables. This lets you make routing decisions beyond a single destination-based table.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Routing and Filtering Network Traffic</title>
				<link>https://datahacker.blog/reference/networking/routing/routing-and-filtering-network-traffic/</link>
				<pubDate>Wed, 17 Jul 2019 00:00:00 +0000</pubDate>
				<guid>https://datahacker.blog/reference/networking/routing/routing-and-filtering-network-traffic/</guid>
				<description>&lt;p&gt;A brief, high-level introduction to Linux routing and packet filtering: what the kernel decides, and which tools configure those decisions.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span id=&#34;section-1&#34;&gt;&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;migration-heading-1&#34;&gt;10,000 Foot View&lt;/h2&gt;&#xA;&lt;p&gt;Routing selects how a packet reaches its destination. Packet filtering decides whether a packet is allowed to proceed. Packet modification, including NAT and marking, is another function that can interact with those decisions. These functions work together, but they are not interchangeable layers of one command.&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
