Zum Inhalt springen

Ip/Befehl: Unterschied zwischen den Versionen

Aus Foxwiki
Keine Bearbeitungszusammenfassung
 
(30 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 2: Zeile 2:


== Beschreibung ==
== Beschreibung ==
Das Kommando ip
* Konfiguration von [[Netzwerkschnittstelle]]n unter Linux
* aus der [[iproute2]] Toolsammlung
* ersetzt [[ifconfig]] aus den obsoleten [[net-tools]]
* dient unter Linux zur Konfiguration von [[Netzwerkadressen]]
* Es ersetzt das ifconfig Kommando aus den obsoleten [[net-tools]]


== Installation ==
== Installation ==
'''ip''' ist Teil des Pakets [[iproute2]]
[[ip/Befehl|ip]] ist Teil des Pakets [[iproute2]]


== Aufruf ==
== Aufruf ==
<syntaxhighlight lang="bash" highlight="1" line copy>
<syntaxhighlight lang="bash" highlight="1" line>
ip OBJECT COMMAND
ip OBJECT COMMAND
ip [options] OBJECT COMMAND
ip [options] OBJECT COMMAND
Zeile 25: Zeile 23:
* 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 ===
 
OBJEKTE können eine der folgenden sein und können in vollständiger oder abgekürzter Form geschrieben sein
{{:Ip/Befehl/Objekte}}
{| class="wikitable options big"
 
|-
=== Soforthilfe ===
! Objekt !! Kurzform !! Zweck
[[Objekt]] und Schlüsselwort ''help''
|-
ip link help
| 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
|}


=== Optionen ===
=== Optionen ===
Zeile 62: Zeile 40:


=== Parameter ===
=== Parameter ===
=== Umgebungsvariablen ===
 
== Umgebung ==
=== Variablen ===
 
=== Exit-Status ===
=== Exit-Status ===
{| class="wikitable options col1center big"
{| class="wikitable options col1center big"
Zeile 93: Zeile 74:
----
----
{{Special:PrefixIndex/{{BASEPAGENAME}}/}}
{{Special:PrefixIndex/{{BASEPAGENAME}}/}}
----
* [[ping]]
* [[Iproute2/net-tools]]


<!--
=== Dokumentation ===
=== Dokumentation ===
; Man-Page  
; Man-Page  
# [https://manpages.debian.org/stable/procps/pgrep.1.de.html prep(1)]
# [https://manpages.debian.org/stable/procps/pgrep.1.de.html prep(1)]


<!--
; Info-Pages  
; Info-Pages  
-->
-->
Zeile 105: Zeile 89:
==== Projekt ====
==== Projekt ====
==== Weblinks ====
==== Weblinks ====
# https://de.wikipedia.org/wiki/Iproute2


{{DEFAULTSORT:ip/Befehl}}
{{DEFAULTSORT:ip/Befehl}}
{{DISPLAYTITLE:ip/Befehl}}
{{DISPLAYTITLE:ip/Befehl}}


[[Kategorie:Netzwerk/Befehl]]
[[Kategorie:Linux/Netzwerk/Befehl]]
[[Kategorie:Linux/Befehl]]
[[Kategorie:Linux/Befehl]]
[[Kategorie:Iproute2/ip]]
[[Kategorie:iproute2]]
[[Kategorie:iproute2]]
</noinclude>
= TMP =
=== Soforthilfe ===
Zusätzlich gibt es eine komfortable Soforthilfe: man kombiniert die gewünschte Option mit dem Schlüsselwort help.
$ ip link help
== [[iproute2]]/[[net-tools]] ==
=== [[iproute2]] vs. [[net-tools]] ===
Nachfolgend eine praktisch orientierte Übersicht, die alte und neue Befehle gegenüberstellt.
{| class="wikitable big"
|-
| 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
|| 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.
* Wenn man beispielsweise
* 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===
Veralteter Linux-Befehl und deren Ersetzung
{| class="wikitable options big"
|+
|-
! Alter Befehl
! Neuer Befehl
|-
| ifconfig -a
| ip a
|-
| ifconfig enp6s0 down
| ip link set enp6s0 down
|-
| ifconfig enp6s0 up
| ip link set enp6s0 up
|-
| ifconfig enp6s0 192.168.2.24
| ip addr add 192.168.2.24/24 dev enp6s0
|-
| ifconfig enp6s0 netmask 255.255.255.0
| ip addr add 192.168.1.1/24 dev enp6s0
|-
| ifconfig enp6s0 mtu 9000
| ip link set enp6s0 mtu 9000
|-
| ifconfig enp6s0:0 192.168.2.25
| ip addr add 192.168.2.25/24 dev enp6s0
|-
| netstat
| ss
|-
| netstat -tulpn
| ss -tulpn
|-
| netstat -neopa
| ss -neopa
|-
| netstat -g
| ip maddr
|-
| route
| ip r
|-
| route add -net 192.168.2.0 netmask 255.255.255.0 dev enp6s0
| ip route add 192.168.2.0/24 dev enp6s0
|-
| route add default gw 192.168.2.254
| ip route add default via 192.168.2.254
|-
| arp -a
| ip neigh
|-
| arp -v
| ip -s neigh
|-
| arp -s 192.168.2.33 1:2:3:4:5:6
| ip neigh add 192.168.3.33 lladdr 1:2:3:4:5:6 dev enp6s0
|-
| arp -i enp6s0 -d 192.168.2.254
| ip neigh del 192.168.2.254 dev wlp7s0
|}
=== ip versus ifconfig ===
Die Tabelle zeigt wichtige Befehle zur Netzwerkkonfiguration und vergleicht die Syntax der Kommandos ip und ifconfig:
{| 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
|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
|}
== Anhang ==
=== Siehe auch ===
{{Special:PrefixIndex/{{BASEPAGENAME}}/}}
----
* [[ping]]
; Man-Page
=== Links ===
==== Projekt ====
==== Weblinks ====
# 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 ===
* [https://www.policyrouting.org/iproute2-toc.html IPROUTE2 Utility Suite Howto]
* [https://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


</noinclude>
</noinclude>

Aktuelle Version vom 7. September 2025, 07:50 Uhr

ip/Befehl - Konfiguration von Netzwerkschnittstellen

Beschreibung

Installation

ip ist Teil des Pakets iproute2

Aufruf

ip OBJECT COMMAND
ip [options] OBJECT COMMAND
ip OBJECT help
ip OPTIONEN SCHNITTSTELLE

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.

  • 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.


Objekte

Objekt Kurz Beschreibung
link l Netzwerkkarten
address a IP-Adressen
addrlabel addrl Etikettenkonfiguration
neighbour n ARP- und NDISC-Cache
route r Routing-Tabelle
rule ru Regel in der Routing-Richtliniendatenbank
maddress m Multicast-Adressen
mroute mr Multicast-Routing-Cache
tunnel t Tunnel
xfrm x IPSec

Soforthilfe

Objekt und Schlüsselwort help

ip link help

Optionen

Unix GNU Parameter Beschreibung

Parameter

Umgebung

Variablen

Exit-Status

Wert Beschreibung
0 Erfolg
>0 Fehler

Konfiguration

Dateien

Datei Beschreibung


Anhang

Siehe auch




Links

Projekt

Weblinks

  1. https://de.wikipedia.org/wiki/Iproute2