- Table of Contents
-
- 06-Layer 3—IP Services Configuration Guide
- 00-Preface
- 01-ARP configuration
- 02-IP addressing configuration
- 03-DHCP configuration
- 04-DNS configuration
- 05-NAT configuration
- 06-NAT66 configuration
- 07-IP forwarding basics configuration
- 08-Fast forwarding configuration
- 09-Multi-CPU packet distribution configuration
- 10-Adjacency table configuration
- 11-IP performance optimization configuration
- 12-UDP helper configuration
- 13-IPv6 basics configuration
- 14-DHCPv6 configuration
- 15-IPv6 fast forwarding configuration
- 16-AFT configuration
- 17-Tunneling configuration
- 18-GRE configuration
- 19-ADVPN configuration
- 20-WAAS configuration
- 21-Web caching configuration
- 22-HTTP proxy configuration
- Related Documents
-
Title | Size | Download |
---|---|---|
21-Web caching configuration | 138.75 KB |
Contents
License requirement for Web caching
Restrictions and guidelines: Web caching configuration
Configuring Web caching parameters
Display and maintenance commands for Web caching
Web caching configuration examples (in standalone mode)
Example: Configuring HTTP-based Web caching
Example: Configuring HTTPS-based Web caching
Web caching configuration examples (in IRF mode)
Example: Configuring HTTP-based Web caching
Example: Configuring HTTPS-based Web caching
Configuring Web caching
About Web caching
The Web caching feature saves specific webpage content requested by HTTP or HTTPS users from specific Web servers to files in the Web cache directory. If users access the same content before the content is aged out, the device retrieves the content from the files and sends the content to the users. Web caching can reduce the traffic between the device and the Web servers, lower Web content transmission costs, relieve pressure on Web servers, and improve user Web access speed.
Web caching mechanism
Figure 1 shows the Web caching mechanism.
Figure 1 Web caching mechanism
1. The host sends an HTTP or HTTPS GET request to the device.
2. The device identifies whether the Web caching feature is configured to cache Web content from the Web server.
¡ If not, the device forwards the request directly to the Web server. The Web caching feature does not take part in the communication between the host and the Web server.
¡ If yes, the device forwards the request to the Web caching process.
3. The Web caching process obtains the URL of the request and looks up its cache for the requested content.
¡ If the requested content is found in the cache, the device retrieves the content and sends the content to the host. The HTTP or HTTPS GET operation is completed.
¡ If the requested content is not found, the device re-constructs the request and sends the request to the Web server.
4. The Web server sends the requested content to the device.
5. The device identifies whether the Web caching feature is configured to cache the content.
¡ If yes, the device uses the Web caching feature to cache the content, re-constructs a response, and sends the response to the host.
¡ If not, the device re-constructs a response and sends the response to the host.
Basic concepts
· Web cache files and Web cache directory—The Web caching feature saves its operation data and the Web content to be cached to files in the Web cache directory. After the effective maximum total size for Web cache files is reached, the device deletes the oldest Web cache file to save the new Web cache file.
· Web cache file aging time—The Web cache file aging time is fixed at 30 days. When the device reboots or receives a request for the cached content in a file, it restarts the aging timer. If no users request the cached content before the aging timer expires, the device deletes the file.
License requirement for Web caching
The Web caching feature requires a license. If you configure the feature without a license, the settings will be lost after a device reboot. For information about feature licensing, see Fundamentals Configuration Guide.
Restrictions and guidelines: Web caching configuration
Before configuring or modifying Web caching parameters, you must disable Web caching. After configuring or modifying Web caching parameters, enable Web caching again.
Web caching tasks at a glance
To configure Web caching, perform the following tasks:
1. Configuring Web caching parameters
Configuring Web caching parameters
Restrictions and guidelines
Before configuring or modifying Web caching parameters, you must disable Web caching. After configuring or modifying Web caching parameters, enable Web caching again.
The Web cache directory for a Web cache view must reside on the same slot as the Web view.
Before specifying a Web cache directory, make sure all files in the upper-level directory are using a different name than the Web cache directory or have a file extension.
Make sure the storage medium where the Web cache directory resides has sufficient storage space. The directory typically needs a storage space of over 1 GB.
Prerequisites
To cache only Web content from certain Web servers, configure an IPv4 object group to identify the Web servers. For more information about the IPv4 object group feature, see object group configuration in Security Configuration Guide.
Procedure
1. Enter system view.
system-view
2. Create and enter Web cache view.
In standalone mode:
web-cache slot slot-number
In IRF mode:
web-cache chassis chassis-number slot slot-number
3. Specify the types of the webpage files to be cached.
cached-data { apk | bmp | doc | docx | gif | gzip | ipa | jar | jpg | jpeg | mp4 | pdf | png | ppt | pptx | rar | swf | tar | txt | xls | xlsx | zip } *
By default, no webpage file types are specified. The Web caching feature does not cache any types of files on webpages.
4. (Optional.) Specify webpage files to be cached.
cached-file file-name
By default, no webpage files to be cached are specified.
If you specify both webpage files and types of the webpage files to be cached, the device caches matching webpage files of the specified types.
5. Set the Web caching listening port number.
¡ Set the port number for Web caching to listen for HTTP packets.
listen-port port-number
¡ Set the port number for Web caching to listen for HTTPS packets.
https listen-port port-number
By default, Web caching uses port 80 to listen for HTTP packets and port 443 to listen for HTTPS packets.
Make sure the specified TCP port number is not being used by any other services on the device. To display TCP port numbers in use, execute the display tcp verbose command.
6. (Optional.) Specify an IPv4 object group used to filter Web content to be cached.
object-group [ source ] ip object-group-name
By default, no IPv4 object group is specified for the Web caching feature to filter Web content. The Web caching feature caches Web content from all Web servers.
To cache Web content requested by specific Web clients, specify the source keyword. To cache Web content sent from specific Web servers, do not specify the source keyword.
7. Set the Web cache directory.
file-directory directory
By default, the Web cache directory is not set.
8. (Optional.) Set the maximum total size of Web cache files.
cache-limit size
By default, the maximum total size of Web cache files is 4 GB.
The maximum total size for Web cache files must be smaller than the maximum storage space size in the working directory.
Enabling Web caching
Restrictions and guidelines
Before enabling Web caching, you must configure the types of the webpage files to be cached and the Web cache directory.
Web caching will restart in one of the following situations:
· When HTTP-based Web caching is configured, enable HTTPS-based Web caching.
· When HTTPS-based Web caching is configured, enable HTTP-based Web caching.
· When both HTTP-based and HTTPS-based Web caching are configured, disable HTTP-based or HTTPS-based Web caching.
Procedure
1. Enter system view.
system-view
2. Create and enter Web cache view.
In standalone mode:
web-cache slot slot-number
In IRF mode:
web-cache chassis chassis-number slot slot-number
3. Enable Web caching. Choose the options to configure as needed:
¡ Enable HTTP-based Web caching.
http enable
By default, HTTP-based Web caching is disabled.
¡ Enable HTTPS-based Web caching.
https enable
By default, HTTPS-based Web caching is disabled.
Display and maintenance commands for Web caching
Execute the display command in any view.
Task |
Command |
Display Web caching information. |
display web-cache [ history [ last { day | 30-days | 365-days | hour | minute | week } | verbose ] ] |
Web caching configuration examples (in standalone mode)
Example: Configuring HTTP-based Web caching
Network configuration
As shown in Figure 2, configure HTTP-based Web caching on the device to cache Web content from the HTTP server.
Prerequisites
# Configure IP addresses for interfaces. (Details not shown.)
Procedure
1. Create and enter Web cache view.
<Device> system-view
[Device] web-cache slot 1
2. Configure Web caching parameters:
# Set the Web cache directory to #flash:/webcache.
[Device-web-cache-slot1] file-directory flash:/webcache
# Set the port number to 9955 for Web caching to listen for HTTP packets.
[Device-web-cache-slot1] listen-port 9955
# Set the maximum total size for Web cache files to 10 GB.
[Device-web-cache-slot1] cache-limit 10
# Specify the types of the files on webpages to be cached.
[Device-web-cache-slot1] cached-data doc docx
3. Enable HTTP-based Web caching.
[Device-web-cache-slot1] http enable
Verifying the configuration
# Display Web caching information after the host sends the first HTTP request to the Web server.
[Device-web-cache-slot1] display web-cache
Capability information
Cache path: flash:/webcache/proxy/cache
Max connections: 1022
Max cache size: 10GB
Current state information
Cache memory: 25.0MB
Cache count: 2
Statistics for past 1 minute
ConnectTop: 4
CacheTop: 25.0MB
Bandwidth saved: 0
Cached data transmission speed: 3.3Mbps
Cached data transmitted: 25.0MB
Download speed: 3.3Mbps
Download size: 25.0MB
CacheHitRate: 0%
Hit count: 0 Miss count: 1
...
Statistics for past 365 days
ConnectTop: 4
CacheTop: 25.0MB
Bandwidth saved: 0
Cached data transmission speed: 3.3Mbps
Cached data transmitted: 25.0MB
Download speed: 3.3Mbps
Download size: 25.0MB
CacheHitRate: 0%
Hit count: 0 Miss count: 1
# Display Web caching information after the host sends the second HTTP request for the same content to the Web server.
[Device-web-cache-slot1] display web-cache
Capability information
Cache path: flash:/webcache/proxy/cache
Max connections: 1022
Max cache size: 10GB
Current state information
Cache memory: 25.0MB
Cache count: 2
Statistics for past 1 minute
ConnectTop: 3
CacheTop: 25.0MB
Bandwidth saved: 3.3Mbps
Cached data transmission speed: 3.3Mbps
Cached data transmitted: 25.0MB
Download speed: 0
Download size: 0
CacheHitRate: 100%
Hit count: 1 Miss count: 0
...
Statistics for past 365 days
ConnectTop: 3
CacheTop: 25.0MB
Bandwidth saved: 3.3Mbps
Cached data transmission speed: 3.3Mbps
Cached data transmitted: 50.0MB
Download speed: 3.3Mbps
Download size: 25.0MB
CacheHitRate: 100%
Hit count: 1 Miss count: 1
The command output shows the Web caching feature is operating correctly.
· The value of the Miss count field in the command output from the first display command is 1. The value of the Hit count field in the command output from the second display command is 1. The second HTTP request hits the Web cache.
· The value of the Download size field in the command output from the second display command is 0. The value of the Bandwidth saved field in the command output from the second display command is 3.3 Mbps. This indicates that no Web data was downloaded from the Web server to the device after the device sent the second HTTPS request.
Example: Configuring HTTPS-based Web caching
Network configuration
As shown in Figure 3, configure HTTPS-based Web caching on the device to cache Web content from the HTTPS server.
Prerequisites
# Configure IP addresses for interfaces. (Details not shown.)
Procedure
1. Create and enter Web cache view.
<Device> system-view
[Device] web-cache slot 1
2. Configure Web caching parameters:
# Set the Web cache directory to #flash:/webcache.
[Device-web-cache-slot1] file-directory flash:/webcache
# Set the port number to 9955 for Web caching to listen for HTTPS packets.
[Device-web-cache-slot1] listen-port 9955
# Set the maximum total size for Web cache files to 10 GB.
[Device-web-cache-slot1] cache-limit 10
# Specify the types of the files on webpages to be cached.
[Device-web-cache-slot1] cached-data doc docx
3. Enable HTTPS-based Web caching.
[Device-web-cache-slot1] https enable
Verifying the configuration
# Display Web caching information after the host sends the first HTTPS request to the Web server.
[Device-web-cache-slot1] display web-cache
Capability information
Cache path: flash:/webcache/proxy/cache
Max connections: 1022
Max cache size: 10GB
Current state information
Cache memory: 25.0MB
Cache count: 2
Statistics for past 1 minute
ConnectTop: 4
CacheTop: 25.0MB
Bandwidth saved: 0
Cached data transmission speed: 3.3Mbps
Cached data transmitted: 25.0MB
Download speed: 3.3Mbps
Download size: 25.0MB
CacheHitRate: 0%
Hit count: 0 Miss count: 1
...
Statistics for past 365 days
ConnectTop: 4
CacheTop: 25.0MB
Bandwidth saved: 0
Cached data transmission speed: 3.3Mbps
Cached data transmitted: 25.0MB
Download speed: 3.3Mbps
Download size: 25.0MB
CacheHitRate: 0%
Hit count: 0 Miss count: 1
# Display Web caching information after the host sends the second HTTP request for the same content to the Web server.
[Device-web-cache-slot1] display web-cache
Capability information
Cache path: flash:/webcache/proxy/cache
Max connections: 1022
Max cache size: 10GB
Current state information
Cache memory: 25.0MB
Cache count: 2
Statistics for past 1 minute
ConnectTop: 3
CacheTop: 25.0MB
Bandwidth saved: 3.3Mbps
Cached data transmission speed: 3.3Mbps
Cached data transmitted: 25.0MB
Download speed: 0
Download size: 0
CacheHitRate: 100%
Hit count: 1 Miss count: 0
...
Statistics for past 365 days
ConnectTop: 3
CacheTop: 25.0MB
Bandwidth saved: 3.3Mbps
Cached data transmission speed: 3.3Mbps
Cached data transmitted: 50.0MB
Download speed: 3.3Mbps
Download size: 25.0MB
CacheHitRate: 100%
Hit count: 1 Miss count: 1
The command output shows the Web caching feature is operating correctly.
· The value of the Miss count field in the command output from the first display command is 1. The value of the Hit count field in the command output from the second display command is 1. The second HTTP request hits the Web cache.
· The value of the Download size field in the command output from the second display command is 0. The value of the Bandwidth saved field in the command output from the second display command is 3.3 Mbps. This indicates that no Web data was downloaded from the Web server to the device after the device sent the second HTTPS request.
Web caching configuration examples (in IRF mode)
Example: Configuring HTTP-based Web caching
Network configuration
As shown in Figure 4, configure Web caching on the device to cache Web content from the HTTP server.
Prerequisites
# Configure IP addresses for interfaces. (Details not shown.)
Procedure
1. Create and enter Web cache view.
<Device> system-view
[Device] web-cache chassis 1 slot 1
2. Configure Web caching parameters:
# Set the Web cache directory to #flash:/webcache.
[Device-web-cache-chassis1-slot1] file-directory flash:/webcache
# Set the port number to 9955 for Web caching to listen for HTTP packets.
[Device-web-cache-chassis1-slot1] listen-port 9955
# Set the maximum total size for Web cache files to 10 GB.
[Device-web-cache-chassis1-slot1] cache-limit 10
# Specify the types of the files on webpages to be cached.
[Device-web-cache-chassis1-slot1] cached-data doc docx
3. Enable HTTP-based Web caching.
[Device-web-cache-chassis1-slot1] http enable
Verifying the configuration
# Display Web caching information after the host sends the first HTTP request to the Web server.
[Device-web-cache-chassis1-slot1] display web-cache
Capability information
Cache path: flash:/webcache/proxy/cache
Max connections: 1022
Max cache size: 10GB
Current state information
Cache memory: 25.0MB
Cache count: 2
Statistics for past 1 minute
ConnectTop: 4
CacheTop: 25.0MB
Bandwidth saved: 0
Cached data transmission speed: 3.3Mbps
Cached data transmitted: 25.0MB
Download speed: 3.3Mbps
Download size: 25.0MB
CacheHitRate: 0%
Hit count: 0 Miss count: 1
...
Statistics for past 365 days
ConnectTop: 4
CacheTop: 25.0MB
Bandwidth saved: 0
Cached data transmission speed: 3.3Mbps
Cached data transmitted: 25.0MB
Download speed: 3.3Mbps
Download size: 25.0MB
CacheHitRate: 0%
Hit count: 0 Miss count: 1
# Display Web caching information after the host sends the second HTTP request for the same content to the Web server.
[Device-web-cache-chassis1-slot1] display web-cache
Capability information
Cache path: flash:/webcache/proxy/cache
Max connections: 1022
Max cache size: 10GB
Current state information
Cache memory: 25.0MB
Cache count: 2
Statistics for past 1 minute
ConnectTop: 3
CacheTop: 25.0MB
Bandwidth saved: 3.3Mbps
Cached data transmission speed: 3.3Mbps
Cached data transmitted: 25.0MB
Download speed: 0
Download size: 0
CacheHitRate: 100%
Hit count: 1 Miss count: 0
...
Statistics for past 365 days
ConnectTop: 3
CacheTop: 25.0MB
Bandwidth saved: 3.3Mbps
Cached data transmission speed: 3.3Mbps
Cached data transmitted: 50.0MB
Download speed: 3.3Mbps
Download size: 25.0MB
CacheHitRate: 100%
Hit count: 1 Miss count: 1
The command output shows the Web caching feature is operating correctly.
· The value of the Miss count field in the command output from the first display command is 1. The value of the Hit count field in the command output from the second display command is 1. The second HTTP request hits the Web cache.
· The value of the Download size field in the command output from the second display command is 0. The value of the Bandwidth saved field in the command output from the second display command is 3.3 Mbps. This indicates that no Web data was downloaded from the Web server to the device after the device sent the second HTTPS request.
Example: Configuring HTTPS-based Web caching
Network configuration
As shown in Figure 5, configure HTTPS-based Web caching on the device to cache Web content from the HTTPS server.
Prerequisites
# Configure IP addresses for interfaces. (Details not shown.)
Procedure
1. Create and enter Web cache view.
<Device> system-view
[Device] web-cache chassis 1 slot 1
2. Configure Web caching parameters:
# Set the Web cache directory to #flash:/webcache.
[Device-web-cache-chassis1-slot1] file-directory flash:/webcache
# Set the port number to 9955 for Web caching to listen for HTTPS packets.
[Device-web-cache-chassis1-slot1] listen-port 9955
# Set the maximum total size for Web cache files to 10 GB.
[Device-web-cache-chassis1-slot1] cache-limit 10
# Specify the types of the files on webpages to be cached.
[Device-web-cache-chassis1-slot1] cached-data doc docx
3. Enable HTTPS-based Web caching.
[Device-web-cache-chassis1-slot1] https enable
Verifying the configuration
# Display Web caching information after the host sends the first HTTPS request to the Web server.
[Device-web-cache-chassis1-slot1] display web-cache
Capability information
Cache path: flash:/webcache/proxy/cache
Max connections: 1022
Max cache size: 10GB
Current state information
Cache memory: 25.0MB
Cache count: 2
Statistics for past 1 minute
ConnectTop: 4
CacheTop: 25.0MB
Bandwidth saved: 0
Cached data transmission speed: 3.3Mbps
Cached data transmitted: 25.0MB
Download speed: 3.3Mbps
Download size: 25.0MB
CacheHitRate: 0%
Hit count: 0 Miss count: 1
...
Statistics for past 365 days
ConnectTop: 4
CacheTop: 25.0MB
Bandwidth saved: 0
Cached data transmission speed: 3.3Mbps
Cached data transmitted: 25.0MB
Download speed: 3.3Mbps
Download size: 25.0MB
CacheHitRate: 0%
Hit count: 0 Miss count: 1
# Display Web caching information after the host sends the second HTTP request for the same content to the Web server.
[Device-web-cache-chassis1-slot1] display web-cache
Capability information
Cache path: flash:/webcache/proxy/cache
Max connections: 1022
Max cache size: 10GB
Current state information
Cache memory: 25.0MB
Cache count: 2
Statistics for past 1 minute
ConnectTop: 3
CacheTop: 25.0MB
Bandwidth saved: 3.3Mbps
Cached data transmission speed: 3.3Mbps
Cached data transmitted: 25.0MB
Download speed: 0
Download size: 0
CacheHitRate: 100%
Hit count: 1 Miss count: 0
...
Statistics for past 365 days
ConnectTop: 3
CacheTop: 25.0MB
Bandwidth saved: 3.3Mbps
Cached data transmission speed: 3.3Mbps
Cached data transmitted: 50.0MB
Download speed: 3.3Mbps
Download size: 25.0MB
CacheHitRate: 100%
Hit count: 1 Miss count: 1
The command output shows the Web caching feature is operating correctly.
· The value of the Miss count field in the command output from the first display command is 1. The value of the Hit count field in the command output from the second display command is 1. The second HTTP request hits the Web cache.
· The value of the Download size field in the command output from the second display command is 0. The value of the Bandwidth saved field in the command output from the second display command is 3.3 Mbps. This indicates that no Web data was downloaded from the Web server to the device after the device sent the second HTTPS request.
Troubleshooting Web caching
Web caching enabling failure
Symptom
Web caching failed to be enabled.
Analysis
The TCP port number specified for Web caching must belong to Web caching exclusively. If any other services on the device are using the same TCP port number, Web caching cannot be enabled.
Solution
To resolve the problem:
1. Execute the display tcp verbose command to display TCP port numbers being used.
2. Specify an unused TCP port number as the Web caching listening port number.