Creating an Encrypted VPN Between the LAN Interfaces of Two Routers
Problem
You want to create an encrypted VPN through the Internet by connecting the LAN interfaces of two routers using pre-shared keys.
Solution
In this example, we show how to use IPSec in tunnel mode to encrypt traffic between the LAN interfaces of two routers. Here is the configuration of the first router:
Router1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z. Router1(config)#crypto isakmp policy
Router1(config-isakmp)#
10
encr aes
Router1(config-isakmp)#
256
authentication pre-share
Router1(config-isakmp)#group
Router1(config-isakmp)#
2
exit
Router1(config)#crypto isakmp key
TUNNELKEY01
address
172.16.2.1
no-xauth
Router1(config)#crypto ipsec transform-set
LAN2LAN-TRANSFORM
ah-sha-hmac esp-aes
Router1(cfg-crypto-trans)#
256
exit
Router1(config)#access-list
102
permit gre host
172.16.1.1
host
Router1(config)#
172.16.2.1
crypto map LAN2LANMAP
10
ipsec-isakmp
% NOTE: This new crypto map will remain disabled until a peer and a valid access list have been configured. Router1(config-crypto-map)#set peer
Router1(config-crypto-map)#
172.16.2.1
set transform-set
Router1(config-crypto-map)#
LAN2LAN-TRANSFORM
match address
Router1(config-crypto-map)#
103
exit
Router1(config)#access-list
103
permit ip
Router1(config)#
192.168.16.0 0.0.0.255 192.168.15.0 0.0.0.255
interface
Router1(config-if)#
FastEthernet0/1
ip address
Router1(config-if)#
192.168.16.1 255.255.255.0
exit
Router1(config)#interface
FastEthernet0/0 ...
Get Cisco IOS Cookbook, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.