Kami:
So in this case is there any difference between
match protocol http url "*test.com*"
and
match protocol http host "*test.com*"?
YES there is a difference between host and url and direction DOES matter
Summary of a very long but quick post...My Conclusion is that URL should NOT be used to match on host name (google in this case), but read the rest and judge for yourself.
Testing procedure below
Topology
PC--------fa0/0-Router-Dial0------Internet
MYROUTER#sho ver
Cisco IOS Software, 1841 Software (C1841-ADVIPSERVICESK9-M), Version 12.4(25a), RELEASE SOFTWARE (fc2)
1. TEST.....match protocol http host "*google*" ....outbound to Internet (inbound on fa0/0)
class-map match-all WWW
match protocol http host "*google*"
policy-map MARK_WWW
class WWW
set precedence 3
interface FastEthernet0/0
service-policy input MARK_WWW
A. Surf to http://www.google.com from pc
MYROUTER#sho policy-map int fa0/0
FastEthernet0/0
Service-policy input: MARK_WWW
Class-map: WWW (match-all)
14 packets, 3557 bytes
5 minute offered rate 2000 bps, drop rate 0 bps
Match: protocol http host "*google*"
QoS Set
precedence 3
Packets marked 14 <-----matches on host (but wireshark caught around 30 packets)
Class-map: class-default (match-any)
22 packets, 1620 bytes <----- pretty quiet network --- some of this is telnet
5 minute offered rate 0 bps, drop rate 0 bps
Match: any
B. Surf to http://www.google.com/google from pc
MYROUTER#clear counters fa0/0 <------- Counters CLEARED
Clear "show interface" counters on this interface [confirm]
MYROUTER#sho policy-map int fa0/0
FastEthernet0/0
Service-policy input: MARK_WWW
Class-map: WWW (match-all)
7 packets, 1916 bytes <------- Still making matches but a google returns 404 so not a lot of data
5 minute offered rate 1000 bps, drop rate 0 bps
Match: protocol http host "*google*"
QoS Set
precedence 3
Packets marked 7
Class-map: class-default (match-any)
24 packets, 1881 bytes
5 minute
2. TEST.....match protocol http url "*google*" ....outbound to Internet (inbound on fa0/0)
class-map match-all WWW
match protocol http url "*google*"
A. Surf to http://www.google.com from pc
MYROUTER#clear counters fa0/0
Clear "show interface" counters on this interface [confirm]
MYROUTER#sho policy-map int fa0/0
FastEthernet0/0
Service-policy input: MARK_WWW
Class-map: WWW (match-all)
0 packets, 0 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: protocol http url "*google*"
QoS Set
precedence 3
Packets marked 0 <--------- Nothing URL not good for matching www.google.com
Class-map: class-default (match-any)
28 packets, 4505 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: any
MYROUTER#
B. Surf to http://www.google.com/google from pc
MYROUTER#clear counters fa0/0 <------- Counters CLEARED
Clear "show interface" counters on this interface [confirm]
MYROUTER#sho policy-map int fa0/0
FastEthernet0/0
Service-policy input: MARK_WWW
Class-map: WWW (match-all)
4 packets, 986 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: protocol http url "*google*"
QoS Set
precedence 3
Packets marked 4 <--------- some matches similiar to above (Wireshark had around 17 total packets)
Class-map: class-default (match-any)
8 packets, 628 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: any
3. TEST.....match protocol http ....outbound to Internet (inbound on fa0/0)
class-map match-all WWW
match protocol http <-------Just to stay sane a little simpler please
A. Surf to http://www.google.com from pc
MYROUTER#sho policy-map int fa0/0
FastEthernet0/0
Service-policy input: MARK_WWW
Class-map: WWW (match-all)
13 packets, 3495 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: protocol http
QoS Set
precedence 3
Packets marked 13 <--almost identical to "host" above
Class-map: class-default (match-any)
21 packets, 1656 bytes <--almost identical to "host" above
5 minute offered rate 0 bps, drop rate 0 bps
Match: any
MYROUTER#
B. Surf to http://www.google.com/google from pc
MYROUTER#sho policy-map int fa0/0
FastEthernet0/0
Service-policy input: MARK_WWW
Class-map: WWW (match-all)
7 packets, 1166 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: protocol http
QoS Set
precedence 3
Packets marked 7
Class-map: class-default (match-any)
17 packets, 1156 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: any
MYROUTER#