Htb Match
The following scenario shows how to configure different matches in a HTB qdisc.
Test HTB Matches
Description
This scenario tests different matches in HTB qdisc.
Scenario
Step 1: Set the following configuration in DUT0
:
set interfaces ethernet eth0 address 10.0.0.2/24 set interfaces ethernet eth0 traffic control out QDISC set interfaces ethernet eth0 traffic policy local-out POL set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0' set traffic control QDISC type htb bandwidth 100 set traffic control QDISC type htb class 1 bandwidth percentage 100 set traffic control QDISC type htb class 2 bandwidth percentage 100 set traffic control QDISC type htb default-class 2 set traffic control QDISC type htb match 1 class 1 set traffic policy POL rule 1 set mark 99
Step 2: Set the following configuration in DUT1
:
set interfaces ethernet eth0 address 10.0.0.1/24 set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
Step 3: Ping IP address 10.0.0.1
from DUT0
:
admin@DUT0$ ping 10.0.0.1 count 1 size 56 timeout 1Show output
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data. 64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=0.533 ms --- 10.0.0.1 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.533/0.533/0.533/0.000 ms
Step 4: Modify the following configuration lines in DUT0
:
set traffic control QDISC type htb match 1 ether protocol arp
Step 5: Send arp ping from DUT0
to IP address 10.0.0.1
:
admin@DUT0$ arping 10.0.0.1 interface eth0 timeout 5 count 1Show output
ARPING 10.0.0.1 from 10.0.0.2 eth0 Unicast reply from 10.0.0.1 [DE:AD:BE:EF:6C:10] 0.859ms Sent 1 probes (1 broadcast(s)) Received 1 response(s)
Step 6: Run command traffic control show
at DUT0
and check if output matches the following regular expressions:
[1-3]:1\s+.*[1-3]:0\s+[1-9][0-9]*\s+[1-9][0-9]*\s+0Show output
Traffic control for interface 'eth0' - 'egress' mode ------------------------------------------------------------------------------------ ID traffic control type parent bytes sent pkts sent pkts dropped ------------------------------------------------------------------------------------ 1:0 QDISC htb root 282 3 0 1:1 QDISC class 1 1:0 42 1 0 1:2 QDISC class 2 (default) 1:0 240 2 0 2:0 - fq_codel 1:1 42 1 0 3:0 - fq_codel 1:2 240 2 0
Step 7: Modify the following configuration lines in DUT0
:
delete traffic control QDISC type htb match 1 ether
Step 8: Modify the following configuration lines in DUT0
:
set traffic control QDISC type htb match 1 ether destination 'DE:AD:BE:EF:6C:10'
Step 9: Send arp ping from DUT1
to IP address 10.0.0.2
:
admin@DUT1$ arping 10.0.0.2 interface eth0 timeout 5 count 1Show output
ARPING 10.0.0.2 from 10.0.0.1 eth0 Unicast reply from 10.0.0.2 [DE:AD:BE:EF:6C:00] 0.880ms Sent 1 probes (1 broadcast(s)) Received 1 response(s)
Step 10: Run command traffic control show
at DUT0
and check if output matches the following regular expressions:
[1-3]:1\s+.*[1-3]:0\s+[1-9][0-9]*\s+[1-9][0-9]*\s+0Show output
Traffic control for interface 'eth0' - 'egress' mode ------------------------------------------------------------------------------------ ID traffic control type parent bytes sent pkts sent pkts dropped ------------------------------------------------------------------------------------ 1:0 QDISC htb root 42 1 0 1:1 QDISC class 1 1:0 42 1 0 1:2 QDISC class 2 (default) 1:0 0 0 0 2:0 - fq_codel 1:1 42 1 0 3:0 - fq_codel 1:2 0 0 0
Step 11: Modify the following configuration lines in DUT0
:
delete traffic control QDISC type htb match 1 ether
Step 12: Modify the following configuration lines in DUT0
:
set traffic control QDISC type htb match 1 ip protocol tcp
Step 13: Initiate a tcp connection from DUT0
to DUT1
and try to send some messages between both endpoints
admin@DUT1$ monitor test connection server 4040 tcp admin@DUT0$ monitor test connection client 10.0.0.1 4040 tcp
Step 14: Run command traffic control show
at DUT0
and check if output matches the following regular expressions:
[1-3]:1\s+.*[1-3]:0\s+[1-9][0-9]*\s+[1-9][0-9]*\s+0Show output
Traffic control for interface 'eth0' - 'egress' mode ------------------------------------------------------------------------------------ ID traffic control type parent bytes sent pkts sent pkts dropped ------------------------------------------------------------------------------------ 1:0 QDISC htb root 1032 14 0 1:1 QDISC class 1 1:0 1032 14 0 1:2 QDISC class 2 (default) 1:0 0 0 0 2:0 - fq_codel 1:1 1032 14 0 3:0 - fq_codel 1:2 0 0 0
Step 15: Modify the following configuration lines in DUT0
:
delete traffic control QDISC type htb match 1 ip
Step 16: Modify the following configuration lines in DUT0
:
set traffic control QDISC type htb match 1 ip source address 10.0.0.2
Step 17: Initiate a tcp connection from DUT0
to DUT1
and try to send some messages between both endpoints
admin@DUT1$ monitor test connection server 4040 tcp admin@DUT0$ monitor test connection client 10.0.0.1 4040 tcp
Step 18: Run command traffic control show
at DUT0
and check if output matches the following regular expressions:
[1-3]:1\s+.*[1-3]:0\s+[1-9][0-9]*\s+[1-9][0-9]*\s+0Show output
Traffic control for interface 'eth0' - 'egress' mode ------------------------------------------------------------------------------------ ID traffic control type parent bytes sent pkts sent pkts dropped ------------------------------------------------------------------------------------ 1:0 QDISC htb root 1032 14 0 1:1 QDISC class 1 1:0 1032 14 0 1:2 QDISC class 2 (default) 1:0 0 0 0 2:0 - fq_codel 1:1 1032 14 0 3:0 - fq_codel 1:2 0 0 0
Step 19: Modify the following configuration lines in DUT0
:
delete traffic control QDISC type htb match 1 ip
Step 20: Modify the following configuration lines in DUT0
:
set traffic control QDISC type htb match 1 ip destination address 10.0.0.1
Step 21: Initiate a tcp connection from DUT0
to DUT1
and try to send some messages between both endpoints
admin@DUT1$ monitor test connection server 4040 tcp admin@DUT0$ monitor test connection client 10.0.0.1 4040 tcp
Step 22: Run command traffic control show
at DUT0
and check if output matches the following regular expressions:
[1-3]:1\s+.*[1-3]:0\s+[1-9][0-9]*\s+[1-9][0-9]*\s+0Show output
Traffic control for interface 'eth0' - 'egress' mode ------------------------------------------------------------------------------------ ID traffic control type parent bytes sent pkts sent pkts dropped ------------------------------------------------------------------------------------ 1:0 QDISC htb root 1032 14 0 1:1 QDISC class 1 1:0 1032 14 0 1:2 QDISC class 2 (default) 1:0 0 0 0 2:0 - fq_codel 1:1 1032 14 0 3:0 - fq_codel 1:2 0 0 0
Step 23: Modify the following configuration lines in DUT0
:
delete traffic control QDISC type htb match 1 ip
Step 24: Modify the following configuration lines in DUT0
:
set traffic control QDISC type htb match 1 ip source port 37440
Step 25: Initiate a tcp connection from DUT0
to DUT1
and try to send some messages between both endpoints
admin@DUT1$ monitor test connection server 8080 tcp admin@DUT0$ monitor test connection client 10.0.0.1 8080 tcp source-port 37440
Step 26: Run command traffic control show
at DUT0
and check if output matches the following regular expressions:
[1-3]:1\s+.*[1-3]:0\s+[1-9][0-9]*\s+[1-9][0-9]*\s+0Show output
Traffic control for interface 'eth0' - 'egress' mode ------------------------------------------------------------------------------------ ID traffic control type parent bytes sent pkts sent pkts dropped ------------------------------------------------------------------------------------ 1:0 QDISC htb root 1032 14 0 1:1 QDISC class 1 1:0 1032 14 0 1:2 QDISC class 2 (default) 1:0 0 0 0 2:0 - fq_codel 1:1 1032 14 0 3:0 - fq_codel 1:2 0 0 0
Step 27: Modify the following configuration lines in DUT0
:
delete traffic control QDISC type htb match 1 ip
Step 28: Modify the following configuration lines in DUT0
:
set traffic control QDISC type htb match 1 ip destination port 8080
Step 29: Initiate a tcp connection from DUT0
to DUT1
and try to send some messages between both endpoints
admin@DUT1$ monitor test connection server 8080 tcp admin@DUT0$ monitor test connection client 10.0.0.1 8080 tcp
Step 30: Run command traffic control show
at DUT0
and check if output matches the following regular expressions:
[1-3]:1\s+.*[1-3]:0\s+[1-9][0-9]*\s+[1-9][0-9]*\s+0Show output
Traffic control for interface 'eth0' - 'egress' mode ------------------------------------------------------------------------------------ ID traffic control type parent bytes sent pkts sent pkts dropped ------------------------------------------------------------------------------------ 1:0 QDISC htb root 1032 14 0 1:1 QDISC class 1 1:0 1032 14 0 1:2 QDISC class 2 (default) 1:0 0 0 0 2:0 - fq_codel 1:1 1032 14 0 3:0 - fq_codel 1:2 0 0 0
Step 31: Modify the following configuration lines in DUT0
:
delete traffic control QDISC type htb match 1 ip
Step 32: Modify the following configuration lines in DUT0
:
set traffic control QDISC type htb match 1 ip tcp ack
Step 33: Initiate a tcp connection from DUT0
to DUT1
and try to send some messages between both endpoints
admin@DUT1$ monitor test connection server 7070 tcp admin@DUT0$ monitor test connection client 10.0.0.1 7070 tcp
Step 34: Run command traffic control show
at DUT0
and check if output matches the following regular expressions:
[1-3]:1\s+.*[1-3]:0\s+[1-9][0-9]*\s+[1-9][0-9]*\s+0Show output
Traffic control for interface 'eth0' - 'egress' mode ------------------------------------------------------------------------------------ ID traffic control type parent bytes sent pkts sent pkts dropped ------------------------------------------------------------------------------------ 1:0 QDISC htb root 1032 14 0 1:1 QDISC class 1 1:0 74 1 0 1:2 QDISC class 2 (default) 1:0 958 13 0 2:0 - fq_codel 1:1 74 1 0 3:0 - fq_codel 1:2 958 13 0
Step 35: Modify the following configuration lines in DUT0
:
delete traffic control QDISC type htb match 1 ip
Step 36: Modify the following configuration lines in DUT0
:
set traffic control QDISC type htb match 1 mark 99
Step 37: Initiate a tcp connection from DUT0
to DUT1
and try to send some messages between both endpoints
admin@DUT1$ monitor test connection server 9090 tcp admin@DUT0$ monitor test connection client 10.0.0.1 9090 tcp
Step 38: Run command traffic control show
at DUT0
and check if output matches the following regular expressions:
[1-3]:1\s+.*[1-3]:0\s+[1-9][0-9]*\s+[1-9][0-9]*\s+0Show output
Traffic control for interface 'eth0' - 'egress' mode ------------------------------------------------------------------------------------ ID traffic control type parent bytes sent pkts sent pkts dropped ------------------------------------------------------------------------------------ 1:0 QDISC htb root 1032 14 0 1:1 QDISC class 1 1:0 1032 14 0 1:2 QDISC class 2 (default) 1:0 0 0 0 2:0 - fq_codel 1:1 1032 14 0 3:0 - fq_codel 1:2 0 0 0
Step 39: Modify the following configuration lines in DUT0
:
delete traffic control QDISC type htb match 1 mark