防火牆基礎小實驗(1)安全
實
驗
任
務 實驗需求:
配置路由器和ASA的接口,實現網絡互通
配置路由
驗證R1能夠 Telnet到R2和R3,R3能夠Telnet到R2可是不能Telnet R1,R2不能Telnet到R1和R3
使用命令show conn detail 查看Conn表
分別查看ASA和RR的路由表
配置ACL禁止在R3上Telnet 到R2
實驗拓撲:
網絡
思
路
及
實
驗
步
驟 第一步:配置ASA防火牆對應端口的IP並設置端口名與優先級
enable
tedu.cn
configuration terminal
hostname ASA
enable password 123
passwd 123 (遠程密碼)
clear configure all
interface gigabitEthernet 0
nameif inside (端口名內部)
security-level 100 (優先級最高)
no shutdown
ip address 10.1.1.254 255.255.255.0
exit
interface gigabitEthernet 1
nameif outside(端口名外部)
security-level 0(優先級最低)
no shutdown
ip address 172.16.1.254 255.255.255.0
exit
interface gigabitEthernet 2
nameif dmz(端口名隔離區)
security-level 50(優先級比outside要高比inside的要低)
no shutdown
ip address 192.168.1.254 255.255.255.0
exittcp
第二步:配置R1 R3 R2 各對應端口的IP地址關閉路由關閉 RR配置
對應端口的IP地址開啓路由功能,並驗證網絡是否互通
R1:
enable
configuration terminal
hostname R1
interface fastEthernet 0/0
no shutdown
ip address 10.1.1.1 255.255.255.0
exit
no ip routing (關閉路由功能)
ip default-gateway 10.1.1.254(設置網關)
end
ping 10.1.1.254 (驗證到網關是否互通)ide
R3:
enable
configuration terminal
hostname R3
interface fastEthernet 0/0
no shutdown
ip address 192.168.1.1 255.255.255.0
exit
no ip routing (關閉路由功能)
ip default-gateway 192.168.1.254(設置網關)
end
ping 192.168.1.254 (驗證到網關是否互通)測試
RR:
enable
configuration terminal
hostname RR
ip routing (開啓路由功能)
interface fastEthernet 0/0
no shutdown
ip address 4.4.4.254 255.255.255.0
exit
interface fastEthernet 1/0
no shutdown
ip address 172.16.1.1 255.255.255.0
end
ping 172.16.1.254 (驗證到網關是否互通)code
R2:
enable
configuration terminal
hostname R2
interface fastEthernet 0/0
no shutdown
ip address 4.4.4.1 255.255.255.0
exit
no ip routing (關閉路由功能)
ip default-gateway 4.4.4.254(設置網關)
end
ping 4.4.4.254 (驗證到網關是否互通)接口
第三步:
(1)由於ASA上沒有4.4.4.0 的路由,所以要添加一個默認路由
route outside 0.0.0.0 0.0.0.0 172.16.1.1 (按流量走向配置
指定端口爲outside)
(2)由於RR上沒有R1的路由,所以要添加一個more路由
ip route 0.0.0.0 0.0.0.0 172.16.1.254 ip
第四步:在R1 R2 R3 配置遠程功能及密碼路由
R1:
enable
configuration terminal
enable password 123
line vty 0
password 123
endrem
R2:
enable
configuration terminal
enable password 123
line vty 0
password 123
end
R3:
enable
configuration terminal
enable password 123
line vty 0
password 123
end
第五步:驗證在R1上遠程R2 R3 ,R3遠程R1 R2 ,R2遠程R1 R3
R1:
telnet 4.4.4.1
Trying 4.4.4.1 ... Open
User Access Verification
Password:
R2>
exit
telnet 192.168.1.1
Trying 192.168.1.1 ... Open
User Access Verification
Password:
R3>
exit
R2:
telnet 10.1.1.1
Connection timed out; remote host not responding(鏈接
超時;遠程主機沒有響應)【由於接口的安全級別高的能夠訪問低的
而低級別的不能夠訪問高級別的】
telnet 192.168.1.1
Connection timed out; remote host not responding(鏈接
超時;遠程主機沒有響應)
R3:
telnet 4.4.4.1
Trying 4.4.4.1 ... Open
User Access Verification
Password:
R2>
exit
telnet 10.1.1.1
Connection timed out; remote host not responding(鏈接
超時;遠程主機沒有響應)
第五步:由於ASA防火牆在流量訪問時先看conn表而後再看acl表然
後再看優先級
因此須要配置ACL禁止R3遠程訪問R2
在ASA上配置
enable
configuration terminal
access-list 333 deny tcp host 192.168.1.1 host 4.4.4.1
eq telnet (拒絕192.168.1.1遠程訪問4.4.4.1)
access-group 333 in interface dmz(配置在對應的接口)
結
果
驗
證 驗證與測試
第一步:
在R3遠程R2
R3:
telnet 4.4.4.1
Connection refused by remote host(拒絕由遠程主機鏈接)
第二步在R1遠程R2時,在ASA查看conn表
show conn detail
1 in use, 1 most used
Flags: A - awaiting inside ACK to SYN, a - awaiting
outside ACK to SYN,
B - initial SYN from outside, b - TCP state-
bypass or nailed, C - CTIQBE media,
D - DNS, d - dump, E - outside back connection, F
第三步在ASA與RR上查看路由表
ASA路由表:
show route
Codes: C - connected, S - static, I - IGRP, R - RIP, M -
mobile, B - BGP
D - EIGRP, EX - EIGRP external, 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, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-
2, ia - IS-IS inter area
Gateway of last resort is 172.16.1.1 to network 0.0.0.0
C 172.16.1.0 255.255.255.0 is directly connected,
outside
C 10.1.1.0 255.255.255.0 is directly connected,
inside
C 192.168.1.0 255.255.255.0 is directly connected,
dmz
S* 0.0.0.0 0.0.0.0 [1/0] via 172.16.1.1, outside
在RR上查看路由表
show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B
Gateway of last resort is 172.16.1.254 to network
0.0.0.0
4.0.0.0/24 is subnetted, 1 subnets
C 4.4.4.0 is directly connected, FastEthernet0/0
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.1.0 is directly connected,
FastEthernet1/0
S* 0.0.0.0/0 [1/0] via 172.16.1.254
問題及分析 ICMP在默認狀況下是不能容許經過的優先級小的不能直接訪問優先級大的ASA先檢查conn表再檢查acl表再檢查優先級