sabato, Novembre 23, 2024

Cisco: laboratorio QoS

Gianluca Lini
Gianluca Linihttp://www.gianlucalini.it
Technology Enthusiast. I'm a System Engineer and sometimes an independent Security Researcher. IEEE member.

qoslab1

Utilizziamo la Modular QoS CLI per garantire banda minima ai pc secondo il criterio IP più basso maggiore banda.

N.B. Utilizzando CBWFQ di default la somma delle bandwith allocate non deve superare il 75% della banda totale dell’interfaccia. Per modificare questo valore usare max-reserved-bandwidth [1-100]
Su JACK:

access-list 101 permit udp host 192.168.0.101 any
access-list 102 permit udp host 192.168.0.102 any
access-list 103 permit udp host 192.168.0.103 any

class-map match-all pc101
 match access-group 101
class-map match-all pc_103
 match access-group 103
class-map match-all pc_102
 match access-group 102

policy-map regole
 class pc101
  bandwidth percent 30

 class pc_102
  bandwidth percent 20
 class pc_103
  bandwidth percent 10

interface Serial0
 ip address 10.0.0.2 255.0.0.0
 max-reserved-bandwidth 100
 service-policy output regole

In questo caso ho assegnato solo un 60% della banda alle class-map e con il link seriale a 1544Mbit, questo vuol dire 618K di banda ancora disponibile, 40%, da assegnare come mostrato qui in seguito:

JACK#sh int s0
Serial0 is up, line protocol is up 
  Hardware is PowerQUICC Serial
  Internet address is 10.0.0.2/8
  MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec, 
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation HDLC, loopback not set
  Keepalive set (10 sec)
  Last input 00:00:06, output 00:00:02, output hang never
  Last clearing of "show interface" counters never
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: weighted fair
  Output queue: 0/1000/64/0 (size/max total/threshold/drops) 
     Conversations  0/1/256 (active/max active/max total)
     Reserved Conversations 3/3 (allocated/max allocated)
     Available Bandwidth 619 kilobits/sec

Questo perché ho utilizzato max-reserved-bandwidth a 100.

Vediamo il caso standard, ovvero con il 75% del totale della banda assegnata, nel caso del link a 1.544Mbit, sarà di 1.158Mbit

JACK#sh int s0
Serial0 is up, line protocol is up 
  Hardware is PowerQUICC Serial
  Internet address is 10.0.0.2/8
  MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec, 
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation HDLC, loopback not set
  Keepalive set (10 sec)
  Last input 00:00:06, output 00:00:06, output hang never
  Last clearing of "show interface" counters never
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: weighted fair
  Output queue: 0/1000/64/0 (size/max total/threshold/drops) 
     Conversations  0/1/256 (active/max active/max total)
     Reserved Conversations 0/0 (allocated/max allocated)
     Available Bandwidth 1158 kilobits/sec
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     1004 packets input, 61639 bytes, 0 no buffer
     Received 965 broadcasts, 0 runts, 0 giants, 0 throttles
     2 input errors, 0 CRC, 2 frame, 0 overrun, 0 ignored, 0 abort
     1237 packets output, 112822 bytes, 0 underruns
     0 output errors, 0 collisions, 57 interface reseti

La configurazione su JACK è la seguente:

access-list 101 permit udp host 192.168.0.101 any
access-list 102 permit udp host 192.168.0.102 any
access-list 103 permit udp host 192.168.0.103 any

class-map match-all pc101
 match access-group 101
class-map match-all pc_103
 match access-group 103
class-map match-all pc_102
 match access-group 102

policy-map regole
 class pc101
  bandwidth percent 50
 class pc_102
  bandwidth percent 20
class pc_103
  bandwidth percent 5

interface FastEthernet0
 ip address 192.168.0.1 255.255.255.0
 speed auto

interface Serial0
 ip address 10.0.0.2 255.0.0.0

N.B. Le prove seguenti sono state effettuate con JACK programmato come nel modo standard.

Sui ogni pc è stato installato iperf, reperibile qui.
Sul notebook sono state lanciate tre istanze del programma in modalità server per la ricezione di pacchetti UDP e in ascolto rispettivamente sulle porte 5001, 5002 e 5003 per accettare le tre connessioni client.

Sui PC è stata lanciata una sessione di iperf in modalità client secondo lo schema:

192.168.0.101 -> 192.168.1.4:5001
192.168.0.102 -> 192.168.1.4:5002
192.168.0.103 -> 192.168.1.4:5003

e impostato per generare 1Mbit di traffico UDP per un tempo di 10 sec.
Di seguito riportiamo i dati numerici e i grafici di banda e jitter dei singoli flussi udp.
PC1:

[1932] local 192.168.1.4 port 5002 connected with 192.168.0.101 port 1086
[ ID] 	Interval	Transfer	Bandwidth       Jitter	Lost/Total Datagrams
[1932]  0.0- 1.0 sec   125 KBytes  1023 Kbits/sec  3.352 ms 1127103316/   87 (1.3e+009%)
[1932]  1.0- 2.0 sec   129 KBytes  1058 Kbits/sec  5.363 ms    0/   90 (0%)
[1932]  2.0- 3.0 sec   128 KBytes  1047 Kbits/sec  2.720 ms    0/   89 (0%)
[1932]  3.0- 4.0 sec   128 KBytes  1047 Kbits/sec  3.806 ms    0/   89 (0%)
[1932]  4.0- 5.0 sec   129 KBytes  1058 Kbits/sec  3.348 ms    0/   90 (0%)
[1932]  5.0- 6.0 sec   128 KBytes  1047 Kbits/sec  3.993 ms    0/   89 (0%)
[1932]  6.0- 7.0 sec   128 KBytes  1047 Kbits/sec  4.015 ms    0/   89 (0%)
[1932]  7.0- 8.0 sec   128 KBytes  1047 Kbits/sec  4.644 ms    0/   89 (0%)
[1932]  8.0- 9.0 sec   128 KBytes  1047 Kbits/sec  3.334 ms    0/   89 (0%)
[1932]  9.0-10.0 sec   129 KBytes  1058 Kbits/sec  5.900 ms    0/   90 (0%)
[1932]  0.0-10.0 sec  1282 KBytes  1046 Kbits/sec  6.437 ms    0/  893 (0%)

qoslab2

qoslab3

PC2:

[1932] local 192.168.1.4 port 5001 connected with 192.168.0.102 port 1124
[ ID] 	Interval	Transfer	Bandwidth	Jitter	Lost/Total Datagrams
[1932]  0.0- 1.0 sec  93.3 KBytes   764 Kbits/sec  8.853 ms 1127103316/   65 (1.7e+009%)
[1932]  1.0- 2.0 sec  87.6 KBytes   717 Kbits/sec  8.940 ms    0/   61 (0%)
[1932]  2.0- 3.0 sec  89.0 KBytes   729 Kbits/sec  9.593 ms    0/   62 (0%)
[1932]  3.0- 4.0 sec  89.0 KBytes   729 Kbits/sec  10.156 ms   15/   77 (19%)
[1932]  4.0- 5.0 sec  86.1 KBytes   706 Kbits/sec  9.717 ms   27/   87 (31%)
[1932]  5.0- 6.0 sec  89.0 KBytes   729 Kbits/sec  8.595 ms   28/   90 (31%)
[1932]  6.0- 7.0 sec  89.0 KBytes   729 Kbits/sec  9.909 ms   29/   91 (32%)
[1932]  7.0- 8.0 sec  86.1 KBytes   706 Kbits/sec  6.750 ms   26/   86 (30%)
[1932]  8.0- 9.0 sec  89.0 KBytes   729 Kbits/sec  7.844 ms   29/   91 (32%)
[1932]  9.0-10.0 sec   109 KBytes   894 Kbits/sec  10.207 ms   34/  110 (31%)
[1932]  0.0-10.4 sec   988 KBytes   777 Kbits/sec  10.337 ms  205/  893 (23%)

qoslab4

qoslab5

PC3:

[1932] local 192.168.1.4 port 5003 connected with 192.168.0.103 port 1203
[ ID]	Interval	Transfer	Bandwidth	Jitter	Lost/Total Datagrams
[1932]  0.0- 1.0 sec  21.5 KBytes   176 Kbits/sec  32.374 ms 1127103316/   15 (7.5e+009%)
[1932]  1.0- 2.0 sec  21.5 KBytes   176 Kbits/sec  46.099 ms    0/   15 (0%)
[1932]  2.0- 3.0 sec  23.0 KBytes   188 Kbits/sec  51.364 ms    0/   16 (0%)
[1932]  3.0- 4.0 sec  21.5 KBytes   176 Kbits/sec  52.336 ms    0/   15 (0%)
[1932]  4.0- 5.0 sec  23.0 KBytes   188 Kbits/sec  50.489 ms    4/   20 (20%)
[1932]  5.0- 6.0 sec  21.5 KBytes   176 Kbits/sec  24.842 ms   71/   86 (83%)
[1932]  6.0- 7.0 sec  21.5 KBytes   176 Kbits/sec  16.016 ms   73/   88 (83%)

qoslab6

qoslab7

Articoli correlati

Noleggia una Tesla per il tuo evento ICT!

Categorie