์ํฉ
C-Terra VPN ์ ํ ๋ฒ์ 4.3์ ๋ฐ๋ชจ ๋ฒ์ ์ XNUMX๊ฐ์ ๋์ ๋ฐ์์ต๋๋ค. ์ ๋ฒ์ ์ผ๋ก ์ ํํ ํ ์์ง๋์ด๋ง ์ํ์ด ๋ ์ฌ์์ก๋์ง ์๊ณ ์ถ์ต๋๋ค.
์ค๋์ ์ด๋ ต์ง ์์ต๋๋ค. ์ธ์คํดํธ ์ปคํผ 3 in 1 ํ ๋ด์ง๋ฉด ์ถฉ๋ถํฉ๋๋ค. ๋ฐ๋ชจ๋ฅผ ๋ฐ๋ ๋ฐฉ๋ฒ์ ์๋ ค๋๋ฆฌ๊ฒ ์ต๋๋ค. GRE-over-IPsec ๋ฐ IPsec-over-GRE ์ฒด๊ณ๋ฅผ ๊ตฌ์ถํ๋ ค๊ณ ํฉ๋๋ค.
๋ฐ๋ชจ๋ฅผ ๋ฐ๋ ๋ฐฉ๋ฒ
๋ฐ๋ชจ๋ฅผ ๋ฐ์ผ๋ ค๋ฉด ๋ค์์ ์ํํด์ผ ํฉ๋๋ค.
- ํธ์ง ์ฐ๊ธฐ [์ด๋ฉ์ผ ๋ณดํธ] ํ์ฌ ์ฃผ์์์;
- ํธ์ง์ ์กฐ์ง์ TIN์ ํ์ํ์ญ์์ค.
- ์ ํ๊ณผ ์๋์ ๋์ดํ์ญ์์ค.
๋ฐ๋ชจ๋ XNUMX๊ฐ์ ๋์ ์ ํจํฉ๋๋ค. ๋ฒค๋๋ ๊ธฐ๋ฅ์ ์ ํํ์ง ์์ต๋๋ค.
์ด๋ฏธ์ง ํ์ฅ
Security Gateway ๋ฐ๋ชจ๋ ๊ฐ์ ๋จธ์ ์ด๋ฏธ์ง์ ๋๋ค. VM์จ์ด ์ํฌ์คํ ์ด์ ์ ์ฌ์ฉํ๊ณ ์์ต๋๋ค. ์ง์๋๋ ํ์ดํผ๋ฐ์ด์ ๋ฐ ๊ฐ์ํ ํ๊ฒฝ์ ์ ์ฒด ๋ชฉ๋ก์ ๊ณต๊ธ์ ์ฒด ์น ์ฌ์ดํธ์์ ํ์ธํ ์ ์์ต๋๋ค.
์์ํ๊ธฐ ์ ์ ๊ธฐ๋ณธ ๊ฐ์ ๋จธ์ ์ด๋ฏธ์ง์ ๋คํธ์ํฌ ์ธํฐํ์ด์ค๊ฐ ์๋ค๋ ์ ์ ์ ์ํ์ญ์์ค.
๋
ผ๋ฆฌ๋ ๋ช
ํํฉ๋๋ค. ์ฌ์ฉ์๋ ํ์ํ ๋งํผ ์ธํฐํ์ด์ค๋ฅผ ์ถ๊ฐํด์ผ ํฉ๋๋ค. ํ ๋ฒ์ XNUMX๊ฐ๋ฅผ ์ถ๊ฐํ๊ฒ ์ต๋๋ค.
์ด์ ๊ฐ์ ๋จธ์ ์ ์์ํฉ๋๋ค. ์คํ ์งํ ๊ฒ์ดํธ์จ์ด์๋ ์ฌ์ฉ์ ์ด๋ฆ๊ณผ ์ํธ๊ฐ ํ์ํฉ๋๋ค.
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) ๋ฐ Cisco ์ ์ฌ ์ฝ์(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๋ฅผ ์ค์ ํ๋ ์๋ฅผ ๋ค์์ต๋๋ค. ๋ด์ฉ์ด ์๋ /etc/network/interfaces.d ๋๋ ํ ๋ฆฌ์ gre1 ํ์ผ์ ๋ง๋ญ๋๋ค.
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 ๊ฒ์ดํธ์จ์ด์๋ ํจํท ์ค๋ํผ(tcpdump)๊ฐ ๋ด์ฅ๋์ด ์์ต๋๋ค. pcap ํ์ผ์ ํธ๋ํฝ ๋คํ๋ฅผ ์์ฑํฉ๋๋ค.
root@VG2:~# tcpdump -i eth0 -w /home/dump.pcap
GRE ์ธํฐํ์ด์ค ๊ฐ์ ping์ ์์ํฉ๋๋ค.
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 ์ธํฐํ์ด์ค์ cryptomap์ ๊ฑธ์ด๋ก๋๋ค.
๊ธฐ๋ณธ์ ์ผ๋ก Cisco์ ์ ์ฌํ ๊ฒ์ดํธ์จ์ด ์ฝ์์๋ 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์ Cisco์ ๊ฐ์ ์ฝ์์ ์ธํฐํ์ด์ค ์ง์ ์ ๋๋ค.
ํ์ผ์ ํด์๋ฅผ ๋ค์ ๊ณ์ฐํฉ๋๋ค.
root@VG1:~# integr_mgr calc -f /etc/ifaliases.cf
SUCCESS: Operation was successful.
์ด์ Tunnel0 ์ธํฐํ์ด์ค๊ฐ Cisco์ ๊ฐ์ ์ฝ์์ ๋ํ๋ฌ์ต๋๋ค.
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
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
์ถ์ฒ : habr.com