Cisco配置舉例
本例假設兩端分別爲AA和BB,兩路由器之間的物理鏈路已經鏈接好,其地址劃分以下:
總廠AA
分廠BB
內部網段網號
172.1.1.0
172.1.2.0
互連網段網號
168.1.1.0
168.1.2.0
路由器內部端口
IP地址
172.1.1.254
172.1.2.254
路由器
Internet端口IP地址
168.1.1.1
168.1.2.1
路由器串口
IP地址
202.96.1.1
202.96.1.2
隧道端口
IP地址
192.168.1.1
192.168.1.2
則兩端路由器配置分別以下:
總廠端路由器部分配置:
crypto isakmp policy 1 ;配置IKE 策略1
authentication pre-share ;IKE 策略1驗證方法設爲pre-share
group 2 ;1024-bit Diffie-Hellman,加密算法未設置則取缺省值:DES
crypto isakmp key test address 202.96.1.2 ;設置Pre-share密鑰爲test,此值兩端需一致
crypto ipsec transform-set ***-test ah-md5-hmac esp-des ;設置AH散列算法爲md5 ,
!
ESP加密算法爲DES。
crypto map ×××demo 10 ipsec-isakmp ;定義crypto map
set peer 202.96.1.2 ;設置隧道對端IP地址
set transform-set ***-test ;設置隧道AH及ESP,
match address 101 ;
!
interface Tunnel0 ;定義隧道接口
ip address 192.168.1.1 255.255.255.0 ;隧道端口IP地址
no ip directed-broadcast
tunnel source 202.96.1.1 ;隧道源端地址
tunnel destination 202.96.1.2 ;隧道目的端地址
crypto map ***demo ;應用***demo於此接口
interface Serial0/0
ip address 202.96.1.1 255.255.255.252 ;串口的Internet IP地址
no ip directed-broadcast
crypto map ***demo ;應用***demo 於串口
!
interface Ethernet0/1
ip address 168.1.1.1 255.255.255.0 ;外部端口IP地址
no ip directed-broadcast
interface Ethernet0/0
ip address 172.1.1.254 255.255.255.0 ; 內部端口IP地址
no ip directed-broadcast
!
ip classless
ip route 0.0.0.0 0.0.0.0 202.96.1.2 ;缺省路由
ip route 172.1.2.0 255.255.0.0 192.168.1.2 ;到中山端內網靜態路由(通過隧道)
access-list 101 permit gre host 202.96.1.1 host 202.96.1.2 ;定義存取列表
分廠端路由器部分配置:
crypto isakmp policy 1
authentication pre-share
group 2
crypto isakmp key test address 202.96.1.1
crypto ipsec transform-set ***-test ah-md5-hmac esp-des
!
crypto map ×××demo 10 ipsec-isakmp
set peer 202.96.1.1
set transform-set ***-test
match address 101
!
interface Tunnel0
ip address 192.168.1.2 255.255.255.0
no ip directed-broadcast
tunnel source Serial0/0
tunnel destination 202.96.1.1
crypto map ×××demo
interface Serial0/0
ip address 202.96.1.2 255.255.255.252
no ip directed-broadcast
crypto map ***demo
!
interface Ethernet0/1
ip address 168.1.2.1 255.255.255.0
no ip directed-broadcast
interface Ethernet0/0
ip address 172.1.2.254 255.255.255.0
no ip directed-broadcast
!
ip classless
ip route 0.0.0.0 0.0.0.0 202.96.1.1
ip route 172.1.1.0 255.255.0.0 192.168.1.1
access-list 101 permit gre host 202.96.1.2 host 202.96.1.1