Zum Inhalt springen

tc

Aus Foxwiki

tc - show / manipulate traffic control settings


Beschreibung

tc is used to configure Traffic Control in the Linux kernel

Traffic Control consists of the following
Option Beschreibung
SHAPING When traffic is shaped, its rate of transmission is under control. Shaping may be more than lowering the available bandwidth - it is also used to smooth out bursts in traffic for better network behaviour. Shaping occurs on egress.
SCHEDULING By scheduling the transmission of packets it is possible to improve interactivity for traffic that needs it while still guaranteeing bandwidth to bulk transfers. Reordering is also called prioritizing, and happens only on egress.
POLICING Whereas shaping deals with transmission of traffic, policing pertains to traffic arriving. Policing thus occurs on ingress.
DROPPING Traffic exceeding a set bandwidth may also be dropped forthwith, both on ingress and on egress. Processing of traffic is controlled by three kinds of objects: qdiscs, classes and filters.

Installation

Aufruf

OPTIONS := { [ -force ] -b[atch] [ filename ] | [ -n[etns] name ] | [ -N[umeric] ] | [ -nm | -nam[es] ] | [ { -cf | -c[onf] } [ filename ] ] [ -t[imestamp] ] | [ -t[short] | [ -o[neline] ]}
FORMAT := { -s[tatistics] | -d[etails] | -r[aw] | -i[ec] | -g[raph] | -j[json] | -p[retty] |  -col[or] }

</syntaxhighlight>

Optionen

Argumente

Umgebung

Exit-Status

Anwendung

Linux QoS mit "tc"

  • Linux benutzt tc vom Paket iproute2, um das Bandbreitenmanagement zu konfigurieren
  • Allgemein beschrieben in Linux Advanced Routing & Traffic Control HOWTO.

Beispiel für eine Warteschlange mit konstanter Bitrate

Mit dem "cbq" Planer können Röhren mit konstanter Bitrate definiert werden.

Root qdisc Definition
  • Definition einer root qdisc mit einer Bandbreite von 1000 MBit/s an eth1
QoS class Definition
  • Definition einer Klasse 1:1 mit 1 MBit/s
  • Definition einer Klasse 1:2 mit 50 MBit/s
  • Definition einer Klasse 1:3 mit 10 MBit/s
  • Definition einer Klasse 1:4 mit 200 kBit/s
QoS filter Definition
  • Definition eines Filters für IPv4 (protocol ip), TCP (match ip protocol 6 0xff) Zielport 5001 (match ip dport 5001 0xffff) unter Benutzung der Klasse 1:2 von oben
  • Definition eines Filters für IPv6 (protocol ip), TCP (match ip6 protocol 6 0xff) Zielport 5001 unter der Benutzung der Klasse 1:2 von oben
  • Definition eines Filters für IPv6 für Pakete mit Flowlabel 12345 (match ip6 flowlabel 0x12345 0x3ffff) unter der Benutzung der Klasse 1:3 von oben
  • Definition eines Filters für IPv6 für Pakete mit der Linux iptables Markierung 32 (handle 32 fw) unter der Benutzung der Klasse 1:4 von oben

Die letzte Filterdefinition benötigt auch einen Eintrag in ip6tables um das Paket zu markieren

Testen der Filterdefinition mit iperf

Starten auf Serverseite in separaten Konsolen

$

Starten auf Clientseite und Vergleichen der Ergebnisse:

$

Das Ergebnis der Transferraten sollten der Definitionen von oben entsprechen, das Ergebnis auf Port 5002 sollte ziemlich identisch unabhängig von der benutzten IP-Version sein.




Problembehebung

Konfiguration

Dateien

Anhang

Siehe auch


tc-basic(8), tc-bfifo(8), tc-bpf(8), tc-cake(8), tc-cbq(8), tc-cgroup(8), tc-choke(8), tc-codel(8), tc-drr(8), tc-ematch(8), tc-ets(8), tc-flow(8), tc-flower(8), tc-fq(8), tc-fq_codel(8), tc-fq_pie(8), tc-fw(8), tc-hfsc(7), tc-hfsc(8), tc-htb(8), tc-mqprio(8), tc-pfifo(8), tc-pfifo_fast(8), tc-pie(8), tc-red(8), tc-route(8), tc-sfb(8), tc-sfq(8), tc-stab(8), tc-tbf(8), tc-tcindex(8), tc-u32(8)

Dokumentation

User documentation at https://lartc.org/, but please direct bugreports and patches to: <netdev@vger.kernel.org>

RFC
Man-Page
Info-Page

Links

Projekt

Weblinks