華為S5700系列交換機使用高級ACL限制不同網段的用戶互訪


組網圖形

使用高級ACL限制不同網段的用戶互訪示例 

組網需求

如圖一所示,某公司通過Switch實現各部門之間的互連。為方便管理網絡,管理員為公司的研發部和市場部規划了兩個網段的IP地址。同時為了隔離廣播域,又將兩個部門划分在不同VLAN之中。現要求Switch能夠限制兩個網段之間互訪,防止公司機密泄露。

配置思路

采用如下的思路在Switch上進行配置:

1.   配置高級ACL和基於ACL的流分類,使設備可以對研發部與市場部互訪的報文進行過濾。

2.   配置流行為,拒絕匹配上ACL的報文通過。

3.   配置並應用流策略,使ACL和流行為生效。

操作步驟

1.   配置接口所屬的VLAN以及接口的IP地址

# 創建VLAN10和VLAN20。

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

# 配置Switch的接口GE1/0/1和GE1/0/2為trunk類型接口,並分別加入VLAN10和VLAN20。

[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

# 創建VLANIF10和VLANIF20,並配置各VLANIF接口的IP地址。

[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.   配置ACL

# 創建高級ACL 3001並配置ACL規則,拒絕研發部訪問市場部的報文通過。

[Switch] acl 3001
[Switch-acl-adv-3001] rule deny ip source 10.1.1.0 0.0.0.255 destination 10.1.2.0 0.0.0.255
[Switch-acl-adv-3001] quit

# 創建高級ACL 3002並配置ACL規則,拒絕市場部訪問研發部的報文通過。

[Switch] acl 3002
[Switch-acl-adv-3002] rule deny ip source 10.1.2.0 0.0.0.255 destination 10.1.1.0 0.0.0.255
[Switch-acl-adv-3002] quit

3.   配置基於高級ACL的流分類

# 配置流分類tc1,對匹配ACL 3001和ACL 3002的報文進行分類。

[Switch] traffic classifier tc1
[Switch-classifier-tc1] if-match acl 3001
[Switch-classifier-tc1] if-match acl 3002
[Switch-classifier-tc1] quit

4.   配置流行為

# 配置流行為tb1,動作為拒絕報文通過。

[Switch] traffic behavior tb1
[Switch-behavior-tb1] deny
[Switch-behavior-tb1] quit

5.   配置流策略

# 定義流策略,將流分類與流行為關聯。

[Switch] traffic policy tp1
[Switch-trafficpolicy-tp1] classifier tc1 behavior tb1
[Switch-trafficpolicy-tp1] quit

6.   在接口下應用流策略

# 由於研發部和市場部互訪的流量分別從接口GE1/0/1和GE1/0/2進入Switch,所以在接口GE1/0/1和GE1/0/2的入方向應用流策略。

[Switch] interface gigabitethernet 1/0/1
[Switch-GigabitEthernet1/0/1] traffic-policy tp1 inbound
[Switch-GigabitEthernet1/0/1] quit
[Switch] interface gigabitethernet 1/0/2
[Switch-GigabitEthernet1/0/2] traffic-policy tp1 inbound
[Switch-GigabitEthernet1/0/2] quit

7.   驗證配置結果

# 查看ACL規則的配置信息。

[Switch] display acl 3001
Advanced ACL 3001, 1 rule                                                      
Acl's step is 5                                                               
 rule 5 deny ip source 10.1.1.0 0.0.0.255 destination 10.1.2.0 0.0.0.255
[Switch] display acl 3002
Advanced ACL 3002, 1 rule                                                      
Acl's step is 5                                                               
 rule 5 deny ip source 10.1.2.0 0.0.0.255 destination 10.1.1.0 0.0.0.255

# 查看流分類的配置信息。

[Switch] display traffic classifier user-defined
  User Defined Classifier Information:
   Classifier: tc1
    Precedence: 5
    Operator: OR
    Rule(s) : if-match acl 3001                                               
              if-match acl 3002
 

Total classifier number is 1 

# 查看流策略的配置信息。

[Switch] display traffic policy user-defined tp1
  User Defined Traffic Policy Information:                                    
  Policy: tp1                                                                 
   Classifier: tc1                                                             
    Operator: OR                                                              
     Behavior: tb1                                                            
      Deny

# 研發部和市場部所在的兩個網段之間不能互訪。

配置文件

Switch的配置文件

#
sysname Switch
#
vlan batch 10 20
#
acl number 3001                                                               
 rule 5 deny ip source 10.1.1.0 0.0.0.255 destination 10.1.2.0 0.0.0.255      
acl number 3002                                                                
 rule 5 deny ip source 10.1.2.0 0.0.0.255 destination 10.1.1.0 0.0.0.255
#
traffic classifier tc1 operator or precedence 5
if-match acl 3001                                                            
 if-match acl 3002 
#
traffic behavior tb1
deny
#
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
 traffic-policy tp1 inbound
#
interface GigabitEthernet1/0/2
port link-type trunk                                                         
 port trunk allow-pass vlan 20
 traffic-policy tp1 inbound
#
return


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM