|
|
| (76 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) |
| Zeile 1: |
Zeile 1: |
| '''Ip (Befehl)''' - Konfiguration von [[Netzwerkschnittstelle]]n | | '''ip/Befehl''' - Konfiguration von [[Netzwerkschnittstelle]]n |
|
| |
|
| == Beschreibung == | | == Beschreibung == |
| Das Kommando ip aus der [[iproute2]] Toolsammlung dient unter Linux zur Konfiguration von Netzwerkadressen
| | * Konfiguration von [[Netzwerkschnittstelle]]n unter Linux |
| * Es ersetzt das ifconfig Kommando aus den obsoleten [[net-tools]] | | * ersetzt [[ifconfig]] aus den obsoleten [[net-tools]] |
|
| |
|
| == Installation == | | == Installation == |
| ''ip'' ist im Paket [[iproute2]] enthalten
| | [[ip/Befehl|ip]] ist Teil des Pakets [[iproute2]] |
|
| |
|
| == Aufruf == | | == Aufruf == |
| # ip OBJECT COMMAND
| | <syntaxhighlight lang="bash" highlight="1" line> |
| # ip [options] OBJECT COMMAND
| | ip OBJECT COMMAND |
| # ip OBJECT help
| | ip [options] OBJECT COMMAND |
| $ ip OPTIONEN SCHNITTSTELLE
| | ip OBJECT help |
| | ip OPTIONEN SCHNITTSTELLE |
| | </syntaxhighlight> |
|
| |
|
| Da manche der Optionen dem System-Administrator vorbehalten sind, muss man je nach Anwendungsfall den Befehl sudo voranstellen | | Da manche der Optionen dem System-Administrator vorbehalten sind, muss man je nach Anwendungsfall den Befehl sudo voranstellen |
|
| |
|
| | ; [[CIDR]]-Notation |
| Die [[CIDR]]-Notation ermöglicht im Gegensatz zur Dezimalpunktschreibweise von IPv4 kürzere Ausdrücke. | | Die [[CIDR]]-Notation ermöglicht im Gegensatz zur Dezimalpunktschreibweise von IPv4 kürzere Ausdrücke. |
| * Beispiel: 192.168.0.0/24 entspricht dem bisherigen 192.168.0.0/255.255.255.0. | | * Beispiel: 192.168.0.0/24 entspricht dem bisherigen 192.168.0.0/255.255.255.0. |
| * Während man früher wahlweise beide Schreibweisen verwenden konnte, ist nur noch CIDR erlaubt. | | * Während man früher wahlweise beide Schreibweisen verwenden konnte, ist nur noch CIDR erlaubt. |
|
| |
|
| ==== Objekte ====
| |
| ; OBJECTS-Syntax
| |
| OBJEKTE können eine der folgenden sein und können in vollständiger oder abgekürzter Form geschrieben sein
| |
| {| class="wikitable options"
| |
| |-
| |
| ! Objekt !! Kurzform !! Zweck
| |
| |-
| |
| | link || l || Network device
| |
| |-
| |
| | address || a / addr || Protocol (IP or IPv6) address on a device
| |
| |-
| |
| | addrlabel || addrl || Etikettenkonfiguration für die Auswahl der Protokolladresse
| |
| |-
| |
| | neighbour || n / neigh || ARP or NDISC cache entry
| |
| |-
| |
| | route || r || Routing-Tabelleneintrag
| |
| |-
| |
| | rule || ru || Regel in der Routing-Richtliniendatenbank
| |
| |-
| |
| | maddress || m / maddr || Multicast address
| |
| |-
| |
| | mroute || mr || Multicast-Routing-Cache-Eintrag
| |
| |-
| |
| | tunnel || t || Tunnel over IP
| |
| |-
| |
| | xfrm || x || Framework für das IPSec-Protokoll
| |
| |}
| |
|
| |
|
| ; Hilfebefehl
| | {{:Ip/Befehl/Objekte}} |
| Informationen zu Objekten abzurufen
| | |
| # ip OBJECT help
| | === Soforthilfe === |
| # ip OBJECT h
| | [[Objekt]] und Schlüsselwort ''help'' |
| # ip a help
| | ip link help |
| # ip r help | |
|
| |
|
| === Optionen === | | === Optionen === |
| ip kennt sehr viele Optionen
| | {| class="wikitable sortable options gnu big" |
| * [https://wiki.ubuntuusers.de/ip/#Beispiele Beispiele])
| |
| * die man bei Bedarf in der [https://wiki.ubuntuusers.de/man/ Manpage] oder in der [https://wiki.ubuntuusers.de/ip/#Links Dokumentation] nachschlagen kann.
| |
| | |
| Zusätzlich gibt es eine komfortable Soforthilfe: man kombiniert die gewünschte Option mit dem Schlüsselwort help.
| |
| $ ip link help
| |
| | |
| ; [[iproute2]] vs. [[net-tools]]
| |
| Nachfolgend eine praktisch orientierte Übersicht, die alte und neue Befehle gegenüberstellt.
| |
| {| class="wikitable sortable" | |
| |-
| |
| | colspan="3" | Alte und neue Befehle
| |
| |-
| |
| || Traditionell
| |
| || Neu
| |
| || Zweck
| |
| |-
| |
| || ifconfig SCHNITTSTELLE
| |
| || ip addr show SCHNITTSTELLE
| |
| || IP-Adresse anzeigen
| |
| |-
| |
| || ifconfig SCHNITTSTELLE hw ether MAC-ADRESSE
| |
| || ip link set dev SCHNITTSTELLE address MAC-ADDRESSE
| |
| || MAC-Adresse ändern
| |
| |-
| |
| || ifconfig SCHNITTSTELLE IP-ADRESSE netmask NETMASK broadcast BROADCAST
| |
| || ip addr change IP-ADRESSE/CIDR broadcast BROADCAST dev SCHNITTSTELLE
| |
| || IP-Adresse setzen
| |
| |-
| |
| || ip addr add IP-ADRESSE/CIDR broadcast BROADCAST dev SCHNITTSTELLE
| |
| || IP-Adresse hinzufügen
| |
| |-
| |
| || ifconfig SCHNITTSTELLE:1 IP-ADRESSE/CIDR
| |
| || ip addr add IP-ADRESSE/CIDR dev SCHNITTSTELLE label SCHNITTSTELLE:1
| |
| || Alias anlegen
| |
| |-
| |
| || -
| |
| || ip addr del IP-ADRESSE/CIDR dev SCHNITTSTELLE
| |
| || IP-Adresse löschen
| |
| |-
| |
| || ifconfig SCHNITTSTELLE up
| |
| || ip link set SCHNITTSTELLE up
| |
| || Schnittstelle aktivieren
| |
| |- | | |- |
| || ifconfig SCHNITTSTELLE down
| | ! Unix !! GNU !! Parameter !! Beschreibung |
| || ip link set SCHNITTSTELLE down
| |
| || Schnittstelle deaktivieren
| |
| |- | | |- |
| || route, route -6 | | | || || || |
| || ip route, ip -6 route | |
| || Routen (für IPv6) anzeigen | |
| |- | |
| || route add default gw IP-ADRESSE
| |
| || ip route add default via IP-ADRESSE dev SCHNITTSTELLE
| |
| || Gateway setzen
| |
| |-
| |
| || arp -a
| |
| || ip neighbour
| |
| || [https://de.wikipedia.org/wiki/Address_Resolution_Protocol ARP]
| |
| |-
| |
| || netstat
| |
| || ss
| |
| || Sockets anzeigen
| |
| |- | | |- |
| |} | | |} |
|
| |
|
| Die Optionen für ip kann man auch in Kurzschreibweise als Anfangsbuchstaben der Option angeben.
| | === Parameter === |
| * Wenn man z. B.
| |
| * für alle Netzwerkschnittstellen des Systems die IP-Adressen ausgeben möchte, benötigt man den Befehl ip addr show.
| |
| * Die Kurzform ip a s liefert das gleiche Ergebnis.
| |
|
| |
|
| ===Alt vs Neu=== | | == Umgebung == |
| Veralteter Linux-Befehl und deren Ersetzung
| | === Variablen === |
|
| |
|
| {| class="wikitable" | | === Exit-Status === |
| |+
| | {| class="wikitable options col1center big" |
| |-
| |
| ! Neuer Befehl
| |
| ! Alter Befehl
| |
| |-
| |
| | ip a
| |
| | ifconfig -a
| |
| |-
| |
| | ip link set enp6s0 down
| |
| | ifconfig enp6s0 down
| |
| |-
| |
| | ip link set enp6s0 up
| |
| | ifconfig enp6s0 up
| |
| |-
| |
| | ip addr add 192.168.2.24/24 dev enp6s0
| |
| | ifconfig enp6s0 192.168.2.24
| |
| |-
| |
| | ip addr add 192.168.1.1/24 dev enp6s0
| |
| | ifconfig enp6s0 netmask 255.255.255.0
| |
| |-
| |
| | ip link set enp6s0 mtu 9000
| |
| | ifconfig enp6s0 mtu 9000
| |
| |-
| |
| | ip addr add 192.168.2.25/24 dev enp6s0
| |
| | ifconfig enp6s0:0 192.168.2.25
| |
| |-
| |
| | ss
| |
| | netstat
| |
| |-
| |
| | ss -tulpn
| |
| | netstat -tulpn
| |
| |-
| |
| | ss -neopa
| |
| | netstat -neopa
| |
| |-
| |
| | ip maddr
| |
| | netstat -g
| |
| |-
| |
| | ip r
| |
| | route
| |
| |-
| |
| | ip route add 192.168.2.0/24 dev enp6s0
| |
| | route add -net 192.168.2.0 netmask 255.255.255.0 dev enp6s0
| |
| |-
| |
| | ip route add default via 192.168.2.254
| |
| | route add default gw 192.168.2.254
| |
| |-
| |
| | ip neigh
| |
| | arp -a
| |
| |- | | |- |
| | ip -s neigh
| | ! Wert !! Beschreibung |
| | arp -v
| |
| |- | | |- |
| | ip neigh add 192.168.3.33 lladdr 1:2:3:4:5:6 dev enp6s0 | | | 0 || Erfolg |
| | arp -s 192.168.2.33 1:2:3:4:5:6 | |
| |- | | |- |
| | ip neigh del 192.168.2.254 dev wlp7s0 | | | >0 || Fehler |
| | arp -i enp6s0 -d 192.168.2.254 | |
| |} | | |} |
|
| |
|
| === ip versus ifconfig === | | == Konfiguration == |
| Die Tabelle zeigt wichtige Befehle zur Netzwerkkonfiguration und vergleicht die Syntax der Kommandos ip und ifconfig:
| | === Dateien === |
| {| class="wikitable options" | | {| class="wikitable options big" |
| !Aufgabe
| |
| !iproute2 Kommando
| |
| !iproute2 Kommando Kurzversion
| |
| !net-tools Kommando
| |
| |-
| |
| |Linkstatus anzeigen
| |
| |ip link show
| |
| |ip l
| |
| |ifconfig
| |
| |-
| |
| |Linkstatus inkl. Statistik
| |
| (RX/TX bytes, errors, ...) anzeigen
| |
| |ip -statistics link show
| |
| |ip -s l
| |
| |ifconfig
| |
| |-
| |
| |IP Adresse anzeigen
| |
| |ip addr show
| |
| |ip a
| |
| |ifconfig -a
| |
| |-
| |
| |IP Adresse setzen
| |
| |ip addr add IP/NETMASK dev DEVICE
| |
| |ip a a IP/NETMASK dev DEVICE
| |
| |ifconfig DEVICE IP/NETMASK
| |
| |-
| |
| |IP Adresse entfernen
| |
| |ip addr del IP/NETMASK dev DEVICE
| |
| |ip a d IP/NETMASK dev DEVICE
| |
| |
| |
| |-
| |
| |IP Adressen entfernen
| |
| |ip addr flush dev DEVICE
| |
| |ip a f dev DEVICE
| |
| |
| |
| |-
| |
| |Routingtabelle anzeigen
| |
| |ip route show
| |
| |ip r
| |
| |route -n
| |
| |- | | |- |
| |Standardgateway setzen
| | ! Datei !! Beschreibung |
| |ip route add default via IP
| |
| |ip r a default via IP
| |
| |route add default gw IP DEVICE
| |
| |- | | |- |
| |ARP-Cache anzeigen | | | || |
| |ip neigh show | |
| |ip n | |
| |arp -na
| |
| |- | | |- |
| |Verbindungen anzeigen | | | || |
| |ss --tcp --all --processes --extended --numeric | |
| |ss -tapen | |
| |netstat -tapen
| |
| |} | | |} |
|
| |
|
| === Parameter ===
| | <noinclude> |
| === Umgebung ===
| |
| === Rückgabewert ===
| |
| | |
| == Anwendung ==
| |
| [[Ip/Anwendung]]
| |
|
| |
|
| == Anhang == | | == Anhang == |
| === Siehe auch === | | === Siehe auch === |
| {{Special:PrefixIndex/{{BASEPAGENAME}}}} | | <div style="column-count:2"> |
| | <categorytree hideroot=on mode="pages">{{BASEPAGENAME}}</categorytree> |
| | </div> |
| | ---- |
| | {{Special:PrefixIndex/{{BASEPAGENAME}}/}} |
| ---- | | ---- |
| * [[ping]] | | * [[ping]] |
| | * [[Iproute2/net-tools]] |
| | |
| | <!-- |
| | === Dokumentation === |
| | ; Man-Page |
| | # [https://manpages.debian.org/stable/procps/pgrep.1.de.html prep(1)] |
| | |
| | ; Info-Pages |
| | --> |
|
| |
|
| ===== Man-Page =====
| | === Links === |
| ==== Links ====
| | ==== Projekt ==== |
| ===== Projekt =====
| | ==== Weblinks ==== |
| ===== Weblinks =====
| | # https://de.wikipedia.org/wiki/Iproute2 |
| # https://www.cyberciti.biz/faq/linux-ip-command-examples-usage-syntax/
| |
| # Start Practising Linux ip command and Avoid the Habit of Using ifconfig (linoxide.com, 02.05.2014) | |
| # IProute2 fasst viele Befehle für die Netzkonfiguration zusammen (Linux Magazin 11/2006)
| |
| * [https://de.wikipedia.org/wiki/Iproute2 Iproute2] - Wikipedia
| |
|
| |
|
| ==== Dokumentation ====
| | {{DEFAULTSORT:ip/Befehl}} |
| * [http://www.policyrouting.org/iproute2-toc.html IPROUTE2 Utility Suite Howto]
| | {{DISPLAYTITLE:ip/Befehl}} |
| * [http://linux-ip.net/ Guide to IP Layer Network Administration]
| |
| * [https://lintut.com/how-to-use-linux-ip-command/ How to use Linux IP Command]
| |
| * [https://dougvitale.wordpress.com/2011/12/21/deprecated-linux-networking-commands-and-their-replacements/ Deprecated networking commands and their replacements]
| |
| * [https://packages.ubuntu.com/ipset ipset] - administration tool for kernel IP sets
| |
| * [https://wiki.ubuntuusers.de/Shell/Befehlsübersicht/ Shell/Befehlsübersicht] Übersicht über verschiedene Shell-Befehle
| |
|
| |
|
| [[Kategorie:Netzwerk/Befehl]] | | [[Kategorie:Linux/Netzwerk/Befehl]] |
| [[Kategorie:Linux/Befehl]] | | [[Kategorie:Linux/Befehl]] |
| | [[Kategorie:Iproute2/ip]] |
| [[Kategorie:iproute2]] | | [[Kategorie:iproute2]] |
|
| |
|
| {{DEFAULTSORT:Ip (Befehl)}}
| |
| {{DISPLAYTITLE:Ip (Befehl)}}
| |
| </noinclude> | | </noinclude> |