状況
C-Terra VPN 製品バージョン 4.3 のデモ版を XNUMX か月間受け取りました。 新しいバージョンに切り替えた後、エンジニアリング作業が楽になるかどうかを知りたいです。
今日は難しくなく、インスタントコーヒー3in1袋で十分です。 デモの入手方法を説明します。 GRE-over-IPsec スキームと IPsec-over-GRE スキームを構築してみます。
デモの入手方法
この図から、デモを取得するには次のことが必要であることがわかります。
- に手紙を書く [メール保護] 企業住所から。
- 手紙には、組織の TIN を明記してください。
- 製品とその数量をリストします。
デモの有効期限は XNUMX か月間です。 ベンダーは機能を制限しません。
イメージを広げる
Security Gateway のデモは仮想マシン イメージです。 VMWare ワークステーションを使用しています。 サポートされているハイパーバイザーと仮想化環境の完全なリストは、ベンダーの Web サイトで入手できます。
始める前に、デフォルトの仮想マシン イメージにはネットワーク インターフェイスが存在しないことに注意してください。
ロジックは明確で、ユーザーは必要なだけインターフェイスを追加する必要があります。 一度に 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
XNUMX つの仮想ゲートウェイをデプロイし、図に示すように切り替えます。
ステップ 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 フェーズ I パラメータを設定します。
VG1(config)#
crypto isakmp policy 1
encr gost
hash gost3411-256-tc26
auth pre-share
group vko2
IPsec フェーズ 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 インターフェイスにクリプトマップをハングします。
デフォルトでは、Cisco のようなゲートウェイ コンソールには GRE インターフェイスはありません。 これはオペレーティング システム内にのみ存在します。
GRE インターフェイスを Cisco のようなコンソールに追加します。 これを行うには、/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