As shown in Figure 1, users are connected to the Switch through GE0/0/1. The Switch needs to block certain types of IPv6 packets from users in which the source IPv6 address is fc01::2/64 and the destination IPv6 address is fc01::1/64.
The following configurations are performed on the Switch. The configuration roadmap is as follows:
<HUAWEI> system-view [HUAWEI] sysname Switch [Switch] ipv6 [Switch] vlan batch 10 [Switch] interface gigabitethernet 0/0/1 [Switch-GigabitEthernet0/0/1] port link-type trunk [Switch-GigabitEthernet0/0/1] port trunk allow-pass vlan 10 [Switch-GigabitEthernet0/0/1] quit [Switch] interface vlanif 10 [Switch-Vlanif10] ipv6 enable [Switch-Vlanif10] ipv6 address fc01::1 64 [Switch-Vlanif10] quit
[Switch] acl ipv6 number 3001 [Switch-acl6-adv-3001] rule deny ipv6 source fc01::2/64 destination fc01::1/64 [Switch-acl6-adv-3001] quit [Switch] traffic classifier class1 [Switch-classifier-class1] if-match ipv6 acl 3001 [Switch-classifier-class1] quit [Switch] traffic behavior behav1 [Switch-behavior-behav1] deny [Switch-behavior-behav1] statistic enable [Switch-behavior-behav1] quit [Switch] traffic policy policy1 [Switch-trafficpolicy-policy1] classifier class1 behavior behav1 [Switch-trafficpolicy-policy1] quit [Switch] interface gigabitethernet 0/0/1 [Switch-GigabitEthernet0/0/1] traffic-policy policy1 inbound [Switch-GigabitEthernet0/0/1] quit
# Check the ACL6 configuration.
[Switch] display acl ipv6 3001
Advanced IPv6 ACL 3001, 1 rule
rule 0 deny ipv6 source FC01::/64 destination FC01::/64
# Check the configuration of the traffic classifier.
[Switch] display traffic classifier user-defined
User Defined Classifier Information:
Classifier: class1
Operator: OR
Rule(s) : if-match ipv6 acl 3001
Total classifier number is 1
# Check the configuration of the traffic policy.
[Switch] display traffic policy user-defined
User Defined Traffic Policy Information:
Policy: policy1
Classifier: class1
Operator: OR
Behavior: behav1
Deny
Statistic: enable
Total policy number is 1
# If PC1 cannot access the network, run the display traffic policy statistics interface gigabitethernet 0/0/1 inbound command on the Switch. The command output shows that the number of matched packets is the same as the number of discarded packets. This indicates that packets matching ACL 3001 are all discarded.
Switch configuration file
# sysname Switch # ipv6 # vlan batch 10 # acl ipv6 number 3001 rule 0 deny ipv6 source FC01::/64 destination FC01::/64 # traffic classifier class1 operator or if-match ipv6 acl 3001 # traffic behavior behav1 deny statistic enable # traffic policy policy1 match-order config classifier class1 behavior behav1 # interface Vlanif10 ipv6 enable ipv6 address FC01::1/64 # interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 10 traffic-policy policy1 inbound # return