traffic-filter (Interface view)
Function
The traffic-filter command applies an ACL to an interface to filter packets on the interface.
The undo traffic-filter command cancels the configuration.
By default, no ACL is applied to an interface to filter packets on the interface.
Format
traffic-filter { inbound | outbound } [ ipv6 ] acl { acl-number | name acl-name }
undo traffic-filter { inbound | outbound } [ ipv6 acl ]
Parameters
Parameter |
Description |
Value |
---|---|---|
inbound |
Configures ACL-based packet filtering in the inbound direction on an interface. |
- |
outbound |
Configures ACL-based packet filtering in the outbound direction on an interface. |
- |
acl |
Filters packets based on the IPv4 ACL. |
- |
ipv6 |
Configures IPv6 ACL-based packet filtering. |
- |
acl-number |
Specifies the number of an ACL. |
The IPv4 ACL number ranges from 2000 to 4999 or 6000 to 6999, and the IPv6 ACL number ranges from 2000 to 3999.
|
name acl-name |
Filters packets based on a specified named ACL. acl-name specifies the name of the ACL. |
The ACL name must exist. The value range is the same as that of the acl-number parameter. |
Usage Guidelines
Usage Scenario
After the traffic-filter command is executed on an interface, the device filters packets matching ACL rules:
- If the action in an ACL rule is deny, the device discards packets matching the rule.
- If the action in an ACL rule is permit, the device forwards packets matching the rule.
- If no rule is matched, packets are allowed to pass through.
Prerequisites
A named ACL has been created using the acl name command.
Precautions
If packets match an ACL rule with the deny action and a traffic policy (configured using the traffic-policy (interface view) command) simultaneously on an interface, the traffic policy does not take effect for the packets.
The traffic-filter command can reference an ACL with no rule configured. You can configure a rule for the ACL after running this command.
You can apply only one ACL in one direction on an interface to filter packets. Before modifying the ACL referenced by the traffic-filter command, run the undo traffic-filter command to cancel packet filtering based on this ACL.
Example
<AC6605> system-view [AC6605] acl 3000 [AC6605-acl-adv-3000] rule 5 permit ip source 192.168.0.2 0 [AC6605-acl-adv-3000] quit [AC6605] interface vlanif 100 [AC6605-Vlanif100] traffic-filter inbound acl 3000