Lab 1
Mục tiêu
Cấu hình tham khảo
Bước 1: Đặt địa chỉ IP, định tuyến tĩnh
RouterA
!
!
interface FastEthernet0/0
ip address 152.1.1.1 255.255.255.0
duplex half
no keepalive
!
interface Serial1/0
ip address 195.1.1.4 255.255.255.0
no fair-queue
serial restart-delay 0
clock rate 64000
!
!
ip route 150.1.1.0 255.255.255.0 Serial1/0
!
RouterB
interface FastEthernet0/0
ip address 150.1.1.1 255.255.255.0
duplex half
!
interface Serial1/0
ip address 195.1.1.10 255.255.255.0
no fair-queue
serial restart-delay 0
clock rate 64000
!
!
ip route 152.1.1.0 255.255.255.0 Serial1/0
!
!
Bước 2: Tạo user và cho phép line vty chứng thực trên local
RouterA
!
!
username pcb password 0 pcb
username pcb autocommand access-enable timeout 5
username a privilege 15 password 0 a
!
!
line vty 0 4
login local
!
Chú ý
Trong câu lệnh username pcb autocommand access-enable timeout 5
- Từ khóa autocommand cho phép một câu lệnh được chỉ định sẵn sẽ được tạo ra sau khi người dùng login vào.
- Từ khóa access-enable : access-enable cho phép router tạo ra 1 list entry tạm thời trong dynamic acl. access-enable [host] [timeout minutes]
Bước 3: Tạo ACL
RouterA
!
!
logging alarm informational
access-list 100 dynamic tempaccess permit tcp host 150.1.1.2 host 152.1.1.1 eq telnet
access-list 100 permit tcp any host 195.1.1.4 eq telnet log
access-list 100 deny ip any any log
!
!
Chú ý
Access-Lists
- access-list 100 dynamic tempaccess permit tcp host 150.1.1.2 host 152.1.1.1 eq telnet log
-->tạo ra một dynamic acl có tên là tempaccess, chỉ cho phép traffic telnet giữa 152.1.1.1 và 150.1.1.2
- access-list 100 permit tcp any host 195.1.1.4 eq telnet log
-->cho phép telnet đến routerA để chứng thực người dùng
- access-list 100 deny ip any any log
-->thêm câu lệnh này để kiếm soát xem có bao nhiêu packets đã match với ACL.
Bước 4: Kiểm tra
RouterA
Trước khi telnet từ PCB
Ra#show ip access-lists
Extended IP access list 100
10 Dynamic tempaccess permit tcp host 150.1.1.2 host 152.1.1.1 eq telnet
20 permit tcp any host 195.1.1.4 eq telnet log
30 deny ip any any log
Từ PCB thử telnet đến 152.1.1.1
Từ PCB telnet đến 195.1.1.4
Ra#show ip access-lists
Extended IP access list 100
10 Dynamic tempaccess permit tcp host 150.1.1.2 host 152.1.1.1 eq telnet
permit tcp host 150.1.1.2 host 152.1.1.1 eq telnet
20 permit tcp any host 195.1.1.4 eq telnet log (43 matches)
30 deny ip any any log (12 matches)
Từ PCB telnet lại đến 152.1.1.1
Có thể xóa entry tạm ở ACL trên bằng lệnh như sau:
Ra#clear access-template 100 tempaccess 150.1.1.1 0.0.0.0 152.1.1.1 0.0.0
Lab 2
Mục tiêu: Cấu hình để Router xác thực người dùng login thông qua telnet trước khi cho phép họ truy xuất đến các tài nguyên bên trong.
Mô hình
Mô tả
Bước 1: Cấu hình địa chỉ IP, NAT tĩnh và định tuyến OSPF
Router 4
!
interface Loopback0
ip address 150.1.4.1 255.255.255.255
!
interface Loopback1
ip address 150.1.4.4 255.255.255.255
!
interface FastEthernet0/0
ip address 155.1.45.4 255.255.255.0
ip nat outside
ip virtual-reassembly
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 10.0.0.4 255.255.255.0
ip nat inside
ip virtual-reassembly
duplex auto
speed auto
!
router ospf 1
log-adjacency-changes
network 150.1.4.0 0.0.0.255 area 0
network 155.1.45.0 0.0.0.255 area 0
!
ip nat inside source static 10.0.0.1 150.1.4.1
!
Router1
!
interface FastEthernet0/0
ip address 10.0.0.1 255.255.255.0
duplex auto
speed auto
!
!
ip classless
ip route 0.0.0.0 0.0.0.0 10.0.0.4
!
!
line vty 0 4
no login
!
Router5
!
!
interface FastEthernet0/0
ip address 155.1.45.5 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 150.1.5.5 255.255.255.0
duplex auto
speed auto
no keepalive
!
router ospf 1
log-adjacency-changes
network 150.1.5.0 0.0.0.255 area 0
network 155.1.45.0 0.0.0.255 area 0
!
Bước 2: Tạo người dùng, và cho phép line vty chứng thực trên local
Router4
!
username DYNACL password 0 CISCO
username DYNACL autocommand access-enable host timeout 5
!
line vty 0 4
login local
!
Bước 3: Tạo ACL INBOUND, sau đó apply trên interface outside của R4
Router4
!
ip access-list extended INBOUND
permit ospf any any
permit tcp any any eq telnet
dynamic ACCESS timeout 10 permit ip any any
deny ip any any log
!
!
interface FastEthernet0/0
ip access-group INBOUND in
!
Router5
!
!
ip telnet source-interface lo0 <--cho phép telnet với địa chỉ source là lo0
!
Bước 4: Kiểm tra
Trước khi telnet đến Router4
Router5
R5#ping
Protocol [ip]:
Target IP address: 150.1.4.1
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: 150.1.5.5
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 150.1.4.1, timeout is 2 seconds:
Packet sent with a source address of 150.1.5.5
U.U.U
R5#ping
Protocol [ip]:
Target IP address: 150.1.4.4
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: 150.1.5.5
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 150.1.4.4, timeout is 2 seconds:
Packet sent with a source address of 150.1.5.5
U.U.U
Router4
R4#show ip access-lists
Extended IP access list INBOUND
10 permit ospf any any (1 match)
20 permit tcp any any eq telnet
30 Dynamic ACCESS permit ip any any
40 deny ip any any log
Sau khi telnet đến Router4
Router5
R5#telnet 155.1.45.4
Trying 155.1.45.4 ... Open
User Access Verification
Username: DYNACL
Password:
[Connection to 155.1.45.4 closed by foreign host]
R5#ping
Protocol [ip]:
Target IP address: 150.1.4.1
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: 150.1.5.5
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 150.1.4.1, timeout is 2 seconds:
Packet sent with a source address of 150.1.5.5
!!!!!
R5#ping
Protocol [ip]:
Target IP address: 150.1.4.4
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: 150.1.5.5
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 150.1.4.4, timeout is 2 seconds:
Packet sent with a source address of 150.1.5.5
!!!!!
Router4
R4#show ip access-lists
Extended IP access list INBOUND
10 permit ospf any any (43 matches)
20 permit tcp any any eq telnet (113 matches)
30 Dynamic ACCESS permit ip any any
permit ip host 150.1.5.5 any (20 matches) (time left 93)
40 deny ip any any log
------------------
Mục tiêu
Dynamic Access-List, còn được gọi là Lock & Key Security, sẽ permit hoặc deny traffic dựa trên xác thực người dùng. Để user đạt được quyền truy cập đến 1 host thông qua router, user trước tiên phải telnet đến router và cần được router chứng thực. Sau khi user được chứng thực, một entry tạm thời sẽ được tạo ra trong ACL cho phép user này đến được host.
Mô hìnhTrong cấu hình này sẽ minh họa Lock & Key Security sử dụng 1 dynamic extended ACL. Router A sẽ chứng thực các phiên telnet đến dựa trên username và password. Khi PCB telnet tới Router A (195.1.1.4), và được chứng thực, 1 entry tạm thời sẽ được tạo ra trong vòng 5 phút cho phép PCB (150.1.1.2) telnet tới Router A (152.1.1.1). Inbound ACL được apply trên cổng serial của RouterA.
Cấu hình tham khảo
Bước 1: Đặt địa chỉ IP, định tuyến tĩnh
RouterA
!
!
interface FastEthernet0/0
ip address 152.1.1.1 255.255.255.0
duplex half
no keepalive
!
interface Serial1/0
ip address 195.1.1.4 255.255.255.0
no fair-queue
serial restart-delay 0
clock rate 64000
!
!
ip route 150.1.1.0 255.255.255.0 Serial1/0
!
RouterB
interface FastEthernet0/0
ip address 150.1.1.1 255.255.255.0
duplex half
!
interface Serial1/0
ip address 195.1.1.10 255.255.255.0
no fair-queue
serial restart-delay 0
clock rate 64000
!
!
ip route 152.1.1.0 255.255.255.0 Serial1/0
!
!
Bước 2: Tạo user và cho phép line vty chứng thực trên local
RouterA
!
!
username pcb password 0 pcb
username pcb autocommand access-enable timeout 5
username a privilege 15 password 0 a
!
!
line vty 0 4
login local
!
Chú ý
Trong câu lệnh username pcb autocommand access-enable timeout 5
- Từ khóa autocommand cho phép một câu lệnh được chỉ định sẵn sẽ được tạo ra sau khi người dùng login vào.
- Từ khóa access-enable : access-enable cho phép router tạo ra 1 list entry tạm thời trong dynamic acl. access-enable [host] [timeout minutes]
[host] (Optional) Với tùy chọn này chỉ cho phép host nào đã telnet đến router thì có thể thực hiện các rules đã đưa ra trong dynamic acl. Nếu không chỉ định tuỳ chọn này thì router sẽ cho phép tất cả các host nằm trong cùng subnet với host đã telnet thực hiện các rules.
[timeout minutes] (Optional) Chỉ ra thời gian idle cho 1 acl entry tạm thời. Nếu acl entry này không được truy xuất đến trong khoảng thời gian timeout thì nó sẽ tự động bị xoá và người dùng phải chứng thực lại. Nếu để mặc định không thiết lập thời gian timeout thì các entry này sẽ được lưu mãi. Theo khuyến cáo nên để khoảng thời gian này bằng với khoảng thời gian idle timeout đã set cho kết nối WAN.
- username a priviledge 15 password 0 a <-- tạo ra thêm 1 user nữa để dễ kiểm traBước 3: Tạo ACL
RouterA
!
!
logging alarm informational
access-list 100 dynamic tempaccess permit tcp host 150.1.1.2 host 152.1.1.1 eq telnet
access-list 100 permit tcp any host 195.1.1.4 eq telnet log
access-list 100 deny ip any any log
!
!
Chú ý
Access-Lists
- access-list 100 dynamic tempaccess permit tcp host 150.1.1.2 host 152.1.1.1 eq telnet log
-->tạo ra một dynamic acl có tên là tempaccess, chỉ cho phép traffic telnet giữa 152.1.1.1 và 150.1.1.2
- access-list 100 permit tcp any host 195.1.1.4 eq telnet log
-->cho phép telnet đến routerA để chứng thực người dùng
- access-list 100 deny ip any any log
-->thêm câu lệnh này để kiếm soát xem có bao nhiêu packets đã match với ACL.
Bước 4: Kiểm tra
RouterA
Trước khi telnet từ PCB
Ra#show ip access-lists
Extended IP access list 100
10 Dynamic tempaccess permit tcp host 150.1.1.2 host 152.1.1.1 eq telnet
20 permit tcp any host 195.1.1.4 eq telnet log
30 deny ip any any log
Từ PCB thử telnet đến 152.1.1.1
Từ PCB telnet đến 195.1.1.4
Ra#show ip access-lists
Extended IP access list 100
10 Dynamic tempaccess permit tcp host 150.1.1.2 host 152.1.1.1 eq telnet
permit tcp host 150.1.1.2 host 152.1.1.1 eq telnet
20 permit tcp any host 195.1.1.4 eq telnet log (43 matches)
30 deny ip any any log (12 matches)
Từ PCB telnet lại đến 152.1.1.1
Có thể xóa entry tạm ở ACL trên bằng lệnh như sau:
Ra#clear access-template 100 tempaccess 150.1.1.1 0.0.0.0 152.1.1.1 0.0.0
Lab 2
Mục tiêu: Cấu hình để Router xác thực người dùng login thông qua telnet trước khi cho phép họ truy xuất đến các tài nguyên bên trong.
Mô hình
Mô tả
Cấu hình NAT tĩnh
Cho phép các kết nối từ xa truy cập vào mạng bên trong, thiết lập thời gian tuyệt đối (absolute timeout) và thời gian ngưng hoạt động (inactivity timeout)
Cấu hình line VTY để chứng thực các phiên telnet đến
Khi sử cấu hình người dùng sử dụng câu lệnh autocommand với “access-enable host timeout 5”, để thiết lập inactivity timeout là 5 phút
Tạo extended ACL INBOUND cho phép các traffic telnet và OSPF
Tạo dynamic list entry có tên là ACCESS với absolute timeout là 10, trong câu lệnh này cấu hình “permit ip any any”
Deny và log lại tất cả traffic khác với ACL INBOUND.
Cấu hình tham khảoCho phép các kết nối từ xa truy cập vào mạng bên trong, thiết lập thời gian tuyệt đối (absolute timeout) và thời gian ngưng hoạt động (inactivity timeout)
Cấu hình line VTY để chứng thực các phiên telnet đến
Khi sử cấu hình người dùng sử dụng câu lệnh autocommand với “access-enable host timeout 5”, để thiết lập inactivity timeout là 5 phút
Tạo extended ACL INBOUND cho phép các traffic telnet và OSPF
Tạo dynamic list entry có tên là ACCESS với absolute timeout là 10, trong câu lệnh này cấu hình “permit ip any any”
Deny và log lại tất cả traffic khác với ACL INBOUND.
Bước 1: Cấu hình địa chỉ IP, NAT tĩnh và định tuyến OSPF
Router 4
!
interface Loopback0
ip address 150.1.4.1 255.255.255.255
!
interface Loopback1
ip address 150.1.4.4 255.255.255.255
!
interface FastEthernet0/0
ip address 155.1.45.4 255.255.255.0
ip nat outside
ip virtual-reassembly
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 10.0.0.4 255.255.255.0
ip nat inside
ip virtual-reassembly
duplex auto
speed auto
!
router ospf 1
log-adjacency-changes
network 150.1.4.0 0.0.0.255 area 0
network 155.1.45.0 0.0.0.255 area 0
!
ip nat inside source static 10.0.0.1 150.1.4.1
!
Router1
!
interface FastEthernet0/0
ip address 10.0.0.1 255.255.255.0
duplex auto
speed auto
!
!
ip classless
ip route 0.0.0.0 0.0.0.0 10.0.0.4
!
!
line vty 0 4
no login
!
Router5
!
!
interface FastEthernet0/0
ip address 155.1.45.5 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 150.1.5.5 255.255.255.0
duplex auto
speed auto
no keepalive
!
router ospf 1
log-adjacency-changes
network 150.1.5.0 0.0.0.255 area 0
network 155.1.45.0 0.0.0.255 area 0
!
Bước 2: Tạo người dùng, và cho phép line vty chứng thực trên local
Router4
!
username DYNACL password 0 CISCO
username DYNACL autocommand access-enable host timeout 5
!
line vty 0 4
login local
!
Bước 3: Tạo ACL INBOUND, sau đó apply trên interface outside của R4
Router4
!
ip access-list extended INBOUND
permit ospf any any
permit tcp any any eq telnet
dynamic ACCESS timeout 10 permit ip any any
deny ip any any log
!
!
interface FastEthernet0/0
ip access-group INBOUND in
!
Router5
!
!
ip telnet source-interface lo0 <--cho phép telnet với địa chỉ source là lo0
!
Bước 4: Kiểm tra
Trước khi telnet đến Router4
Router5
R5#ping
Protocol [ip]:
Target IP address: 150.1.4.1
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: 150.1.5.5
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 150.1.4.1, timeout is 2 seconds:
Packet sent with a source address of 150.1.5.5
U.U.U
R5#ping
Protocol [ip]:
Target IP address: 150.1.4.4
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: 150.1.5.5
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 150.1.4.4, timeout is 2 seconds:
Packet sent with a source address of 150.1.5.5
U.U.U
Router4
R4#show ip access-lists
Extended IP access list INBOUND
10 permit ospf any any (1 match)
20 permit tcp any any eq telnet
30 Dynamic ACCESS permit ip any any
40 deny ip any any log
Sau khi telnet đến Router4
Router5
R5#telnet 155.1.45.4
Trying 155.1.45.4 ... Open
User Access Verification
Username: DYNACL
Password:
[Connection to 155.1.45.4 closed by foreign host]
R5#ping
Protocol [ip]:
Target IP address: 150.1.4.1
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: 150.1.5.5
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 150.1.4.1, timeout is 2 seconds:
Packet sent with a source address of 150.1.5.5
!!!!!
R5#ping
Protocol [ip]:
Target IP address: 150.1.4.4
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: 150.1.5.5
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 150.1.4.4, timeout is 2 seconds:
Packet sent with a source address of 150.1.5.5
!!!!!
Router4
R4#show ip access-lists
Extended IP access list INBOUND
10 permit ospf any any (43 matches)
20 permit tcp any any eq telnet (113 matches)
30 Dynamic ACCESS permit ip any any
permit ip host 150.1.5.5 any (20 matches) (time left 93)
40 deny ip any any log
------------------