利用IP標準訪問列表進行網絡流量的控制

【實驗名稱】編號的標準IP訪問列表。
【實驗目的】掌握路由上編號的標準IP訪問列表規則及配置
【背景描述】
你是一個公司的網絡管理員,公司的經理部、財務部門和銷售部門分屬不同的3個網段,三部門之間用路由器進行信息傳遞,爲了安全起見,公司領導要求銷售部門不能對財務部門進行訪問,但經理部可以對財務部門進行訪問。
PC1代表經理部的主機,PC2代表銷售部門的主機、PC3代表財務部門的主機。
【技術原理】
IP ACL(IP訪問控制列表或IP訪問列表)是實現對流經路由器或交換的數據包根據一定的規則進行過濾,從而提高網絡可管理性和安全性。
IP ACL分爲兩種:標準IP訪問列表和擴展IP訪問列表。
標準IP訪問列表可以根據數據包的源IP地址定義規則,進行數據包的過濾。
擴展IP訪問列表可以根據數據包的源IP、目的IP、源端口、目的端口、協議來定義規則,進行數據包的過濾。
IP ACL基於接口進行規則的應用,分爲:入棧應用和出棧應用。
入棧應用是指由外部經該接口進行路由器的數據包進行過濾。
出棧應用是指路由器從該接口向外轉發數據時進行數據包的過濾。
IP ACL的配置有兩種方式:按照編號的訪問列表,按照命名的訪問列表。
標準IP訪問列表編號範圍是1~99、1300~1999,擴展IP訪問列表編號範圍是100~199、2000~2699。
【實現功能】
實現網段間互相訪問的安全控制。
【實驗設備】
R1762路由器(兩臺)、V.35線纜(1條)、直連線或交叉線(3條)
【實驗拓撲】

【實驗步驟】
步驟31.        基本配置。
Router1基本配置
Red-Giant>enable
Red-Giant#configure terminal
Red-Giant(config)#hostname Router1
Router1(config)# interface fastEthernet 1/0
Router1(config-if)#ip add 172.16.1.1 255.255.255.0
Router1(config-if)#no shutdown
Router1(config-if)# interface fastEthernet 1/1
Router1(config-if)#ip add 172.16.2.1 255.255.255.0
Router1(config-if)#no shutdown
Router1(config-if)#interface serial 1/2
Router1(config-if)#ip add 172.16.3.1 255.255.255.0
Router1(config-if)#clock rate 64000
Router1(config-if)#no shutdown
Router1(config-if)#end
測試命令:show ip interface brief。
Router1#show ip int brief                             !觀察接口狀態
Interface                        IP-Address(Pri)      OK?       Status
serial 1/2                       172.16.3.1/24        YES       UP
serial 1/3                        no address           YES       DOWN
FastEthernet 1/0                172.16.1.1/24        YES       UP
FastEthernet 1/1                172.16.2.1/24        YES       UP
Null 0                             no address           YES       UP
Router2基本配置
Red-Giant>enable
Red-Giant#configure terminal
Red-Giant(config)#hostname Router2
Router2(config)# interface fastEthernet 1/0
Router2(config-if)#ip add 172.16.4.1 255.255.255.0
Router2(config-if)#no shutdown
Router2(config-if)#exit
Router2(config-if)#interface serial 1/2
Router2(config-if)#ip add 172.16.3.1 255.255.255.0
Router2(config-if)#no shutdown
Router2(config-if)#end
測試命令:show ip interface brief。
Router2#show ip int brief                                   !觀察接口狀態
Interface                        IP-Address(Pri)      OK?       Status
serial 1/2                       172.16.3.2/24        YES       UP
serial 1/3                        no address           YES       DOWN
FastEthernet 1/0                172.16.4.1/24        YES       UP
FastEthernet 1/1                 no address           YES       DOWN
Null 0                             no address           YES       UP
配置靜態路由
Router1(config)#ip route 172.16.4.0 255.255.255.0 serial 1/2
Router2(config)#ip route 172.16.1.0 255.255.255.0 serial 1/2
Router2(config)#ip route 172.16.2.0 255.255.255.0 serial 1/2
測試命令:show ip route。
Router1#show ip route                                      !查看路由表信息
Codes:  C - connected, S - static,  R - RIP
        O - OSPF, IA - OSPF inter area
        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
        E1 - OSPF external type 1, E2 - OSPF external type 2
        * - candidate default
Gateway of last resort is no set
C    172.16.1.0/24 is directly connected, FastEthernet 1/0
C    172.16.1.1/32 is local host.
C    172.16.2.0/24 is directly connected, FastEthernet 1/1
C    172.16.2.1/32 is local host.
C    172.16.3.0/24 is directly connected, serial 1/2
C    172.16.3.1/32 is local host.
S    172.16.4.0/24 is directly connected, serial 1/2
Router2#show ip route
Codes:  C - connected, S - static,  R - RIP
        O - OSPF, IA - OSPF inter area
        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
        E1 - OSPF external type 1, E2 - OSPF external type 2
        * - candidate default
Gateway of last resort is no set
S    172.16.1.0/24 is directly connected, serial 1/2
S    172.16.2.0/24 is directly connected, serial 1/2
C    172.16.3.0/24 is directly connected, serial 1/2
C    172.16.3.2/32 is local host.
C    172.16.4.0/24 is directly connected, FastEthernet 1/0
C    172.16.4.1/32 is local host.
步驟32.        配置標準IP訪問控制列表。
Router2(config)#access-list 1 deny 172.16.2.0 0.0.0.255
   ! 拒絕來自172.16.2.0網段的流量通過
Router2(config)#access-list 1 permit 172.16.1.0 0.0.0.255
   ! 允許來自172.16.1.0網段的流量通過
驗證測試:
Router2#show access-lists 1
Standard IP access list 1 includes 2 items:
    deny   172.16.2.0, wildcard bits 0.0.0.255
    permit 172.16.1.0, wildcard bits 0.0.0.255
步驟33.        把訪問控制列表在接口下應用。
Router2(config)# interface fastEthernet 1/0
Router2(config-if)#ip access-group 1 out   ! 在接口下訪問控制列表出棧流量調用
驗證測試:
Router2#show ip interface fastEthernet 1/0
FastEthernet 1/0
  IP interface state is: UP
  IP interface type is: BROADCAST
  IP interface MTU is: 1500
  IP address is:
    172.16.4.1/24 (primary)
  IP address negotiate is: OFF
  Forward direct-boardcast is: ON
  ICMP mask reply is: ON
  Send ICMP redirect is: ON
  Send ICMP unreachabled is: ON
  DHCP relay is: OFF
  Fast switch is: ON
  Route horizontal-split is: ON
  Help address is: 0.0.0.0
  Proxy ARP is: ON
  Outgoing access list is 1.                          !查看訪問列表在接口上的應用
  Inbound access list is not set.
步驟34.        驗證測試。
ping(172.16.2.0網段的主機不能ping通172.16.4.0網段的主機;172.16.1.0網段的主機能ping通172.16.4.0網段的主機)。
【注意事項】
*        1、注意在訪問控制列表的網絡掩碼是反掩碼。
*        2、標準控制列表要應用在儘量靠近目的地址的接口。
【參考配置】
Router1#show running-config                         !查看路由器1的全部配置
Building configuration...
Current configuration : 544 bytes
!
version 8.32(building 53)
hostname Router1
!
!
interface serial 1/2
ip address 172.16.3.1 255.255.255.0
clock rate 64000
!
interface serial 1/3
clock rate 64000
!
interface FastEthernet 1/0
ip address 172.16.1.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet 1/1
ip address 172.16.2.1 255.255.255.0
duplex auto
speed auto
!
interface Null 0
!
ip route 172.16.4.0 255.255.255.0 serial 1/2
!
line con 0
line aux 0
line vty 0 4
login
!
end
Router2#show running-config                          !查看路由器2的全部配置
Building configuration...
Current configuration : 641 bytes
!
version 8.32(building 53)
hostname Router2
!
access-list 1 deny 172.16.2.0 0.0.0.255
access-list 1 permit 172.16.1.0 0.0.0.255
!
interface serial 1/2
ip address 172.16.3.2 255.255.255.0
!
interface serial 1/3
clock rate 64000
!
interface FastEthernet 1/0
ip access-group 1 out
ip address 172.16.4.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet 1/1
duplex auto
speed auto
!
interface Null 0
!
ip route 172.16.1.0 255.255.255.0 serial 1/2
ip route 172.16.2.0 255.255.255.0 serial 1/2
!
line con 0
line aux 0
line vty 0 4
login
!
end
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章