linuxkurs/10.html

506 lines
15 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<html lang="de">
<meta charset="utf-8">
<title>Einführung in Linux</title>
<meta name="description" content="YALC - Yet Another Linux Course ">
<meta name="author" content="Daniel Schubert">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/league.css" id="theme">
<link rel="icon" href="img/openlogo-nd-25.png" type="img/png">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
<style type="text/css">
.reveal img{ max-height: 60vh}
</style>
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section data-transition="slide" data-background="#4d7e65" data-background-transition="zoom">
<h1>LINUX</h1>
<h3>Das universelle Betriebssystem</h3>
<p>Eine Einführung - Teil 10
<p>
<small>Deutsche Angestellten Akademie</small>
</p>
<aside class="notes">
Frage: Fragen zur letzten Stunde?
</aside>
</section>
<section data-transition="slide" data-background="#4d7e65" data-background-transition="convex">
<h2 style="text-shadow: 5px 4px 15px black;">Systemverwaltung</h2>
<h2>Part 8 - Netzwerke</h2>
</section>
<section>
Begriffe:
<p>
<table style="font-size: .5em">
<tr>
<td>IP = Internet Protocol</td>
<td>Basis für TCP und UDP</td>
</tr>
<tr>
<td>TCP = Transmission Control Protocol</td>
<td>Ende-zu-Ende Verbindung zw. 2 Geräten</td>
</tr>
<tr>
<td>UDP = User Datagram Protocol</td>
<td>minimales, verbindungsloses Netzwerkprotokoll</td>
</tr>
<tr>
<td>ICMP = Internet Control Message Protocol</td>
<td>Austausch v. IP Status / Fehlern</td>
</tr>
<tr>
<td>PPP = Point-to-Point Protocol</td>
<td>Verbindung über Wählleitungen, zB ADSL / UMTS / ISDN</td>
</tr>
<tr>
<td>Gateway</td>
<td>Router über den man ins Internet kommt</td>
</tr>
<tr>
<td>Nameserver</td>
<td>der für die Adressauflösung zuständige Rechner</td>
</tr>
<tr>
<td>loopback</td>
<td>lokale Netzwerkschnittstelle zum internen Gebrauch</td>
</tr>
</table>
</section>
<section>
<h3>IP Adressen</h3>
</section>
<section>
<h3>IPv4</h3>
eine IPv4 Adresse: <br><pre><code>65.142.5.123</code></pre>
<ul>
<li class="fragment ">32 bits Länge, 4 x 8 Bit ( 0 - 255 )</li>
<li class="fragment ">max. 4.294.967.296 Adressen</li>
</ul>
</section>
<section>
192.168.0.23/24
<p>
<table style="font-size: .5em">
<thead></thead>
<tbody>
<tr><td class="bl558_sc w65bb">Address</td><td class="bl558_sc w130b">192.168.0.23</td><td class="bl558_sc w160b">11000000.10101000.00000000<span>.00010111</span></td></tr>
<tr><td class="bl558_sc w65bb">Netmask</td><td class="bl558_sc w130b">255.255.255.0 = 24</td><td>11111111.11111111.11111111<span>.00000000</span></td></tr>
<tr><td class="bl558_sc w65bb">Wildcard</td><td class="bl558_sc w130b">0.0.0.255</td><td class="bl558_sc w160b">00000000.00000000.00000000<span>.11111111</span></td></tr><tr>&nbsp;</tr>
</tbody>
</table>
</p>
<hr>
<p>
<table style="font-size: .5em">
<tbody>
<tr><td class="bl558_sc w65bb">Network</td><td class="bl558_sc w130b">192.168.0.0/24</td><td class="bl558_sc w160b"><b>110</b>00000.10101000.00000000<span>.00000000</span></td></tr>
<tr><td class="bl558_sc w65bb">Broadcast</td><td class="bl558_sc w130b">192.168.0.255</td><td class="bl558_sc w160b">11000000.10101000.00000000<span>.11111111</span></td></tr>
<tr><td class="bl558_sc w65bb">First IP</td><td class="bl558_sc w130b">192.168.0.1</td><td class="bl558_sc w160b">11000000.10101000.00000000<span>.00000001</span></td></tr>
<tr><td class="bl558_sc w65bb">Last IP</td><td class="bl558_sc w130b">192.168.0.254</td><td class="bl558_sc w160b">11000000.10101000.00000000<span>.11111110</span></td></tr>
<tr><td class="bl558_sc w65bb">Hosts/Net</td><td class="bl558_sc w130b">254</td><td class="bl558_sc w160b">nnnnnnnn.nnnnnnnn.nnnnnnnn<span>.hhhhhhhh</span></td></tr>
</tbody>
</table>
</p>
</section>
<section>
Private IP Bereiche
<p>
<table style="font-size: .5em">
<tbody><tr>
<th>Adressbereich
</th>
<th>Beschreibung
</th>
<th>größter <a href="/wiki/Classless_Inter-Domain_Routing" title="Classless Inter-Domain Routing">CIDR</a>-Block
</th>
<th>Anzahl IP-Adressen
</th></tr>
<tr>
<td class="hintergrundfarbe9"><b>10.0.0.010.255.255.255</b>
</td>
<td>privat, 1 <b>8-Bit</b>-Netz
</td>
<td>10.0.0.0/8
</td>
<td>2<sup>24</sup> = 16.777.216
</td></tr>
<tr>
<td class="hintergrundfarbe9"><b>172.16.0.0172.31.255.255</b>
</td>
<td>privat, 16 <b>16-Bit</b>-Netze
</td>
<td>172.16.0.0/12
</td>
<td>2<sup>20</sup> = 1.048.576
</td></tr>
<tr>
<td class="hintergrundfarbe9"><b>192.168.0.0192.168.255.255</b>
</td>
<td>privat, 256 <b>24-Bit</b>-Netze
</td>
<td>192.168.0.0/16
</td>
<td>2<sup>16</sup> = 65.536
</td></tr>
<tr>
<td>169.254.0.0169.254.255.255
</td>
<td>link local, 1 <b>16-Bit</b>-Netz
</td>
<td>169.254.0.0/16
</td>
<td>2<sup>16</sup> = 65.536
</td></tr></tbody></table>
<p><small><a href="https://de.wikipedia.org/wiki/Classless_Inter-Domain_Routing">https://de.wikipedia.org/wiki/Classless_Inter-Domain_Routing</a></small></p>
</section>
<section>
verfügbare ipv4 Adress-Blöcke
<img style="background:white" src="img/1280px-Ipv4-exhaust.svg.png">
</section>
<section>
<h3>IPv6</h3>
<div class="fragment">eine IPv6 Adresse
<pre><code>2002:58bf:13bb:0002:0000:0000:0020:1234 </code></pre>
</div>
<ul>
<li class="fragment ">seit 1998 !</li>
<li class="fragment ">moderne Betriebssysteme können es alle</li>
<li class="fragment ">128 bits Länge ( 8 x 4 x 4 Bit )</li>
<li class="fragment ">Notierung Hexadezimal</li>
<li class="fragment ">max. 3,4x10^38 (ca 340 Sextillionen) Adressen</li>
<li class="fragment ">URL Notation: <code>http://[2001:0db8:85a3:08d3::0370:7344]/</code></li>
</ul>
</section>
<section>
<ul>
<li class="fragment ">NAT und DHCP sind nicht mehr nötig. In IPv6 ist eine Autokonfiguration eingebaut.</li>
<li class="fragment ">Der Adressraum genügt auch für alle Toaster</li>
<li class="fragment ">ipv6 Adressen können für ein Device immer gleich bleiben</li>
<li class="fragment ">„Privacy Extension“ - Interface identifier wird alle paar Tage gewechselt</li>
<li class="fragment ">mehrere ipv6 Adressen</li>
<li class="fragment ">Geräte mit ipv6 sind aus dem Internet erreichbar</li>
<li class="fragment ">Router hat noch Nutzen als Firewall</li>
</ul>
</section>
<section style="font-size: .6em">
Führende Nullen innerhalb eines Blockes dürfen ausgelassen werden: <code>2001:0db8:0000:08d3:0000:8a2e:0070:7344</code><br> ist gleichbedeutend mit <br><code>2001:db8:0:8d3:0:8a2e:70:7344</code>
<p>Mehrere aufeinander folgende Blöcke, deren Wert 0 (bzw. 0000) beträgt, dürfen ausgelassen werden. Dies wird durch zwei aufeinander folgende Doppelpunkte angezeigt:<br><code> 2001:0db8:0:0:0:0:1428:57ab </code><br> ist gleichbedeutend mit <code> <br>2001:db8::1428:57ab</code>.
</section>
<section>
Hat z. B. ein Netzwerkgerät die IPv6-Adresse
<pre><code>2001:0db8:85a3:08d3:1319:8a2e:0370:7347/64</code></pre>
so lautet das Präfix ( vom Provider zuget. )
<pre><code>2001:0db8:85a3:08d3::/64</code></pre>
und der Interface-Identifier
<pre><code>1319:8a2e:0370:7347</code></pre>
</section>
<section>
<h4>speziellle adressen</h4>
localhost<pre><code>::1/128</code></pre>
link local <pre><code>fe80::/64</code></pre> ( entspr. 169.254.0.0/16 in ipv4)
</section>
<section>
<ul>
<li>Netzwerk wird mit Netzwerkmanager konfiguriert</li>
<li class="fragment ">geht auch im terminal : <pre><code>nmcli -h</code></pre></li>
</ul>
</section>
<section style="font-size: .6em" >
/etc/NetworkManager/system-connections/Wired connection 1
<pre><code>[connection]
id=Wired connection 1
uuid=180051c9-6df6-4a96-8d8f-8a0c2eb9050e
type=ethernet
permissions=
timestamp=1531903725
[ethernet]
mac-address-blacklist=
[ipv4]
dns=192.168.1.4;9.9.9.9;
dns-search=
ignore-auto-dns=true
method=auto
[ipv6]
addr-gen-mode=eui64
dns=2a02:8071:4280:ba00:f640:6751:3af0:bb97;2620:fe::10;
dns-search=
ignore-auto-dns=true
ip6-privacy=1
method=auto
</code></pre>
</section>
<section>
<section>
<h3>DNS</h3>
<h4>Domain Name System</h4>
Das Telefonbuch des Internet
</section>
<section>
<ul>
<li>geht zurück auf die „hosts“ Datei d. ARPANET</li>
<li class="fragment ">händisch gepflegte Liste aller Hosts -> seriously??</li>
<li class="fragment ">Einführung des DNS ab 1983</li>
<li class="fragment ">übersetzt domain Namen ( www.omikron.net ) in IP Adressen</li>
<li class="fragment ">https://de.wikipedia.org/wiki/Domain_Name_System</li>
<li class="fragment ">Jeder kann einen DNS Server betreiben ( zb Pi-Hole )</li>
</ul>
</section>
</section>
<section>
<span style="color: orange">Aufgabe:</span> ändert euren voreingestellten DNS Server per network Manager, z.B. <br>
<p>google: 8.8.8.8 <br> Quad9: 9.9.9.9 <br> bzw ipv6 Äquivalent
</section>
<section><h2>Manuelle Konfiguration</h2></section>
<section>
/etc/hosts
<pre><code class="bash">127.0.0.1 localhost
127.0.0.1 dev.local
127.0.1.1 workhorse.fcknzs workhorse
192.168.1.5 pi
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
2a01:4f8:191:6204::2 lk.schubertdaniel.de
</code></pre>
</section>
<section>
/etc/resolv.conf
<pre><code class="bash">#Generated by NetworkManager
nameserver 192.168.1.4 #pihole
nameserver 9.9.9.9
nameserver 2a02:8071:4280:ba00:f640:6751:3af0:bb97 #pi hole
# NOTE: the libc resolver may not support more than 3 nameservers.
# The nameservers listed below may not be recognized.
nameserver 2620:fe::10
</code></pre>
</section>
<section>
/etc/network/interfaces
<pre><code class="bash" style="font-size: .7em"># The loopback network interface
auto lo
iface lo inet loopback
# dhcp
auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
iface eth0 inet6 dhcp # stateful
iface eth0 inet6 auto # stateless
</code></pre>
</section>
<section>
/etc/network/interfaces
<pre><code class="bash" style="font-size: .7em"># statische konfiguration
auto eth0
iface eth0 inet static
address 192.0.2.7
netmask 255.255.255.0
gateway 192.0.2.254
iface eth0 inet6 static
address 2001:db8::c0ca:1eaf
netmask 64
gateway 2001:db8::1ead:ed:beef
</code></pre>
</section>
<section>
/etc/hostname
<pre><code>laptop</code></pre>
</section>
<section>
Befehle zur Konfiguration der Netzwerkschnitstelle
<pre style="font-size: .4em"><code class="bash"># netzwerk geräte anzeigen
~$ ip link show
# ip adressen anzeigen
~$ ip addr
# netzwerk device de-/aktivieren
~$ ip link set enp0s7 down
~$ ip link set enp0s7 up
# ip setzen
~$ ip addr add 192.168.1.2/24 dev enp0s7
# route zeigen
~$ ip route
#route ( gateway ) hinzufügen
~$ ip route add default via 192.168.1.1
</code></pre>
</section>
<section>
Befehle zur Konfiguration der WLAN-Netzwerkschnitstelle
<pre style="font-size: .4em"><code class="bash">~$ iw dev wlan0 info
~$ iw dev wlan0 link
~$ iw dev wlan0 scan #...
~$ iw dev wlan0 connect gastnetz-01
~$ dhclient wlan0 # holt dhcp ein
~$ iw dev wlan0 disconnect
</code></pre>
</section>
<section>
<small>für WPA gesicherte Netzwerke muss wpa_supplicant bemüht werden <br>
https://wiki.ubuntuusers.de/WLAN/wpa_supplicant/
</small>
<p>
/etc/network/interfaces
<pre><code class="bash" style="font-size: .7em"># statische konfiguration
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa.conf</code></pre>
/etc/wpa.conf
<pre><code class="bash" style="font-size: .55em">network={
ssid="Netzwerkname"
scan_ssid=1
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
group=CCMP
psk="meinschluessel"
}</code></pre>
</section>
<section>
per Systemd
<p>/etc/systemd/network/20-wired.network</p>
<pre><code>
[Match]
Name=enp1s0
[Network]
Address=10.1.10.9/24
Gateway=10.1.10.1
DNS=10.1.10.1
#DNS=8.8.8.8</code></pre>
</section>
<section>
prüfen ob Device im Netz ist:
<pre><code>~$ ping -c 3 192.168.1.2</code></pre>
</section>
<section>
Benennung der Netzwerkschnittstelle
<pre class="fragment "><code class="plain">wlan0 wlan1 wlan2 ...</code></pre>
<pre class="fragment "><code class="plain">eth0 eth1 eth2 .. </code></pre>
aktuelle Distributionen verw.
<pre class="fragment "><code class="plain">eno1 eno2 eno3 ...</code></pre>
<pre class="fragment "><code class="plain">ens1 ens2 ens3 ...</code></pre>
<pre class="fragment "><code class="plain">enp1s2 enp2s4 enp1s7 ...</code></pre>
<pre class="fragment "><code class="plain">wlp1s2 wlp2s8...</code></pre>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
<script>
// More info https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
transition: 'slide', // none/fade/slide/convex/concave/zoom
// More info https://github.com/hakimel/reveal.js#dependencies
dependencies: [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/search/search.js', async: true },
{ src: 'plugin/zoom-js/zoom.js', async: true },
{ src: 'plugin/notes/notes.js', async: true }
]
});
</script>
</body>
</html>