Thông tin tài liệu
LAB 1 : NBAR – Khám phá những lưu lượng chạy qua router
Sơ đồ:
Hình 1
Tóm tắt
Cơ chế nhận dạng lưu lượng ứng dụng NBAR phục vụ mục đích thống kê các loại ứng
dụng chạy qua thiết bị theo cả 2 chiều. Để chạy được tính năng này, cơ chế chuyển mạch
CEF phải được bật lên trước.
Yêu cầu
Xây dựng hệ thống như hình 75, bảo đảm các máy trạm có thể ra được internet và cuộc
thoại có thể thực hiện thành công giữa 2 máy điện thoại 1111 và 2222
Cổng Fa0/1 trên thiết bị R2 được lấy địa chỉ tự động bằng DHCP ( dùng câu lệnh ip
address dhcp)
Thực hiện:
A.Cấu hình ban đầu:
Cấu hình R1:
R1#sh run
Building configuration...
Current configuration : 1149 bytes
!
version 12.4
!
hostname R1
!
!
ip cef
!
ip dhcp pool 10
network 10.10.20.0 255.255.255.0
default-router 10.10.20.1
dns-server 203.162.4.1 203.162.4.190 203.162.4.191
!
!
interface FastEthernet0/0
ip address 10.10.10.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 10.10.20.1 255.255.255.0
duplex auto
speed auto
!
interface Serial0/1/0
ip address 192.1.1.1 255.255.255.0
clock rate 2000000
!
ip forward-protocol nd
ip route 0.0.0.0 0.0.0.0 192.1.1.2
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
privilege level 15
no login
!
end
Cấu hình R2
R2#sh run
Building configuration...
Current configuration : 1178 bytes
!
version 12.4
!
hostname R2
!
ip cef
!
interface FastEthernet0/0
ip address 20.20.20.1 255.255.255.0
ip nat inside
ip virtual-reassembly
duplex auto
speed auto
!
interface FastEthernet0/1
ip address dhcp
ip nat outside
ip virtual-reassembly
duplex auto
speed auto
!
interface Serial0/1/0
ip address 192.1.1.2 255.255.255.0
ip nat inside
ip virtual-reassembly
!
ip route 10.10.0.0 255.255.0.0 192.1.1.1
!
ip http server
no ip http secure-server
ip nat inside source list 1 interface FastEthernet0/1 overload
!
access-list 1 permit 10.10.0.0 0.0.255.255
!
line con 0
exec-timeout 0 0
privilege level 15
logging synchronous
line aux 0
line vty 0 4
privilege level 15
logging synchronous
no login
!
scheduler allocate 20000 1000
!
end
Cấu hình trên thiết bị C2600-1:
c2600_1#sh run
Building configuration...
Current configuration : 832 bytes
!
version 12.3
!
hostname c2600_1
!
ip subnet-zero
ip cef
!
interface Ethernet0/0
ip address 10.10.10.2 255.255.255.0
half-duplex
!
ip classless
ip route 0.0.0.0 0.0.0.0 10.10.10.1
!
voice-port 1/0/0
!
voice-port 1/0/1
!
dial-peer voice 1 pots
destination-pattern 1111
port 1/0/0
!
dial-peer voice 2 voip
destination-pattern 2222
session target ipv4:20.20.20.2
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
privilege level 15
no login
!
!
end
Cấu hình trên thiết bị C2600_2:
c2600_2#sh run
Building configuration...
Current configuration : 854 bytes
!
version 12.3
!
hostname c2600_2
!
ip subnet-zero
ip cef
!
interface Ethernet0/0
ip address 20.20.20.2 255.255.255.0
half-duplex
!
ip classless
ip route 0.0.0.0 0.0.0.0 20.20.20.1
!
voice-port 1/0/0
!
voice-port 1/0/1
!
dial-peer voice 1 pots
destination-pattern 2222
port 1/0/0
!
dial-peer voice 2 voip
destination-pattern 1111
session target ipv4:10.10.10.2
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
privilege level 15
logging synchronous
no login
!
!
end
Bước 1:
Xem trước thông tin những giao thức được xây dựng sẵn trong hệ điều hành sẽ được sử
dụng bởi NBAR
R1#sh ip
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
nbar port-map
bgp
udp
179
bgp
tcp
179
bittorrent
tcp 6881 6882 6883 6884 6885 6886 6887 6888 6889
citrix
udp 1604
citrix
tcp 1494
cuseeme udp 7648 7649 24032
cuseeme tcp 7648 7649
dhcp
udp 67 68
directconnect tcp 411 412 413
dns
udp 53
dns
tcp 53
edonkey tcp 4662
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
exchange
fasttrack
finger
tcp
ftp
tcp
gnutella
gnutella
gopher
udp
gopher
tcp
h323
udp
h323
tcp
http
tcp
imap
udp
imap
tcp
irc
udp
irc
tcp
kerberos
kerberos
l2tp
udp
ldap
udp
ldap
tcp
mgcp
udp
mgcp
tcp
netbios udp
netbios tcp
netshow tcp
nfs
udp
nfs
tcp
nntp
udp
nntp
tcp
notes
udp
notes
tcp
novadigm
novadigm
ntp
udp
ntp
tcp
pcanywhere
pcanywhere
pop3
udp
pop3
tcp
pptp
tcp
printer udp
printer tcp
rcmd
tcp
rip
udp
rsvp
udp
rtsp
tcp
secure-ftp
secure-http
secure-imap
secure-imap
secure-irc
secure-irc
tcp 135
tcp 1214
79
21
udp 6346 6347 6348
tcp 6346 6347 6348 6349 6355 5634
70
70
1300 1718 1719 1720 11720
1300 1718 1719 1720 11000 - 11999
80
143 220
143 220
194
194
udp 88 749
tcp 88 749
1701
389
389
2427 2727
2427 2428 2727
137 138
137 139
1755
2049
2049
119
119
1352
1352
udp 3460 3461 3462 3463 3464 3465
tcp 3460 3461 3462 3463 3464 3465
123
123
udp 22 5632
tcp 65301 5631
110
110
1723
515
515
512 513 514
520
1698 1699
554
tcp 990
tcp 443
udp 585 993
tcp 585 993
udp 994
tcp 994
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
port-map
secure-ldap
udp 636
secure-ldap
tcp 636
secure-nntp
udp 563
secure-nntp
tcp 563
secure-pop3
udp 995
secure-pop3
tcp 995
secure-telnet tcp 992
sip
udp 5060
sip
tcp 5060
skinny
tcp 2000 2001 2002
smtp
tcp 25
snmp
udp 161 162
snmp
tcp 161 162
socks
tcp 1080
sqlnet
tcp 1521
sqlserver
tcp 1433
ssh
tcp 22
streamwork
udp 1558
sunrpc
udp 111
sunrpc
tcp 111
syslog
udp 514
telnet
tcp 23
tftp
udp 69
vdolive tcp 7000
winmx
tcp 6699
xwindows
tcp 6000 6001 6002 6003
Người dùng có thể chỉnh sửa thông tin cho các ứng dụng đã xây dựng sẵn trong IOS
Ví dụ nếu muốn chỉnh telnet thêm port 1123
Xem thông tin nhận dạng lưu lượng telnet:
R1#sh ip nbar port-map | include telnet
port-map secure-telnettcp 992
port-map telnet
tcp 23
R1#
Dùng câu lệnh sau để chỉnh:
R1(config)#ip nbar port-map telnet tcp 23 1123
Kiểm tra:
R1(config)#do sh ip nbar port-map | include telnet
port-map secure-telnettcp 992
port-map telnet
tcp 23 1123
R1(config)#
Người dùng cũng có thể khai báo thêm giao thức riêng cho mình:
Trong ví dụ sau người dùng tạo thêm 2 ứng dụng riêng của mình, 1 ứng dụng tên mypro
dùng udp port 3999 và một ứng dụng tên tennet dùng port tcp 3999
R1(config)#ip nbar custom mypro udp 3999
R1#sh ip nbar port-map | include 3999
port-map myproudp 3999
R1(config)#ip nbar custom tennet tcp 3999
R1#sh ip nbar port-map | include 3999
port-map mypro
udp 3999
port-map tennet
tcp 3999
Bước 2: Tiến hành kích hoạt tính năng tìm kiếm thống kê giao thức dùng NBAR
R1(config)#
R1(config)#int s0/1/0
R1(config-if)#ip nbar protocol-discovery
Khi chưa tạo lưu lượng chạy qua hệ thống, tiến hành kiểm tra các lưu lượng chạy qua hệ
thống
R1#sh ip nbar protocol-discovery
Serial0/1/0
Input
Output
---------Protocol Packet Count
Packet Count
Byte Count
Byte Count
5min Bit Rate (bps)
5min Bit Rate (bps)
5min Max Bit Rate (bps) 5min Max Bit Rate (bps)
------------------------ ------------------------ ----------------bgp
0
0
0
0
0
0
0
0
Bittorrent
0
0
0
0
0
0
0
0
citrix
0
0
0
0
0
0
0
0
cuseeme
0
0
0
0
....................... thông tin bị lược bỏ.......
Unknown
0
0
0
0
0
0
0
0
Total
0
0
0
0
0
0
0
0
Chú ý việc thống kê được thực hiện theo số đếm tổng gói tin (Packet Count), tổng số byte
sinh ra từ các gói tin (Byte Count), tốc độ của loại giao thức trong vòng 5 phút và tốc độ
tính theo khối 5 phút lớn nhất từ lúc thống kê đến tại thời điểm xem thông tin.
Bắt đầu tạo lưu lượng chạy qua hệ thống
Từ các PC thực hiện lướt web, gọi thoại (1 cuộc từ 1111 đến 2222, nghe nhạc mp3....)
Kiểm tra lại thông tin 10 lưu lượng dữ liệu nhiều nhất
R1#sh ip nbar protocol-discovery top-n 10
Serial0/1/0
Input
----ProtocolPacket Count
Byte Count
5min Bit Rate (bps)
5min Max Bit Rate (bps)
----------------------------------------------http
7578
9081778
157000
157000
rtp
7196
460419
25000
25000
secure-http
40
35712
0
3000
novadigm
50
40695
0
3000
Dns
52
16096
0
3000
rtcp
30
4876
0
Output
-----Packet Count
Byte Count
5min Bit Rate (bps)
5min Max Bit Rate (bps)
-----------------------3779
506811
21000
21000
6440
411854
25000
25000
34
3964
0
1000
0
0
0
0
52
3548
0
0
30
4876
0
h323
bgp
Bittorrent
citrix
Unknown
Total
0
9
713
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1086
89917
7000
10000
16041
9730206
189000
201000
0
6
588
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2567
119784
13000
13000
12908
1051425
59000
60000
Đợi 5 phút
R1#sh ip nbar protocol-discovery top-n 10
Serial0/1/0
-------------http
rtp
secure-http
novadigm
Input
Output
---------ProtocolPacket Count
Packet Count
Byte Count
Byte Count
5min Bit Rate (bps)
5min Bit Rate (bps)
5min Max Bit Rate (bps) 5min Max Bit Rate (bps)
---------------------- ----------------------12584
6626
15559173
654992
165000
0
360000
28000
19296
18540
1234819
1186254
25000
25000
25000
25000
40
34
35712
3964
0
0
3000
1000
50
0
40695
0
Dns
rtcp
h323
bgp
Bittorrent
Citrix
Unknown
Total
0
3000
53
16418
0
3000
78
12748
0
0
14
933
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1112
91109
0
10000
33227
16991607
190000
404000
0
0
53
3627
0
0
78
12748
0
0
11
808
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2588
120756
0
13000
27930
1983149
25000
67000
Thực hiện sinh lưu lượng tcp đến cổng 3999 bằng cách telnet đến 1 trang bất kỳ bằng
port 3999 sẽ thấy lưu lượng của loại traffic này tăng lên
R1#sh ip nbar protocol-discovery top-n 10
Serial0/1/0
Protocol
-----------------http
Input
-----Packet Count
Byte Count
5min Bit Rate (bps)
5min Max Bit Rate (bps)
----------------------12586
15560190
98000
Output
----Packet Count
Byte Count
5min Bit Rate (bps)
5min Max Bit Rate (bps)
----------------------6629
655577
0
Rtp
secure-http
novadigm
Dns
rtcp
h323
tennel
Bgp
bittorrent
Unknown
Total
360000
24557
1571523
25000
25000
40
35712
0
3000
50
40695
0
3000
54
16612
0
3000
100
16356
0
0
16
1021
0
0
0
01
0
0
0
0
0
0
0
0
0
0
1118
91389
0
10000
38521
17333498
123000
404000
28000
23801
1522958
25000
25000
34
3964
0
1000
0
0
0
0
54
3690
0
0
99
16192
0
0
13
896
0
0
2
04
0
0
0
0
0
0
0
0
0
0
2592
120948
0
13000
33224
2324329
25000
67000
R1#sh ip nbar protocol-discovery tennel
Serial0/1/0
Input
-----
Output
------
Protocol
--------------tennel
Packet Count
Byte Count
5min Bit Rate (bps)
5min Max Bit Rate (bps)
---------------------0
01
00
0
Packet Count
Byte Count
5min Bit Rate (bps)
5min Max Bit Rate (bps)
-------------------3
56
0
Có thể dùng lệnh clear counters để reset các thông số về từ đầu
R1#clear counters
Clear "show interface" counters on all interfaces [confirm]^[
R1#clear counters
Clear "show interface" counters on all interfaces [confirm]
R1#sh ip nbar protocol-discovery
*Sep3 15:23:25.511: %CLEAR-5-COUNTERS: Clear counter on all interfaces
by console
R1#sh ip nbar protocol-discovery
Serial0/1/0
Input
Output
---------Protocol
Packet Count
Packet Count
Byte Count
Byte Count
5min Bit Rate (bps)
5min Bit Rate (bps)
5min Max Bit Rate (bps) 5min Max Bit Rate (bps)
------------------- ------------------------ ---------------------Rtp
62
62
3968
3968
0
0
0
0
Bgp
0
0
0
0
[...]... 10000 33227 16991607 190000 404000 0 0 53 3627 0 0 78 12748 0 0 11 808 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2588 120756 0 13000 27930 1983149 25000 67000 Thực hiện sinh lưu lượng tcp đến cổng 3999 bằng cách telnet đến 1 trang bất kỳ bằng port 3999 sẽ thấy lưu lượng của loại traffic này tăng lên R1#sh ip nbar protocol-discovery top-n 10 Serial0/1/0 Protocol -http Input -Packet Count Byte Count 5min Bit ... 13 5 tcp 12 14 79 21 udp 6346 6347 6348 tcp 6346 6347 6348 6349 6355 5634 70 70 13 00 17 18 17 19 17 20 11 720 13 00 17 18 17 19 17 20 11 000 - 11 999 80 14 3 220 14 3 220 19 4 19 4 udp 88 749 tcp 88 749 17 01. .. 2727 13 7 13 8 13 7 13 9 17 55 2049 2049 11 9 11 9 13 52 13 52 udp 3460 34 61 3462 3463 3464 3465 tcp 3460 34 61 3462 3463 3464 3465 12 3 12 3 udp 22 5632 tcp 653 01 56 31 110 11 0 17 23 515 515 512 513 514 520 16 98... 24557 15 715 23 25000 25000 40 35 712 3000 50 40695 3000 54 16 612 3000 10 0 16 356 0 16 10 21 0 01 0 0 0 0 0 11 18 913 89 10 000 385 21 17333498 12 3000 404000 28000 238 01 1522958 25000 25000 34 3964 10 00
Ngày đăng: 23/10/2015, 18:05
Xem thêm: Khám Phá Những Lưu Lượng Chạy Qua Router, Khám Phá Những Lưu Lượng Chạy Qua Router