Solaris10이 포함된 IPsec 터널..내가 무엇을 놓치고 있나요?

Solaris10이 포함된 IPsec 터널..내가 무엇을 놓치고 있나요?

IPsec으로 암호화된 두 개의 Solaris10 터널을 만들고 싶습니다. 구성은 매우 간단합니다. 2개의 Solaris10 노드, LAN은 암호화되지 않고 터널은 암호화됩니다. Lan은 e1000g0, Tunnel은 ip.tun0 Node 1의 "Clear" IP는 192.168.0.21 Node 2의 "Clear" IP는 192.168.0.199 이 과정을 수행합니다.

a) 두 노드 모두에서 IPv4 전달 및 라우팅을 활성화합니다.

routeadm -u -e ipv4-routing
routeadm -u -e ipv4-forwarding

b) 두 노드 모두에서 /etc/inet/ike/config를 편집합니다.

p1_xform
  { auth_method preshared oakley_group 5 auth_alg sha encr_alg 3des }
p2_pfs 2

c) 물론 역방향 로컬/원격을 사용하여 두 노드에서 /etc/inet/secret/ike.preshared를 편집합니다.

{ localidtype IP
    localid 192.168.0.21
    remoteidtype IP
    remoteid 192.168.0.119
  }

d) 두 노드 모두에서 IKE를 활성화하고 svcs가 작동하는지 확인합니다.

svcadm enable ike
svcs ike

e) /etc/inet/ipsecinit.conf 파일을 편집합니다.

# LAN traffic to and from this host can bypass IPsec.
{laddr 192.168.0.0 dir both} bypass {}

# WAN traffic uses ESP with AES and SHA-1.
{tunnel ip.tun0 negotiate tunnel}
 ipsec {encr_algs aes encr_auth_algs sha1 sa shared}

f) 새로 고침..

svcadm refresh ipsec/policy

g) 모든 것이 괜찮아 보여서 터널을 만들었습니다.

svcs -a|grep -i ipsec
disabled        9:35:34 svc:/network/ipsec/manual-key:default
online          9:35:53 svc:/network/ipsec/ipsecalgs:default
online          9:35:53 svc:/network/ipsec/ike:default
online          9:54:38 svc:/network/ipsec/policy:default

호스트 A에서

ifconfig ip.tun0 plumb
ifconfig ip.tun0 192.168.192.24 192.168.192.40 tsrc 192.168.0.21 tdst 192.168.0.199 router up

호스트 B에서

ifconfig ip.tun0 plumb
ifconfig ip.tun0 192.168.192.40 192.168.192.24 tsrc 192.168.0.199 tdst 192.168.0.21 router up

모든 것이 괜찮아 보이지만 .. 작동하지 않습니다.

HostA는 HostB를 핑할 수 있습니다.

ping 192.168.0.199
192.168.0.199 is alive

HostB는 HostA에 ping을 보낼 수 있습니다.

ping 192.168.0.2
192.168.0.2 is alive

하지만 터널에 ping을 실행하면...

호스트 A에서 호스트 B로

ping -s 192.168.192.40
PING 192.168.192.40: 56 data bytes
----192.168.192.40 PING Statistics----
25 packets transmitted, 0 packets received, 100% packet loss

호스트 B에서 호스트 A로

ping -s 192.168.192.24
PING 192.168.192.24: 56 data bytes
----192.168.192.24 PING Statistics----
25 packets transmitted, 0 packets received, 100% packet loss

HostA에서 netstat -rn은 다음과 같이 말합니다.

netstat -rn
Routing Table: IPv4
  Destination           Gateway           Flags  Ref     Use     Interface 
-------------------- -------------------- ----- ----- ---------- --------- 
default              192.168.0.1          UG        1          1           
192.168.0.0          192.168.0.21         U         1          3 e1000g0   
192.168.192.40       192.168.192.24       UH        1          0 ip.tun0   
224.0.0.0            192.168.0.21         U         1          0 e1000g0   
127.0.0.1            127.0.0.1            UH        1         48 lo0   

HostB에서 netstat -rn은 다음과 같이 말합니다.

Routing Table: IPv4
  Destination           Gateway           Flags  Ref     Use     Interface 
-------------------- -------------------- ----- ----- ---------- --------- 
default              192.168.0.1          UG        1          2 e1000g0   
192.168.0.0          192.168.0.199        U         1          7 e1000g0   
192.168.192.24       192.168.192.40       UH        1          1 ip.tun0   
127.0.0.1            127.0.0.1            UH        3        122 lo0 

내가 놓친 게 무엇입니까? 두 노드 모두에서 방화벽이 비활성화되어 있습니다.

답변1

발견된 솔루션 버그는 많은 conf의 구문에 있습니다. 파일은 먼저 파일이다

/etc/inet/ike.preshared

반드시 사용해야 하며, 사용된 IP는 "기본" 인터페이스의 IP가 아닌 터널의 IP여야 합니다.

# ike.preshared on hostA
#…
{ localidtype IP
    localid 10.4.0.1
    remoteidtype IP
    remoteid 10.4.0.2
    key keyinhexformat
    # The preshared key can also be represented in hex
# as in 0xf47cb0f432e14480951095f82b
# key "This is an ASCII Cqret phrAz, use str0ng p@ssword tekniques"
}

16진수 키를 생성하려면 다음 명령을 사용하세요.

echo "mypassword" | od -t x1|head -1|tr -d ' '

문서

/etc/inet/ike/config

이와 유사해야 합니다. 이 경우에도 기본 인터페이스의 IP가 아닌 터널의 IP를 사용합니다.

p1_xform
  { auth_method preshared oakley_group 5 auth_alg sha encr_alg 3des }
p2_pfs 2
{ label "test1-test2" local_addr 10.4.0.1 remote_addr 10.4.0.2 p1_xform { auth_method preshared oakley_group 5 auth_alg sha256 encr_alg aes } p2_pfs 5 }

물론, HostB에서는 두 파일 모두 10.4.0.1에서 10.4.0.2로 역순으로 이루어져야 합니다.

마지막으로 /etc/inet/ipsecinit.conf 파일을 편집합니다.

{laddr 192.168.0.21 dir both} bypass {}
{laddr 10.4.0.1 raddr 10.4.0.2} ipsec {encr_algs aes encr_auth_algs sha256 sa shared}

물론 10.4.0.1은 호스트B에서 10.4.0.2로 바꿔야 하고, 192.168.0.21은 호스트B의 호스트 마스터 IP로 바꿔야 한다.

이제 호스트A에서 스크립트를 실행하세요.

ifconfig ip.tun0 unplumb
ifconfig ip.tun0 plumb
ifconfig ip.tun0 10.4.0.1  10.4.0.2 netmask 255.255.255.0 tsrc 192.168.0.21 tdst 192.168.0.199 router up
for i in ike ipsec/policy;do svcadm refresh $i; done

이제 HostB에서 스크립트를 실행하십시오.

ifconfig ip.tun0 unplumb
    ifconfig ip.tun0 plumb
    ifconfig ip.tun0 10.4.0.2  10.4.0.1 netmask 255.255.255.0 tsrc 192.168.0.199 tdst 192.168.0.21 router up
    for i in ike ipsec/policy;do svcadm refresh $i; done

모든 것이 괜찮습니다. ping과 snoop로 테스트해 보세요.

관련 정보