The following is a typical gateway-to-gateway VPN that uses a preshared secret for authentication.
10.5.6.0/24 172.23.9.0/24
| |
--| |--
| +-----------+ /-^-^-^-^--\ +-----------+ |
|-----| Gateway A |=====| Internet |=====| Gateway B |-----|
| AL+-----------+AW \--v-v-v-v-/ BW+-----------+BL |
--| 10.5.6.1 14.15.16.17 22.23.24.25 172.23.9.1 |--
| |
Gateway A connects the internal LAN 10.5.6.0/24 to the Internet. Gateway A's LAN interface has the address 10.5.6.1, and its WAN (Internet) interface has the address 14.15.16.17.
Gateway B connects the internal LAN 172.23.9.0/24 to the Internet. Gateway B's WAN (Internet) interface has the address 22.23.24.25. Gateway B's LAN interface address, 172.23.9.1, can be used for testing IPsec but is not needed for configuring Gateway A.
The IKE Phase 1 parameters used in Scenario 1 are:
The IKE Phase 2 parameters used in Scenario 1 are:
To set up Gateway A for this scenario, use the following steps:
# To Add policy, use: TestIOCTL /add t1.conf # To display SA information, use: TestIOCTL /dump # To display SPD, use: TestIOCTL /dump spd # To flush/delete SPD, use: TestIOCTL /flush spd # To flush/delete SA, use: TestIOCTL /flush
{ laddr 10.5.6.0/24 raddr 172.23.9.0/24 } ipsec { encr_algs 3des encr_auth_algs sha1 tladdr 14.15.16.17 traddr 22.23.24.25 }
For help, run "ike ?"
ike <option>* <ipaddr>*
option:
-c <ipaddr> initiates connection
-d [mins] sets or shows DPD interval (in minutes)
-p <ascii> sets pre-shared key
-v <num> sets or shows IKE version
-g <dh|0> sets DH group; 0=default
-G <dh|0|-1> sets PFS; 0=no PFS, -1=parent DH group
-l <secs> sets IKE_SA lifetime seconds
-L <secs> sets IPsec SA lifetime seconds
-a [eap] sets EAP authenticator protocol
-s [eap] sets EAP supplicant protocol
-h displays this help
-w <secs> sets socket wait time (in seconds)
dh: { 1 | 2 | 5 | 14 | 15 | 16 | 17 | 18 }
eap : { aka | leap | md5 | mschapv2 | psk | radius | sim | srp | tls }
2001:2::0/64 2001:3::0/64
| |
--| |--
| +-----------+ /-^-^-^-^--\ +-----------+ |
|-----| Gateway A |=====| Internet |=====| Gateway B |-----|
| AL+-----------+AW \--v-v-v-v-/ BW+-----------+BL |
--| 2001:2::1 2001:1::17 2001:1::25 2001:3::1 |--
| |
C:\> ipv6 install
C:\> netsh interface ipv6 add address "Local Area Connection" 2001:1::17 C:\> netsh interface ipv6 add address "Local Area Connection 2" 2001:2::1
C:\> netsh interface ipv6 set interface "Local Area Connection" forwarding=enabled advertise=enabled
C:\> netsh interface ipv6 add route 2001:1::/64 "Local Area Connection" publish=yes C:\> netsh interface ipv6 add route 2001:2::/64 "Local Area Connection 2" publish=yes C:\> netsh interface ipv6 add route 2001:3::/64 "Local Area Connection" nexthop=2001:1::25 publish=yes
i.e. ping6 2001:1::25 or if using local address, use %<dest scopeid> i.e. ping6 fe80::213:72ff:fec9:6a25%4Note: If ping6 doesn't work, you might have to reboot the machine to make sure the global address is in effect.
ike.exe -p "hr5xb84l6aa9r6" 2001:1::17 or if you are using Local address, be sure to add the dest scope id: i.e. ike.exe -p "hr5xb84l6aa9r6" fe80::213:72ff:fec9:8917%4
i.e. { laddr 2001:2::0/64 raddr 2001:3::0/64} ipsec { encr_algs aes encr_auth_algs sha1 tladdr 2001:1::17 traddr 2001:1::25}
TestIOCTL.exe /add t1.conf
mknod /dev/moc_memdrv c 255 0 mknod /dev/moc_ipsec c 103 1
/sbin/ifconfig eth1 <2nd interface ipaddr> netmask 255.255.255.0 /sbin/route add -net <dest internal network> netmask 255.255.255.0 gw <dest gw ipaddr> Note: Run /sbin/route to check if there is more than 1 default route. If more than 1 default route, delete eth1 default route. ie. /sbin/route del default gw gateway1
echo "1" > /proc/sys/net/ipv4/ip_forward
/sbin/insmod moc_memdrv.ko /sbin/insmod moc_ipsec.ko
./ike -p "hr5xb84l6aa9r6" <local gw address> &Note: For ikev2, use ./ike -v 2 -p "hr5xb84l6aa9r6" <local gw address> &
./loadConfig -f <policy.conf>
/sbin/ifconfig eth1 10.5.6.1 netmask 255.255.255.0 /sbin/route add -net 172.23.9.0 netmask 255.255.255.0 gw 22.23.24.25 echo "1" > /proc/sys/net/ipv4/ip_forward /sbin/insmod moc_memdrv.ko /sbin/insmod moc_ipsec.ko sleep 3 ./ike -p "hr5xb84l6aa9r6" 14.15.16.17 & ./loadConfig -f policyA.conf
/sbin/ifconfig eth1 172.23.9.1 netmask 255.255.255.0 /sbin/route add -net 10.5.6.0 netmask 255.255.255.0 gw 14.15.16.17 echo "1" > /proc/sys/net/ipv4/ip_forward /sbin/insmod moc_memdrv.ko /sbin/insmod moc_ipsec.ko sleep 3 ./ike -p "hr5xb84l6aa9r6" 22.23.24.25 & ./loadConfig -f policyB.conf
# killall ike
-> to kill ike process
# rmmod moc_ipsec
-> to remove ipsec_modules
Note: If run ike in foreground, press Ctrl+\ to kill ike.
2001:2::0/64 2001:3::0/64
| |
--| |--
| +-----------+ /-^-^-^-^--\ +-----------+ |
|-----| Gateway A |=====| Internet |=====| Gateway B |-----|
| AL+-----------+AW \--v-v-v-v-/ BW+-----------+BL |
--| 2001:2::1 2001:1::17 2001:1::25 2001:3::1 |--
| |
ls /proc/net/if_inet6 or /sbin/ifconfig and it should return inet6 information i.e. inet6 addr: fe80::213:72ff:fec9:8917/64 Scope:Link
/sbin/ip addr add 2001:1::17/64 dev eth0 /sbin/ip addr add 2001:2::1/64 dev eth1
/sbin/ip -6 route add 2001:3::/64 via 2001:1::25 echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
i.e. ping6 2001:1::25 or if you are using link local address, use i.e. ping6 fe80::213:72ff:fec9:6a25
./ike -p "hr5xb84l6aa9r6" 2001:1::17 & or if you are using Local address, be sure to add the dest scope id: i.e. ike.exe -p "hr5xb84l6aa9r6" fe80::213:72ff:fec9:8917%4
i.e. { laddr 2001:2::0/64 raddr 2001:3::0/64 } ipsec { encr_algs aes encr_auth_algs sha1 tladdr 2001:1::17 traddr 2001:1::25}
./loadConfig -f t1.conf
Policy format
=============
{laddr <local IP address> raddr <dest IP address> ulp [icmp|tcp|udp|any] } ipsec { encr_algs [3des|aes|blowfish|any]
encr_auth_algs [sha1|md5|any] tladdr <tunnel local address> traddr <tunnel dest address> }
Explanation:
laddr : local IP address
raddr : remote IP address
ulp : upper layer protocol
ipsec : both direction or use permit/apply for unidirection
encr_algs : encryption
encr_auth_algs : authentication
tladdr : local gateway IP address
traddr : remote gateway IP address
policyA.conf
=============
{laddr 10.5.6.0/24 raddr 172.23.9.0/24 } ipsec { encr_algs 3des encr_auth_algs sha1 tladdr 14.15.16.17 traddr 22.23.24.25 }
policyB.conf
=============
{laddr 172.23.9.0/24 raddr 10.5.6.0/24 } ipsec { encr_algs 3des encr_auth_algs sha1 tladdr 22.23.24.25 traddr 14.15.16.17 }
loadConfig -f <policy.conf> to load IPsec policy. It also flush the SA and SPD before loading the new policy.
-F flush SA
-FP flush SPD
-d display key
-dP display policy
In Linux, loadConfig output to /var/log/message. Run tail -f /var/log/message or dmesg to see output from loadConfig