No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>Search

Reminder

To have a better experience, please upgrade your IE browser.

upgrade

S12700 Series Agile Switches Typical Configuration Examples

This document provides examples for configuring features in typical usage scenarios.
Rate and give feedback:
Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document. Note: Even the most advanced machine translation cannot match the quality of professional translators. Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).
Example for Allowing Certain Users to Access the Internet in the Specified Time Range

Example for Allowing Certain Users to Access the Internet in the Specified Time Range

ACL Time Range Overview

An ACL defines many matching conditions to filter most packets transmitted on a network; however, it cannot filter packets in the specified time range.

You can configure a time range and associate the time range with an ACL rule to filter packets based on time. This specifies different policies for users in different time ranges.

In this example, a basic ACL associated with a time range is applied to the traffic policy module so that the device can filter packets sent from internal users to the Internet in the specified time range. As a result, users can access the Internet only in the specified time range.

Configuration Notes

This example applies to all versions of the S12700.

Networking Requirements

As shown in Figure 15-5, the departments of an enterprise are connected through the Switch. The enterprise allows all employees to access the Internet on work days (Monday to Friday), and only the managers to access the Internet on weekends (Saturday and Sunday).

Figure 15-5  Allowing certain users to access the Internet in the specified time range

Configuration Roadmap

The following configurations are performed on the Switch. The configuration roadmap is as follows:

  1. Configure the time range, basic ACL, and ACL-based traffic classifier to filter packets sent from internal users to the Internet and thus allow only certain users to access the Internet in the specified time range.
  2. Configure a traffic behavior to permit the packets that match the ACL permit rule.
  3. Configure and apply a traffic policy to make the ACL and traffic behavior take effect.

Procedure

  1. Configure VLANs and IP addresses for interfaces.

    # Create VLAN 10 and VLAN 20.

    <HUAWEI> system-view
    [HUAWEI] sysname Switch
    [Switch] vlan batch 10 20
    

    # Configure GE1/0/1 and GE1/0/2 of the Switch as trunk interfaces and add them to VLAN 10 and VLAN 20 respectively. Configure GE2/0/1 of the Switch as a trunk interface and add it to both VLAN 10 and VLAN 20.

    [Switch] interface gigabitethernet 1/0/1
    [Switch-GigabitEthernet1/0/1] port link-type trunk
    [Switch-GigabitEthernet1/0/1] port trunk allow-pass vlan 10
    [Switch-GigabitEthernet1/0/1] quit
    [Switch] interface gigabitethernet 1/0/2
    [Switch-GigabitEthernet1/0/2] port link-type trunk
    [Switch-GigabitEthernet1/0/2] port trunk allow-pass vlan 20
    [Switch-GigabitEthernet1/0/2] quit
    [Switch] interface gigabitethernet 2/0/1
    [Switch-GigabitEthernet2/0/1] port link-type trunk
    [Switch-GigabitEthernet2/0/1] port trunk allow-pass vlan 10 20
    [Switch-GigabitEthernet2/0/1] quit

    # Create VLANIF 10 and VLANIF 20 and assign IP addresses to them.

    [Switch] interface vlanif 10
    [Switch-Vlanif10] ip address 10.1.1.1 24
    [Switch-Vlanif10] quit
    [Switch] interface vlanif 20
    [Switch-Vlanif20] ip address 10.1.2.1 24
    [Switch-Vlanif20] quit
    

  2. Configure a time range.

    # Configure the periodic time range from Saturday to Sunday.

    [Switch] time-range rest-time 0:00 to 23:59 off-day  //Configure a periodic time range for an ACL.

  3. Configure an ACL.

    # Create basic ACL 2001 and configure rules to allow the R&D and marketing managers (10.1.1.11 and 10.1.2.12) to access the Internet anytime and prevent other employees from accessing the Internet on Saturday and Sunday. That is, only the managers of R&D and marketing departments can access the Internet on Saturday and Sunday.

    [Switch] acl 2001
    [Switch-acl-basic-2001] rule permit source 10.1.1.11 0  //Allow the manager of the R&D department to access the Internet anytime.
    [Switch-acl-basic-2001] rule permit source 10.1.2.12 0  //Allow the manager of the marketing department to access the Internet anytime.
    [Switch-acl-basic-2001] rule deny time-range rest-time  //Prevent other users from accessing the Internet On Saturday and Sunday.
    [Switch-acl-basic-2001] quit

  4. Configure the basic ACL-based traffic classifier.

    # Configure the traffic classifier tc1 to classify packets that match ACL 2001.

    [Switch] traffic classifier tc1  //Create a traffic classifier.
    [Switch-classifier-tc1] if-match acl 2001  //Associate an ACL with the traffic classifier.
    [Switch-classifier-tc1] quit

  5. Configure traffic behaviors.

    # Configure the traffic behavior tb1 and set the action to permit (default value).

    NOTE:

    Packets matching the ACL are discarded as long as a deny action exists in an ACL rule or traffic behavior.

    [Switch] traffic behavior tb1  //Create a traffic behavior.
    [Switch-behavior-tb1] quit

  6. Configure the traffic policy.

    # Define the traffic policy and associate the traffic classifier and traffic behavior with the traffic policy.

    [Switch] traffic policy tp1  //Create a traffic policy.
    [Switch-trafficpolicy-tp1] classifier tc1 behavior tb1  //Associate the traffic classifier tc1 with the traffic behavior tb1.
    [Switch-trafficpolicy-tp1] quit

  7. Apply the traffic policy to an interface.

    # Packets from internal hosts are forwarded to the Internet through GE2/0/1; therefore, apply the traffic policy tp1 to the outbound direction of GE2/0/1.

    [Switch] interface gigabitethernet 2/0/1
    [Switch-GigabitEthernet2/0/1] traffic-policy tp1 outbound  //Apply the traffic policy to the outbound direction of an interface.
    [Switch-GigabitEthernet2/0/1] quit
    

  8. Verify the configuration.

    # Check the configuration of ACL rules.

    [Switch] display acl 2001
    Basic ACL 2001, 3 rules                                                         
    Acl's step is 5                                                                 
     rule 5 permit source 10.1.1.11 0 (match-counter 0)                             
     rule 10 permit source 10.1.2.12 0 (match-counter 0)                            
     rule 15 deny time-range rest-time(match-counter 0) (Inactive)  

    # Check the configuration of the traffic classifier.

    [Switch] display traffic classifier user-defined
      User Defined Classifier Information:
       Classifier: tc1
        Precedence: 5
        Operator: OR
        Rule(s) : if-match acl 2001                                                 
    
    Total classifier number is 1   

    # Check the configuration of the traffic policy.

    [Switch] display traffic policy user-defined tp1
      User Defined Traffic Policy Information:                                      
      Policy: tp1                                                                   
       Classifier: tc1                                                              
        Operator: OR                                                                
         Behavior: tb1                                                              
          Permit  
    Total policy number is 1

    # All employees can access the Internet on work days. Only the managers (10.1.1.11 and 10.1.2.12) of R&D and marketing departments can access the Internet on weekends.

Configuration Files

Configuration file of the Switch

#
sysname Switch
#
vlan batch 10 20 
#                                                                               
time-range rest-time 00:00 to 23:59 off-day 
#
acl number 2001                                                                 
 rule 5 permit source 10.1.1.11 0                                               
 rule 10 permit source 10.1.2.12 0                                              
 rule 15 deny time-range rest-time 
#
traffic classifier tc1 operator or precedence 5  
 if-match acl 2001                                                              
#
traffic behavior tb1
 permit
#
traffic policy tp1 match-order config
 classifier tc1 behavior tb1
#
interface Vlanif10
 ip address 10.1.1.1 255.255.255.0
#
interface Vlanif20
 ip address 10.1.2.1 255.255.255.0
#
interface GigabitEthernet1/0/1
 port link-type trunk                                                           
 port trunk allow-pass vlan 10 
#
interface GigabitEthernet1/0/2
 port link-type trunk                                                           
 port trunk allow-pass vlan 20 
#
interface GigabitEthernet2/0/1
 port link-type trunk                                                           
 port trunk allow-pass vlan 10 20 
 traffic-policy tp1 outbound
#
return 
Download
Updated: 2019-05-16

Document ID: EDOC1000069466

Views: 246296

Downloads: 1974

Average rating:
This Document Applies to these Products
Related Documents
Related Version
Share
Previous Next