ืืืฆื
ืงืืืืชื ืืจืกืช ืืืืื ืฉื ืืืฆืจื C-Terra VPN ืืจืกื 4.3 ืืืฉื ืฉืืืฉื ืืืืฉืื. ืื ื ืจืืฆื ืืืจืจ ืื ืืื ืืื ืืกื ืฉืื ืืืคืื ืืงืืื ืืืชืจ ืืืืจ ืืืขืืจ ืืืจืกื ืืืืฉื.
ืืืื ืื ืื ืงืฉื, ืฉืงืืช ืืืช ืฉื ืงืคื ื ืืก 3 ื-1 ืืืืจื ืืืกืคืืง. ืื ื ืืืื ืื ืืื ืืืฉืื ืืืืืืช. ืื ื ืื ืกื ืืื ืืช ืืช ืกืืืืืช GRE-over-IPsec ื-IPsec-over-GRE.
ืืื ืืืฉืื ืืืืื
ืืืืืืจ ืขืืื ืฉืืื ืืงืื ืืืืื ืืชื ืฆืจืื:
- ืืชืื ืืืชื ื [ืืืื ืืืื"ื] ืืืชืืืช ืืจืืื ืืช;
- ืืืืชื, ืฆืืื ืืช ื-TIN ืฉื ืืืจืืื ืฉืื;
- ืจืฉืื ืืช ืืืืฆืจืื ืืืืืชื.
ืืืืืืืช ืชืงืคืืช ืืฉืืืฉื ืืืืฉืื. ืืกืคืง ืืื ื ืืืืื ืืช ืืคืื ืงืฆืืื ืืืืช ืฉืืื.
ืืจืืืช ืืชืืื ื
ืืืืืื ืฉื ืฉืขืจ ืืืืืื ืืื ืชืืื ืช ืืืื ื ืืืจืืืืืืช. ืื ื ืืฉืชืืฉ ื-VMWare Workstation. ืจืฉืืื ืืืื ืฉื ืืืคืจืืืืืืจืื ืืกืืืืืช ืืืจืืืืืืืฆืื ื ืชืืืืช ืืืื ื ืืืชืจ ืืืื ืืจื ื ืฉื ืืกืคืง.
ืืคื ื ืฉืชืชืืื, ืฉืื ืื ืฉืืื ืืืฉืงื ืจืฉืช ืืชืืื ืช ืืจืืจืช ืืืืื ืฉื ืืืืฉื ืืืืืจืืืืื:
ืืืืืืื ืืจืืจ, ืืืฉืชืืฉ ืฆืจืื ืืืืกืืฃ ืืื ืืืฉืงืื ืฉืืื ืฆืจืื. ืื ื ืืืกืืฃ ืืจืืขื ืืืช ืืืช:
ืขืืฉืื ืื ื ืืคืขืื ืืช ืืืืื ื ืืืืจืืืืืืช. ืืื ืืืืจ ืืืฉืงื, ืืฉืขืจ ืืืจืฉ ืฉื ืืฉืชืืฉ ืืกืืกืื.
ืืฉื ื ืืกืคืจ ืงืื ืกืืืืช ื-S-Terra Gateway ืขื ืืฉืืื ืืช ืฉืื ืื. ืื ื ืืกืคืืจ ืืช ืืกืคืจื ืืืืืจ ื ืคืจื. ืืขืช ืขืชื:
Login as: administrator
Password: s-terra
ืื ื ืืืชืื ืืช ืืฉืขืจ. ืืืชืืื ืืื ืจืฆืฃ ืฉื ืคืขืืืืช: ืืื ืช ืจืืฉืืื, ืืงืืช ืืืืื ืืกืคืจืื ืืงืจืืืื ืืืืืืืืื (ืกืืืืืืืจ ืืงืืืช - ืืฉืื ืฉืื ืืื 27 ืฉื ืืืช) ืืืฆืืจืช ืืคืช ืืืฉืง ืจืฉืช.
ืืคื ืฉื ืืืฉืงื ืจืฉืช. ืื ื ืขืฉื ืงื ืืืชืจ
ืืจืกื 4.2 ืงืืืื ืืช ืคื ื ืืืฉืชืืฉ ืืคืขืื ืืืืืขืืช:
Starting IPsec daemonโฆ.. failed
ERROR: Could not establish connection with daemon
ืืฉืชืืฉ ืคืขืื (ืืคื ืืื ืืก ืื ืื ืืื) ืืื ืืฉืชืืฉ ืฉืืืื ืืืืืืจ ืื ืืืจ ืืืืืจืืช ืืืื ืชืืขืื.
ืืฉืื ืืฉืชืืฉ ืืคื ื ืฉื ืืกืืช ืืืืืืจ ืืชืืืช IP ืืืืฉืง. ืืื ืงืฉืืจ ืืืคืช ืืืฉืง ืืจืฉืช. ืืื ืฆืืจื ืืขืฉืืช:
/bin/netifcfg enum > /home/map
/bin/netifcfg map /home/map
service networking restart
ืืชืืฆืื ืืื, ื ืืฆืจืช ืืคืช ืืืฉืง ืจืฉืช ืืืืืื ืืช ืืืืคืื ืฉื ืฉืืืช ืืืฉืงืื ืคืืืืื (0000:02:03.0) ืืืืืขืืืื ืืืืืืื ืฉืืื ืืืขืจืืช ืืืคืขืื (eth0) ืืืงืื ืกืืื ืืืืืช ืกืืกืงื (FastEthernet0/0):
#Unique ID iface type OS name Cisco-like name
0000:02:03.0 phye eth0 FastEthernet0/0
ืืืืขืืืื ืืืืืืื ืฉื ืืืฉืงืื ื ืงืจืืื ืืื ืืืื. ืืื ืืืื ืืืืืกื ืื ืืงืืืฅ /etc/ifaliases.cf.
ืืืจืกื 4.3, ืืืฉืจ ืืืืฉื ืืืืจืืืืื ืืืคืขื ืืจืืฉืื ื, ื ืืฆืจืช ืืืืืืืืช ืืคืช ืืืฉืง. ืื ืชืฉื ื ืืช ืืกืคืจ ืืืฉืงื ืืจืฉืช ืืืืื ื ืืืืจืืืืืืช, ืื ื ืฆืืจ ืืืืฉ ืืช ืืคืช ืืืืฉืง:
/bin/netifcfg enum > /home/map
/bin/netifcfg map /home/map
systemctl restart networking
ืชืื ืืช 1: GRE-over-IPsec
ืื ื ืคืืจืก ืฉื ื ืฉืขืจืื ืืืจืืืืืืื, ืื ื ืืืืืฃ ืืคื ืฉืืืฆื ืืืืืจ:
ืฉืื 1. ืืืืจ ืืชืืืืช IP ืืืกืืืืื
VG1(config) #
interface fa0/0
ip address 172.16.1.253 255.255.255.0
no shutdown
interface fa0/1
ip address 192.168.1.253 255.255.255.0
no shutdown
ip route 0.0.0.0 0.0.0.0 172.16.1.254
VG2(config) #
interface fa0/0
ip address 172.16.1.254 255.255.255.0
no shutdown
interface fa0/1
ip address 192.168.2.254 255.255.255.0
no shutdown
ip route 0.0.0.0 0.0.0.0 172.16.1.253
ืืืืงืช ืงืืฉืืจืืืช IP:
root@VG1:~# ping 172.16.1.254 -c 4
PING 172.16.1.254 (172.16.1.254) 56(84) bytes of data.
64 bytes from 172.16.1.254: icmp_seq=1 ttl=64 time=0.545 ms
64 bytes from 172.16.1.254: icmp_seq=2 ttl=64 time=0.657 ms
64 bytes from 172.16.1.254: icmp_seq=3 ttl=64 time=0.687 ms
64 bytes from 172.16.1.254: icmp_seq=4 ttl=64 time=0.273 ms
--- 172.16.1.254 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 0.273/0.540/0.687/0.164 ms
ืฉืื 2: ืืืืจ ืืช GRE
ืื ื ืืืงื ืืืืื ืฉื ืืืืจืช GRE ืืชืกืจืืืื ืจืฉืืืื. ืื ื ืืืฆืจ ืงืืืฅ gre1 ืืกืคืจืืื /etc/network/interfaces.d ืขื ืืชืืื.
ืขืืืจ VG1:
auto gre1
iface gre1 inet static
address 1.1.1.1
netmask 255.255.255.252
pre-up ip tunnel add gre1 mode gre remote 172.16.1.254 local 172.16.1.253 key 1 ttl 64 tos inherit
pre-up ethtool -K gre1 tx off > /dev/null
pre-up ip link set gre1 mtu 1400
post-down ip link del gre1
ืขืืืจ VG2:
auto gre1
iface gre1 inet static
address 1.1.1.2
netmask 255.255.255.252
pre-up ip tunnel add gre1 mode gre remote 172.16.1.253 local 172.16.1.254 key 1 ttl 64 tos inherit
pre-up ethtool -K gre1 tx off > /dev/null
pre-up ip link set gre1 mtu 1400
post-down ip link del gre1
ืื ื ืืขืื ืืช ืืืืฉืง ืืืขืจืืช:
root@VG1:~# ifup gre1
root@VG2:~# ifup gre1
ืืืืง:
root@VG1:~# ip address show
8: gre1@NONE: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1400 qdisc noqueue state UNKNOWN group default qlen 1
link/gre 172.16.1.253 peer 172.16.1.254
inet 1.1.1.1/30 brd 1.1.1.3 scope global gre1
valid_lft forever preferred_lft forever
root@VG1:~# ip tunnel show
gre0: gre/ip remote any local any ttl inherit nopmtudisc
gre1: gre/ip remote 172.16.1.254 local 172.16.1.253 ttl 64 tos inherit key 1
ื-C-Terra Gateway ืืฉ ืจืืจื ืื ืืช ืืืื ื - tcpdump. ืื ื ืืืชืื dump ืชื ืืขื ืืงืืืฅ pcap:
root@VG2:~# tcpdump -i eth0 -w /home/dump.pcap
ืื ื ืืชืืื ืืขืฉืืช ืคืื ื ืืื ืืืฉืงื GRE:
root@VG1:~# ping 1.1.1.2 -c 4
PING 1.1.1.2 (1.1.1.2) 56(84) bytes of data.
64 bytes from 1.1.1.2: icmp_seq=1 ttl=64 time=0.918 ms
64 bytes from 1.1.1.2: icmp_seq=2 ttl=64 time=0.850 ms
64 bytes from 1.1.1.2: icmp_seq=3 ttl=64 time=0.918 ms
64 bytes from 1.1.1.2: icmp_seq=4 ttl=64 time=0.974 ms
--- 1.1.1.2 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3006ms
rtt min/avg/max/mdev = 0.850/0.915/0.974/0.043 ms
ืื ืืจืช GRE ืคืืขืืช:
ืฉืื 3. ืืฆืคืื ืขื GOST GRE
ืื ื ืงืืืข ืืช ืกืื ืืืืืื - ืืคื ืืชืืืช. ืืืืืช ืขื ืืคืชื ืืืืืจ ืืจืืฉ (ืขื ืคื ืชื ืื ืืฉืืืืฉ, ืืฉ ืืืฉืชืืฉ ืืชืขืืืืช ืืืืืืืืืช):
VG1(config)#
crypto isakmp identity address
crypto isakmp key KEY address 172.16.1.254
ืืืืจืชื ืืช ืืคืจืืืจืื ืฉื IPsec Phase I:
VG1(config)#
crypto isakmp policy 1
encr gost
hash gost3411-256-tc26
auth pre-share
group vko2
ืืืืจืชื ืืช ืืคืจืืืจืื ืฉื IPsec Phase II:
VG1(config)#
crypto ipsec transform-set TSET esp-gost28147-4m-imit
mode tunnel
ืื ื ืืืฆืจ ืจืฉืืืช ืืืฉื ืืืฆืคื ื. ืชื ืืขื ืืืืงืืช - GRE:
VG1(config)#
ip access-list extended LIST
permit gre host 172.16.1.253 host 172.16.1.254
ืื ื ืืืฆืจ ืืคืช ืงืจืืคืื ืืืงืฉืจ ืืืชื ืืืืฉืง ื-WAN:
VG1(config)#
crypto map CMAP 1 ipsec-isakmp
match address LIST
set transform-set TSET
set peer 172.16.1.253
interface fa0/0
crypto map CMAP
ืขืืืจ VG2, ืืชืฆืืจื ืืื ืฉืืงืืฃ, ืืืืืืื ืื:
VG2(config)#
crypto isakmp key KEY address 172.16.1.253
ip access-list extended LIST
permit gre host 172.16.1.254 host 172.16.1.253
crypto map CMAP 1 ipsec-isakmp
set peer 172.16.1.254
ืืืืง:
root@VG2:~# tcpdump -i eth0 -w /home/dump2.pcap
root@VG1:~# ping 1.1.1.2 -c 4
PING 1.1.1.2 (1.1.1.2) 56(84) bytes of data.
64 bytes from 1.1.1.2: icmp_seq=1 ttl=64 time=1128 ms
64 bytes from 1.1.1.2: icmp_seq=2 ttl=64 time=126 ms
64 bytes from 1.1.1.2: icmp_seq=3 ttl=64 time=1.07 ms
64 bytes from 1.1.1.2: icmp_seq=4 ttl=64 time=1.12 ms
--- 1.1.1.2 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3006ms
rtt min/avg/max/mdev = 1.077/314.271/1128.419/472.826 ms, pipe 2
ืกืืืืกืืืงืืช ISAKMP/IPsec:
root@VG1:~# sa_mgr show
ISAKMP sessions: 0 initiated, 0 responded
ISAKMP connections:
Num Conn-id (Local Addr,Port)-(Remote Addr,Port) State Sent Rcvd
1 1 (172.16.1.253,500)-(172.16.1.254,500) active 1086 1014
IPsec connections:
Num Conn-id (Local Addr,Port)-(Remote Addr,Port) Protocol Action Type Sent Rcvd
1 1 (172.16.1.253,*)-(172.16.1.254,*) 47 ESP tunn 480 480
ืืื ืื ืืช ืืืืืื ืฉื ืืชืขืืืจื ืฉื GRE:
ืืกืงื ื: ืขืจืืช GRE-over-IPsec ืคืืขืืช ืืืืื.
ืืืืจ 1.5: IPsec-over-GRE
ืื ื ืื ืืชืื ื ืืืฉืชืืฉ ื-IPsec-over-GRE ืืจืฉืช. ืื ื ืืืกืฃ ืื ืื ื ืจืืฆื.
ืืื ืืคืจืืก ืืช ืขืจืืช GRE-over-IPsec ืืืืคื:
- ืชืงื ืจืฉืืืช ืืืฉื ืืืฆืคื ื - ืชืขืืืจื ืืืืงืืช ื-LAN1 ื-LAN2 ืืืืืคื;
- ืืืืจ ื ืืชืื ืืจื GRE;
- ืชืื ืืคืช ืงืจืืคืื ืืืืฉืง GRE.
ืืืจืืจืช ืืืื, ืืื ืืืฉืง GRE ืืงืื ืกืืืช ืืฉืขืจ ืืืื Cisco. ืื ืงืืื ืจืง ืืืขืจืืช ืืืคืขืื.
ืื ื ืืืกืืฃ ืืช ืืืฉืง GRE ืืงืื ืกืืื ืืืืืืช ืกืืกืงื. ืืื ืืขืฉืืช ืืืช, ืื ื ืขืืจื ืืช ืืงืืืฅ /etc/ifaliases.cf:
interface (name="FastEthernet0/0" pattern="eth0")
interface (name="FastEthernet0/1" pattern="eth1")
interface (name="FastEthernet0/2" pattern="eth2")
interface (name="FastEthernet0/3" pattern="eth3")
interface (name="Tunnel0" pattern="gre1")
interface (name="default" pattern="*")
ืืืฉืจ gre1 ืืื ืืืขืื ืืืืฉืง ืืืขืจืืช ืืืคืขืื, Tunnel0 ืืื ืืืขืื ืืืืฉืง ืืงืื ืกืืื ืืืืืืช ืกืืกืงื.
ืื ื ืืืฉื ืืืืฉ ืืช ื-hash ืฉื ืืงืืืฅ:
root@VG1:~# integr_mgr calc -f /etc/ifaliases.cf
SUCCESS: Operation was successful.
ืืขืช ืืืืฉืง Tunnel0 ืืืคืืข ืืงืื ืกืืื ืืืืืืช ืกืืกืงื:
VG1# show run
interface Tunnel0
ip address 1.1.1.1 255.255.255.252
mtu 1400
ืชืืงืื ืจืฉืืืช ืืืืฉื ืืืฆืคื ื:
VG1(config)#
ip access-list extended LIST
permit ip 192.168.1.0 0.0.0.255 192.168.3.0 0.0.0.255
ืื ื ืืืืืจ ื ืืชืื ืืจื GRE:
VG1(config)#
no ip route 0.0.0.0 0.0.0.0 172.16.1.254
ip route 192.168.3.0 255.255.255.0 1.1.1.2
ืื ื ืืกืืจ ืืช ื-cryptomap ื-Fa0 / 0 ืืืงืฉืจ ืืืชื ืืืืฉืง GRE:
VG1(config)#
interface Tunnel0
crypto map CMAP
ืขืืืจ VG2 ืื ืืืื.
ืืืืง:
root@VG2:~# tcpdump -i eth0 -w /home/dump3.pcap
root@VG1:~# ping 192.168.2.254 -I 192.168.1.253 -c 4
PING 192.168.2.254 (192.168.2.254) from 192.168.1.253 : 56(84) bytes of data.
64 bytes from 192.168.2.254: icmp_seq=1 ttl=64 time=492 ms
64 bytes from 192.168.2.254: icmp_seq=2 ttl=64 time=1.08 ms
64 bytes from 192.168.2.254: icmp_seq=3 ttl=64 time=1.06 ms
64 bytes from 192.168.2.254: icmp_seq=4 ttl=64 time=1.07 ms
--- 192.168.2.254 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3006ms
rtt min/avg/max/mdev = 1.064/124.048/492.972/212.998 ms
ืกืืืืกืืืงืืช ISAKMP/IPsec:
root@VG1:~# sa_mgr show
ISAKMP sessions: 0 initiated, 0 responded
ISAKMP connections:
Num Conn-id (Local Addr,Port)-(Remote Addr,Port) State Sent Rcvd
1 2 (172.16.1.253,500)-(172.16.1.254,500) active 1094 1022
IPsec connections:
Num Conn-id (Local Addr,Port)-(Remote Addr,Port) Protocol Action Type Sent Rcvd
1 2 (192.168.1.0-192.168.1.255,*)-(192.168.2.0-192.168.2.255,*) * ESP tunn 352 352
ืืืืืื ืฉื ืชืขืืืจืช ESP, ืืืืืืืช ืืืืืขืืช ื-GRE:
ืืกืงื ื: IPsec-over-GRE ืคืืขื ืืืืื.
ืชืืฆืืืช ืฉื
ืืืก ืงืคื ืืืช ืืกืคืืงื. ืฉืจืืืชื ืืืจืืืช ืืืฉืืช ืืจืกืช ืืืืื. ืืืืืจ GRE-over-IPsec ืืคืจืืกื ืืืืคื.
ืืคืช ืืืฉืงื ืืจืฉืช ืืืจืกื 4.3 ืืื ืืืืืืืืช! ืื ื ืืืืง ืขืื.
ืืื ืืก ืื ืื ืืื
t.me/anonymous_engineer
ืืงืืจ: www.habr.com