Limiting Bandwidth

SOURCE
NOTE:
Option 3 haven’t tested because didn’t appear in unetlab IOL router cli and only outbound traffic only

Option 1 CAR (Committed Access Rate)
R1#interface e0/2
rate-limit intput 128000 24000 48000 conform-action transmit exceed-action drop
rate-limit output 128000 24000 48000 conform-action transmit exceed-action drop

Formula
rate-limit input|output configured_rate normal_burst extended_burst
configured_rate=(expressed in bits per second)
normal_burst=(configured_rate/8)*1.5
extended_burst=2*normal_burst

Option 2 Policing via MQC (Modular Quality of Service)
policy-map 128K
class class-default
!bc=cir/4
police 128k bc 32000
interface e0/2
service-policy input 128K
service-policy output 128K

Option 3 (Generic Traffic Shaping–less draconian, but outbound only)
interface FastEthernet0/0

traffic-shape rate 7000000 175000 175000 1000

Option 4 MQC (Modular Quality of Service) based traffic shaping–less draconian, but outbound only
policy-map SHAPE128K
class class-default
  shape average 128000 128000 128000
interface Ethernet0/2
 ip address 12.0.0.2 255.255.255.0
 service-policy output SHAPE128K
Image.png
OPTION1
R1:
hostname R1
interface Loopback0
 ip address 1.0.0.1 255.255.255.255
interface Ethernet0/0
 ip address 10.0.1.1 255.255.255.0 secondary
 ip address 10.0.0.1 255.255.255.0
 ip policy route-map ISPSelect
interface Ethernet0/1
 ip address 13.0.0.2 255.255.255.0
 rate-limit input 64000 12000 24000 conform-action transmit exceed-action drop
 rate-limit output 64000 12000 24000 conform-action transmit exceed-action drop
interface Ethernet0/2
 ip address 12.0.0.2 255.255.255.0
 rate-limit input 128000 24000 48000 conform-action transmit exceed-action drop
 rate-limit output 128000 24000 48000 conform-action transmit exceed-action drop
router eigrp 1
 network 1.0.0.1 0.0.0.0
 network 10.0.0.0 0.0.0.255
 network 10.0.1.0 0.0.0.255
 network 12.0.0.0 0.0.0.255
 network 13.0.0.0 0.0.0.255
 redistribute static
ip route 0.0.0.0 0.0.0.0 Ethernet0/2
ip route 0.0.0.0 0.0.0.0 Ethernet0/1
route-map ISPSelect permit 1
 match ip address 101
 set ip next-hop 12.0.0.1
route-map ISPSelect permit 2
 match ip address 102
 set ip next-hop 13.0.0.1
access-list 101 permit ip 10.0.0.0 0.0.0.255 any

access-list 102 permit ip 10.0.1.0 0.0.0.255 any

Verification

to proof bandwidth between PC1 and SVR1 is 128kb, we will use bult-in ttcp

SVR1#ttcp
transmit or receive [receive]:
perform tcp half close [n]:
receive buflen [8192]:
bufalign [16384]:
bufoffset [0]:
port [5001]:
sinkmode [y]:
rcvwndsize [4128]:
delayed ACK [y]:
show tcp information at end [n]:
ttcp-r: buflen=8192, align=16384/0, port=5001
rcvwndsize=4128, delayedack=yes  tcp
ttcp-r: accept from 12.0.0.2
ttcp-r: 409600 bytes in 24821 ms (24.821 real seconds) (~15 kB/s)+++
ttcp-r: 163 I/O calls

ttcp-r: 0 sleeps (0 ms total) (0 ms average)

PC1#ttcp
transmit or receive [receive]: t
Target IP address: 45.0.0.2
perform tcp half close [n]:
send buflen [8192]:
send nbuf [2048]: 50
bufalign [16384]:
bufoffset [0]:
port [5001]:
sinkmode [y]:
buffering on writes [y]:
show tcp information at end [n]:

Throughput calculation
SOURCE:
http://feamane.org/comms/testtools/ttcp/ttcp-quickstartguide.html
50 buffers * 8192 bytes each = 409,600 bytes
163 IP packets * 40 bytes of header = 6520 bytes
Total data transmitted = 416120 bytes
416120 bytes * 8 bits/byte = 3328960 bits
3328960 bits / 24.821 seconds = 134118  bits/second

For Serial interface
!set bandwidth on DTE DCE
!set clock-rate only on DCE
interface Serial1/1
bandwidth 128

clock-rate 128000

Catalyst
SOURCE
Switch(config)# interface FastEthernet 0/1
Switch(config-if)# srr-queue bandwidth limit 90

The 90 sets the outbound bandwidth limit on the port to 90 percent of the port speed. Since this is a 100-Mb port, this should limit the outbound traffic from the port to 10 Mb.

-on the vlan, we can do this
int vlan 400
rate-limit input 128000 24000 48000 conform-action transmit exceed-action drop
rate-limit output 128000 24000 48000 conform-action transmit exceed-action drop
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s