TCNG Tutorial

Reviews
Shared by: techmaster
Stats
views:
88
rating:
not rated
reviews:
0
posted:
10/29/2008
language:
English
pages:
0
TCNG Tutorial Papadimitriou Panagiotis Introduction to TCNG TCNG is comprised by two major components: • • the Traffic Control Compiler (TCC) the Traffic Control Simulator (TCSIM) TCNG Example: Steps 1-2 Step 1: We write the following TCNG code in the file: example.tc dev eth0 { egress { drop if tcp_sport != PORT_HTTP; } } Step 2: We run tcc to convert the TCNG configuration to tc commands. We save the output in the file: example.sh tcc example.tc > example.sh TCNG Example: After Step 2 After Step 2 the file example.sh contains the following tc configuration: tc qdisc add dev eth0 handle 1:0 root dsmark indices 1 default_index 0 tc filter add dev eth0 parent 1:0 protocol all prio 1 handle 1:0:0 u32 divisor 1 tc filter add dev eth0 parent 1:0 protocol all prio 1 u32 match u8 0x6 0xff at 9 offset at 0 mask 0f00 shift 6 eat link 1:0:0 tc filter add dev eth0 parent 1:0 protocol all prio 1 handle 1:0:1 u32 ht 1:0:0 match u16 0x50 0xffff at 0 classid 1:0 tc filter add dev eth0 parent 1:0 protocol all prio 1 u32 match u8 0x6 0xff at 9 classid 1:0 police index 1 rate 1bps burst 1 action drop/drop tc filter add dev eth0 parent 1:0 protocol all prio 1 u32 match u32 0x0 0x0 at 0 classid 1:0 TCNG Example: Step 3 Step 3: We define a simulation scenario in the file: example.tcsim with one interface called eth0, running at 100 Mbps. The simulation scenario consists of sending two packets. #include “packet.def” #include “ports.tc” dev eth0 100 Mbps { #include “example.tc” } send TCP_PCK($tcp_sport = PORT_HTTP); send TCP_PCK($tcp_sport = PORT_SSH); end TCNG Example: Step 4 Step 4: We run the simulation with tcsim: tcsim –s 22 example.tcsim The output looks like this: 0.000000 E : 0x80bd560 40 : eth0: 45000028 00000000 40060000 0a000001 0a000002 0050 ... 0.000000 D : 0x80bd560 40 : eth0: 45000028 00000000 40060000 0a000001 0a000002 0050 ... 0.000000 E : 0x80bd870 40 : eth0: 45000028 00000000 40060000 0a000001 0a000002 0016 ... 0.000000 * : 0x80bd870 40 : eth0: enqueue returns POLICED (3) TCNG Example: Steps 5-6 Step 5: We verify that the configuration did indeed work: The first packet was enqueued (“E”), and then dequeued (“D”). When trying to enqueue the second packet, it is rejected. Step 6: We can try this example on a live system. We execute the tc commands to create the configuration in the kernel: sh example.sh A more comprehensive TCNG example (1) This example illustrates most of the elements found in a typical TCNG configuration: dev "eth0" { egress { class (<$high>) if tcp_dport == PORT_HTTP; class (<$low>) if 1; prio { $high = class (1) { fifo (limit 20kB); } $low = class (2) { fifo (limit 100kB); } } } } A more comprehensive TCNG example (2) The dev and egress lines dev "eth0" { determine what is being configured: egress { i.e. the egress (outbound) side of the network interface eth0. The configuration consists of two parts: • • the classification: class (<$high>) if tcp_dport == PORT_HTTP; class (<$low>) if 1; the setup of the queuing system: prio { $high = class (1) { fifo (limit 20kB);} $low = class (2) { fifo (limit 100kB);} In this example, we use a priority scheduler with two classes for the priorities “high” and “low”. A more comprehensive TCNG example (3) In this configuration, packets: • • with TCP destination port 80 (HTTP) are sent to the high priority class, while all other packets (if 1;) are sent to the low priority class The queuing part defines the queuing discipline for static priorities, with the two classes: • • Inside the high priority class, there is another queuing discipline: a simple FIFO with a capacity of 20 KB. Likewise, the low priority class contains a FIFO with 100 KB. A more comprehensive TCNG example (4) The compilation of this TCNG code results in the following tc configuration: tc qdisc tc qdisc tc qdisc tc qdisc add add add add dev eth0 dev eth0 dev eth0 dev eth0 handle handle handle handle 1:0 2:0 3:0 4:0 root dsmark indices 4 default_index 0 parent 1:0 prio parent 2:1 bfifo limit 20480 parent 2:2 bfifo limit 102400 prio prio prio prio prio 1 1 1 1 1 tcindex mask 0x3 shift 0 handle 2 tcindex classid 2:2 handle 1 tcindex classid 2:1 handle 1:0:0 u32 divisor 1 u32 match u8 0x6 0xff at 9 tc filter add dev eth0 parent 2:0 protocol all tc filter add dev eth0 parent 2:0 protocol all tc filter add dev eth0 parent 2:0 protocol all tc filter add dev eth0 parent 1:0 protocol all tc filter add dev eth0 parent 1:0 protocol all offset at 0 mask 0f00 shift 6 eat link 1:0:0 tc filter add dev eth0 parent 1:0 protocol all prio 1 handle 1:0:1 u32 ht 1:0:0 match u16 0x50 0xffff at 2 classid 1:1 tc filter add dev eth0 parent 1:0 protocol all prio 1 u32 match u32 0x0 0x0 at 0 classid 1:2 Simulation Output Running the simulation script example.tcsim with the command syntax: tcsim example.tcsim produces the following output: 0.000000 E : 0x93a87c8 40 : eth0: 45000028 00000000 40060000 0a000001 0a000002 00500000 00000000 00000000 50000000 00000000 0.000000 D : 0x93a87c8 40 : eth0: 45000028 00000000 40060000 0a000001 0a000002 00500000 00000000 00000000 50000000 00000000 0.000000 E : 0x93a88c0 40 : eth0: 45000028 00000000 40060000 0a000001 0a000002 00160000 00000000 00000000 50000000 00000000 0.000000 * : 0x93a88c0 40 : eth0: enqueue returns POLICED (3) Output Filtering (1) Running the simulation script example with the command syntax: tcsim exampe | tcsim_filter -c which counts the packets enqueued and dequeued, produces the following outputs: D: 1590 E: 2002 Output Filtering (2) Running the simulation script dsmark+policing with the command syntax: tcsim dsmark+policing | tcsim_filter -c tos produces the following output: D:00 201 D:b8 139 E:00 201 E:01 201 Likewise, tcsim dsmark+policing | tcsim_filter -c tos=0xb8 produces the output: D 139 Graphical Output Filtered output can be further processed with the script tcsim_plot, which uses gnuplot to generate plots. The following plot types are available: • • • • rate: Bit rate (based on the inter-arrival time) iat: Packet inter-arrival time cumul: Cumulative amount of data delay: Queuing delay, measured at dequeue time Time of 1st Packet Loss Scenario 1 0.356500 0.357000 0.357000 0.357500 0.357500 E : 0x9ecf858 100 : eth0: 45000064 00000000 40000000 0a0000 ... E : 0x9ed3c58 100 : eth0: 45000064 00000000 40000000 0a0000 ... * : 0x9ed3c58 100 : eth0: enqueue returns DROP (1) E : 0x9ed3c58 100 : eth0: 45000064 00000000 40000000 0a0000 ... * : 0x9ed3c58 100 : eth0: enqueue returns DROP (1) Scenario 2 0.189500 0.190000 0.190000 0.190000 E : 0x82b0ee8 100 : eth0: 45000064 00000000 40000000 0a0000 ... E : 0x82b0ff8 100 : eth0: 45000064 00000000 40000000 0a0000 ... * : 0x82b0ff8 100 : eth0: enqueue returns DROP (1) D : 0x82aece8 100 : eth0: 45000064 00000000 40000000 0a0000 ... Cumulative Amount of Data Queuing Delay References • • • TCNG HomePage, URL: http://tcng.sourceforge.net Linux Advanced Routing & Traffic Control, URL: http://lartc.org/ L. Wischhof and J. W. Lockwood, “Packet Scheduling for LinkSharing and Quality of Service Support in Wireless Local Area Networks”, November 2001 Linux IP, URL: http://linux-ip.net/ Practical QoS, URL: http://www.opalsoft.net/qos/index.html • •

Related docs
Traffic-Control-tcng-HTB-HOWTO
Views: 68  |  Downloads: 1
bwmanagement
Views: 0  |  Downloads: 0
Traffic-Control-HOWTO
Views: 74  |  Downloads: 2
baltimore business networking
Views: 24  |  Downloads: 3
e-Business Natural Gas Production
Views: 0  |  Downloads: 0
UAW Jan 2009 News _ ViewsBu2
Views: 1  |  Downloads: 0
E Reporting System XML Transmission Protocol
Views: 13  |  Downloads: 0
premium docs
Other docs by techmaster
FORM 1099DIV DIVIDENDS AND DISTRIBUTIONS 2005
Views: 140  |  Downloads: 0
Treaty of Guadalupe Hidalgo _1848_ - 2
Views: 90  |  Downloads: 0
Form 9465 Installment Agreement Request
Views: 228  |  Downloads: 3
Nuove Indicazioni Nazionali
Views: 524  |  Downloads: 5
Morrill Act _1862_ - 2[2]
Views: 41  |  Downloads: 0
Monroe Doctrine _1823_ --1[1]
Views: 80  |  Downloads: 0
SECURITY AGREEMENT[1]
Views: 77  |  Downloads: 0
Sample Risk JH Reid
Views: 146  |  Downloads: 2
Alien and Sedition Acts _1798_ Image 2[2]
Views: 87  |  Downloads: 0