SysAdmin2022/index.html

354 lines
12 KiB
HTML
Raw Normal View History

2021-09-29 21:52:51 +10:00
<!doctype html>
<html>
2021-09-29 23:04:50 +10:00
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>SysAdmin2022</title>
<link rel="stylesheet" href="dist/reset.css">
<link rel="stylesheet" href="dist/reveal.css">
<link rel="stylesheet" href="dist/theme/solarized.css">
2021-10-06 21:06:23 +11:00
<style type="text/css">
/* Copyright notice */
#copyright {
position: absolute;
bottom: 0%;
left: 0%;
text-size: tiny;
}
.reveal .footer {
position: absolute;
bottom: 1em;
left: 1em;
font-size: 0.5em;
}
</style>
2021-09-29 23:04:50 +10:00
<!-- Theme used for syntax highlighted code -->
<link rel="stylesheet" href="plugin/highlight/monokai.css">
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<h2>Learning about slightly more advanced networking with linux</h2>
<p><b>Paul Warren</b></p>
<p>Mastodon: @pwarren@mastodon.thewarrens.name </p>
<p>email: paul at thewarrens.name </p>
2021-10-06 21:06:23 +11:00
<p>&copy; 2021 Paul Warren</p>
<p>CC BY-NC-SA<p>
2021-09-29 23:04:50 +10:00
</section>
2021-09-30 22:04:57 +10:00
<section><h2 style="color:red">! WARNING !</h2>
2021-10-06 20:39:47 +11:00
<p>I am not a network engineer, there are gaps in my knowledge</p>
<p>The words I use might not be the correct ones</p>
2021-09-30 22:04:57 +10:00
<p>Please don't blame me if your network stops networking</p>
<p class="fragment">Maybe don't go and try building an ISP based off this talk :)</p>
</section>
2022-01-13 23:09:51 +11:00
<section><h2>What even is a network?</h2>
2021-09-29 23:04:50 +10:00
<p class="fragment fade-in-then-out">Ethernet?</p>
<p class="fragment fade-in-then-out">Token Ring?</p>
<p class="fragment fade-in-then-out">IPX?</p>
<p class="fragment fade-in-then-out">AX.25?</p>
</section>
2022-01-13 23:09:51 +11:00
<section><h2>What even is a network?</h2>
2021-09-29 23:04:50 +10:00
<p class="fragment fade-in-then-out">ipv4?</p>
<p class="fragment fade-in-then-out">ipv6?</p>
2021-09-30 22:04:57 +10:00
<p class="fragment fade-in-then-out">tcp?</p>
2021-09-29 23:04:50 +10:00
<p class="fragment">Allows connections between computers</p>
2021-11-15 20:48:40 +11:00
<aside class="notes">
<p>We are going to mostly focus on Ethernet and IPv6</p>
2021-09-29 23:04:50 +10:00
</section>
2022-01-13 23:09:51 +11:00
<section><h2>Managed networks</h2>
2021-09-29 23:04:50 +10:00
<p class="fragment"><b>Controls</b> connections between computers</p>
2021-10-06 20:39:47 +11:00
<p class="fragment"><b>Scales</b> connections between computers</p>
2021-09-29 23:04:50 +10:00
<p class="fragment"><img src="3tier.png" /><p>
<aside class="notes">
2021-10-06 20:39:47 +11:00
<p>Most of us probably work in a managed network</p>
2021-11-15 20:48:40 +11:00
<p>Most of us probably have a pretty flat edge network at home</p>
2021-10-06 20:39:47 +11:00
<p>Diagram is nice, but hides complexities at each layer.<p>
2021-09-29 23:04:50 +10:00
</aside>
</section>
2021-09-30 22:04:57 +10:00
<section><h2>Layers!</h2>
2021-10-06 20:39:47 +11:00
<p class="fragment">Like an onion!</p>
<p class="fragment">That 7 layer thing from the OSI</p>
2021-11-23 19:13:24 +11:00
<p class="fragment">Ethernet -> IP -> ICMP/TCP/UDP</p>
2021-10-06 20:39:47 +11:00
<p class="fragment">Administrative overlays</p>
2021-10-16 19:37:58 +11:00
<p class="fragment">VPNs and Tunnels</p>
2021-10-06 20:39:47 +11:00
<aside class="notes">
<p>or a parfait</p>
2021-11-23 19:13:24 +11:00
<p>which you can mostly ignore, as what we generally use doesn't conform to it. But it does provide a good framework for assisting understanding</p>
2021-10-16 19:37:58 +11:00
<p>Like firewalls, web-proxies/SSL MITM, But also access rights etc</p>
2022-01-13 23:09:51 +11:00
</aside>
2021-10-16 19:37:58 +11:00
</section>
2022-01-13 23:09:51 +11:00
<section><h2>Layers</h2>
2021-10-20 16:41:25 +11:00
<p>This means the Physical layers do not have to match the Logical connections</p>
2021-10-16 19:37:58 +11:00
<p class="fragment">Networks are also a bit fractal in nature</p>
<p class="fragment">For the purposes of this talk, we can ignore a lot of complexity</p>
</section>
2021-11-23 19:13:24 +11:00
<section><h2>An easy one!</h2>
2021-11-15 20:48:40 +11:00
<p>VLANS</p>
<p class="fragment">Ethernet layer</p>
<p class="fragment">Designed to limit broadcast storms</p>
<p class="fragment">Can also separate IP networks on the same Ethernet</p>
2021-12-20 07:13:39 +11:00
<p class="fragment">Tagged and Untagged/Default</p>
<p class="fragment">IEEE 802.1Q</p>
2021-11-15 20:48:40 +11:00
<aside class="notes">
2021-11-23 19:13:24 +11:00
<p>beware of strange implementations, windows seems to take Router Advertisements from all vlans, regardless of tag</p>
2022-01-13 23:09:51 +11:00
</aside>
2021-11-15 20:48:40 +11:00
</section>
2022-01-13 23:09:51 +11:00
2021-11-15 20:48:40 +11:00
<section><h2>VLANs in linux</h2>
<p>Are pretty easy!</p>
2021-11-23 19:13:24 +11:00
<pre class="fragment"><code data-trim data-noescape>
2021-11-15 20:48:40 +11:00
ip link add link enp0s2 name enp0s2.2501 vlan id 2501
ip -6 addr add 2001:db8:2501::10/64 dev enp0s2.2501
ip link set dev enp0s2.2501 up
2021-12-20 07:13:39 +11:00
</code>
2021-11-15 20:48:40 +11:00
</pre>
2021-11-23 19:13:24 +11:00
</section>
2021-11-15 20:48:40 +11:00
2021-11-23 19:13:24 +11:00
<section><h2>VLANs in linux</h2>
<p>Various different methods of making it go in different distributions</p>
2021-12-20 07:13:39 +11:00
<p class="fragment">Debian: in /etc/network/interfaces</p>
2022-01-13 23:09:51 +11:00
<pre class="fragment">
2022-01-12 19:57:07 +11:00
<code>auto enp1s0.2502
iface enp1s0.2502 inet dhcp
iface enp1s0.2502 inet6 auto</code>
2021-12-20 07:13:39 +11:00
</pre>
<p class="fragment">OpenWRT has a nice GUI</p>
2021-11-23 19:13:24 +11:00
2021-12-20 07:13:39 +11:00
<aside class="notes">
<p>OpenWRT: can also use the hardware present on most hardware routers to assign vlans to specific ports</p>
</section>
2022-01-13 23:10:15 +11:00
<section><h2>VLANs in linux</h2>
<p>Here's what I've done</p>
<img src="Diagrams/MyVLans.png"></img>
<aside class="notes">
<p>Guest Wifi</p>
<p>Access VLAN</p>
<p>Netflix, Youtube, my webhost, desktops/work computers</p>
</aside>
</section>
2021-11-23 19:13:24 +11:00
<section><h2>What even is a router?</h2>
2021-10-25 15:59:55 +11:00
<p class="fragment">Two or more interfaces</p>
<p class="fragment">Some logic to determine where a packet goes</p>
<aside class="notes">
<p>Not necessarily physical</p>
<p>Sounds simple right?</p>
2021-12-20 07:13:39 +11:00
</aside>
2021-10-25 15:59:55 +11:00
</section>
<section><h2>Linux Routing</h2>
2022-01-13 23:09:51 +11:00
<p>Add to sysctl config:</p>
2021-10-25 15:59:55 +11:00
<pre class="fragment"><code data-trim data-noescape>
2021-12-20 07:13:39 +11:00
net.ipv4.ip_forward = 1
net.ipv6.conf.all.forwarding = 1
net.ipv6.conf.default.forwarding = 1
2021-10-25 15:59:55 +11:00
</code>
</pre>
<p class="fragment">And we're done!</p>
<p class="fragment">Yeah, not really :)</p>
2021-12-20 07:13:39 +11:00
</section>
2022-01-13 23:09:51 +11:00
<section><h2>Static Routes</h2>
2021-10-25 15:59:55 +11:00
<p>Manually added, or scripted routes that don't change</p>
<pre><code data-trim data-noescape>
ip route add 172.17.0.0/24 via 172.16.0.254 dev wg0
</code>
</pre>
</section>
2021-12-20 07:13:39 +11:00
2022-01-13 23:09:51 +11:00
<section><h2>Static Routes</h2>
<pre width="110%"><code width="110%">ip -6 route add 2001:db8:2501::/64 via 2001:db8:2500::1 dev enp0s1
2022-01-12 19:57:07 +11:00
ip -6 route add 2001:db8:2502::/64 via 2001:db8:2500::1 dev enp0s1
2022-01-13 23:09:51 +11:00
ip -6 route add 2001:db8:2600:beef:/64 via 2001:db8:face::1 dev wg0</code>
2021-12-20 07:13:39 +11:00
</pre>
<aside class="notes">
<p>As you can imagine this quickly becomes unwieldy with expanding networks</p>
</aside>
</section>
2021-10-25 15:59:55 +11:00
2022-01-13 23:09:51 +11:00
<section><h2>Static Routes</h2>
<img src="Diagrams/MyVLansExt.png"></img>
</section>
2021-12-20 07:13:39 +11:00
<section><h2>Enter dynamic routes</h2>
2022-01-13 23:09:51 +11:00
<p class="fragment">Advertise your LANs</p>
<p class="fragment">Discovering routes to other LANs</p>
<p class="fragment">Optional: Do some logic</p>
<p class="fragment">Add them to the routing table</p>
2022-01-02 10:36:36 +11:00
<p class="fragment">Userspace daemons</p>
<p class="fragment">talking to the kernel networking stack</p>
2021-12-20 07:13:39 +11:00
</section>
2021-10-25 16:11:13 +11:00
<section><h2>Dynamic Routing</h2>
<p>Open Shortest Path First (OSPF)</p>
2022-01-13 23:09:51 +11:00
<p>Uses Dijkstra's algorithm</p>
2021-10-25 16:11:13 +11:00
<p class="fragment">RFC2328</p>
<p class="fragment">RFC5340</p>
2022-01-02 10:36:36 +11:00
<p class="fragment">For: Dynamic routes inside your networks</p>
2021-10-25 16:11:13 +11:00
</section>
2021-10-16 19:37:58 +11:00
2021-10-25 16:11:13 +11:00
<section><h2>Dynamic Routing</h2>
<p>Border Gateway Protocol (BGP)</p>
<p class="fragment">RF4271</p>
2022-01-13 23:09:51 +11:00
<p class="fragment">For: Sharing dynamic routes outside your network with other Autonomous Sytstems (AS)</p>
<notes class="aside">
<p>"AS" is used a lot in the ISP world, and your ISP will have an assigned AS Number</p>
</notes>
2022-01-02 10:36:36 +11:00
</section>
<section><h2>The Userspace Daemons</h2>
<p>BIRD: Berkeley Internet Routing Daemon</p>
<p>Quagga: Fork of Zebra</p>
2022-01-13 23:09:51 +11:00
<p>OpenBGPd/OpenOSPFd: from the OpenBSD project</p>
2022-01-02 10:36:36 +11:00
<p class="fragment">Significant overlap, but they are different</p>
2022-01-13 23:09:51 +11:00
<p class="fragment">I've not used Quagga, or the OpenBSD ones</p>
<p class="fragment">There are probably others!</p>
2021-09-29 23:04:50 +10:00
</section>
2021-10-25 16:11:13 +11:00
2022-01-08 21:24:04 +11:00
<section><h2>intro to bird</h2>
<p>Powerful</p>
<p class="fragment">Complex to configure</p>
<p class="fragment">Use version control</p>
<aside class="notes">
<p>Not quite turing complete</p>
2022-01-13 23:10:15 +11:00
<p> git on /etc/bird or wherever your distro stores it.</p>
2022-01-08 21:24:04 +11:00
</aside>
</section>
2022-01-13 23:10:15 +11:00
<section><h2>Intro to bird configuration</h2>
<p>/etc/bird.conf</p>
<pre><code data-trim data-noescape>router id 10.9.99.6;
log "/var/log/bird/bird.log" all;
debug protocols { states, routes, filters, interfaces }
protocol kernel {
import none;
export all;
}
protocol device {
# defaults...
}
</code>
</pre>
</section>
2022-01-08 21:24:04 +11:00
<section><h2>Intro to bird configuration</h2>
<p>/etc/bird.conf</p>
<p>Each router needs a unique ID</p>
2022-01-13 23:10:15 +11:00
<p class="fragment">Protocol blocks, There are lots of types</p>
<p class="fragment">They are how bird knows what to talk to and how</p>
2022-01-08 21:24:04 +11:00
<aside class="notes">
2022-01-13 23:10:15 +11:00
<p>router ID. usually one of router's IPv4 addresses. Default: the lowest IPv4 address of a non-loopback interface. World (your network) unique<p>
2022-01-08 21:24:04 +11:00
2022-01-02 10:36:36 +11:00
</section>
2022-01-08 21:24:04 +11:00
2022-01-12 21:38:09 +11:00
<section><h2>Intro to bird configuration</h2>
2022-01-13 23:10:15 +11:00
<pre><code data-trim data-noescape>protocol ospf {
area 0 {
interface "lo" {
stub;
};
interface "vlan1001" {
};
interface "vlan1034" {
stub;
};
};
}
</code>
</pre>
<notes class="aside">
<p> There are a lot more options than stub or default</p>
<p>BIRD documentation is really good</p>
2022-01-12 21:38:09 +11:00
</section>
2022-01-02 10:36:36 +11:00
2022-01-13 23:10:15 +11:00
<section><h2>Intro to bird configuration</h2>
<p><img src="Diagrams/bird-prototable.png"></img></p>
2022-01-13 23:11:10 +11:00
<notes class="aside">
<p>Import vs Export</p>
<p>Master Table</p>
<p>Logic in Pipes</p>
2022-01-13 23:10:15 +11:00
</section>
2022-01-08 21:24:04 +11:00
2021-10-16 19:37:58 +11:00
<section>Multi Host IPs (Authoritative DNS example like in the facebook thing)</section>
2021-10-20 16:41:25 +11:00
2022-01-13 23:11:10 +11:00
<section><h2>A funky thing you can do with OSPF</h2>
<p>A necessary service</p>
<p class="fragment">Contained within a network</p>
<p class="fragment">Data more efficiently obtained across local links</p>
<p class="fragment">Can still get the costly versions if local goes down</p>
</section>
<section><h2>A funky thing you can do with OSPF</h2>
<p>An IP for a host that provides that service</p>
<p class="fragment">Can use that same IP in two different places in the network</p>
<p class="fragment">Confused routing?</p>
<p class="fragment">OSPF to the rescue!</p>
</section>
<section><h2>A funky thing you can do with OSPF</h2>
<p><img src="OSPF_HA.png"></img></p>
</section>
2022-01-08 21:24:04 +11:00
<section>Why use a 'real' router</section>
<section><h2>¿Por qué no los dos?</h2>
<p>OpenWRT is a linux based distribution for real networking hardware</p>
<aside class="note">
<p>Consumer grade mostly, but some enterprise level routers are supported</p>
</section>
2021-10-20 16:41:25 +11:00
<section><h2>Bonus homework</h2>
<p>Why did I use 2001::db8::/32?</p>
<p>Why did I use /64s?</p>
2021-12-20 07:13:39 +11:00
<p>I highly recommend going through KNorrie's network examples: <a href="https://github.com/knorrie/network-examples">https://github.com/knorrie/network-examples</a></p>
2022-01-08 21:24:04 +11:00
<p>OSPF Areas</p>
2022-01-13 23:10:15 +11:00
<p>Auth* for OSPF</p>
2022-01-08 21:24:04 +11:00
<p>Automatic transfers of internal aggregates to BGP (Something I've not investigated much)</p>
2021-10-20 16:41:25 +11:00
</section>
2021-10-16 19:37:58 +11:00
2021-09-29 23:04:50 +10:00
<section><h2>Resources</h2>
<p>These slides: <a href="https://gitea.pwarren.id.au/pwarren/SysAdmin2022">https://gitea.pwarren.id.au/pwarren/SysAdmin2022</a></p>
<p>bird: <a href="https://bird.network.cz/">https://bird.network.cz</a></p>
<p>Openwrt: <a href="https://openwrt.org">https://openwrt.org/</a></p>
2021-09-30 22:04:57 +10:00
<p>The OpenWRT IRC channel, currently on the OFTC network</p>
2021-12-20 07:13:39 +11:00
<p>BenEater's <a href="https://www.youtube.com/watch?v=-wMU8vmfaYo">"Why was facebook down for five hours" </a></p>
2022-01-13 23:10:25 +11:00
<p><a href="https://www.ieee802.org/1/pages/802.1Q-2014.html">802.1Q</a></p>
2021-09-29 23:04:50 +10:00
</section>
2022-01-13 23:10:25 +11:00
2021-09-29 23:04:50 +10:00
</div>
</div>
<script src="dist/reveal.js"></script>
<script src="plugin/notes/notes.js"></script>
<script src="plugin/markdown/markdown.js"></script>
<script src="plugin/highlight/highlight.js"></script>
<script>
// More info about initialization & config:
// - https://revealjs.com/initialization/
// - https://revealjs.com/config/
Reveal.initialize({
hash: true,
// Learn about plugins: https://revealjs.com/plugins/
plugins: [ RevealMarkdown, RevealHighlight, RevealNotes ]
});
</script>
</body>
2021-09-29 21:52:51 +10:00
</html>