• 카테고리

    질문 & 답변
  • 세부 분야

    데브옵스 · 인프라

  • 해결 여부

    미해결

VPN터널이 Up되지 않습니다.

22.07.31 15:51 작성 조회수 416

0

안녕하세요. 실습중에 막힌 부분이 있어서 하나 질문드립니다.
도쿄리젼의 EC2에 openswan설치, 설정후 network와 ipsec을 restart해도 터널이 기동하지 않습니다.
 
서울 리젼의 Customer Gateway를 만들때 라우팅을 static으로 지정하지 못한 부분(UI가 변경되었을것으로 추측) 이외에는 똑같이 설정하였습니다.
 
AWS쪽의 방화벽 설정 도쿄 서울 vpc와 ec2의 acl과 security group의 설정상 열려 있는걸 확인했고, 아래 파일들의 내용에 입력미스가 없는걸 확인했습니다.
/etc/sysctl.conf
/etc/ipsec.d/aws.conf
/etc/ipsec.conf
/etc/ipsec.d/aws.secrets
 
새로운 AWS계정으로 처음부터 강의를 다시보고 실습해보아도 똑같은 상황이 발생 했습니다. tcpdump로 도쿄EC2에 흐르는 패킷을 확인해보니 터널쪽 ip와 전혀 소통이 없어서 openswan이 제대로 동작되지 않는것 같습니다. 이 문제를 해결하지 못해 질문 남겨봅니다.
 

[root@ip-10-4-1-112 log]# service ipsec status
Redirecting to /bin/systemctl status ipsec.service
● ipsec.service - Internet Key Exchange (IKE) Protocol Daemon for IPsec
   Loaded: loaded (/usr/lib/systemd/system/ipsec.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2022-07-31 06:39:52 UTC; 2s ago
     Docs: man:ipsec(8)
           man:pluto(8)
           man:ipsec.conf(5)
  Process: 7837 ExecStopPost=/usr/sbin/ipsec --stopnflog (code=exited, status=0/SUCCESS)
  Process: 7834 ExecStopPost=/sbin/ip xfrm state flush (code=exited, status=0/SUCCESS)
  Process: 7832 ExecStopPost=/sbin/ip xfrm policy flush (code=exited, status=0/SUCCESS)
  Process: 7830 ExecStop=/usr/libexec/ipsec/whack --shutdown (code=exited, status=0/SUCCESS)
  Process: 8092 ExecStartPre=/usr/sbin/ipsec --checknflog (code=exited, status=0/SUCCESS)
  Process: 8089 ExecStartPre=/usr/sbin/ipsec --checknss (code=exited, status=0/SUCCESS)
  Process: 7849 ExecStartPre=/usr/libexec/ipsec/_stackmanager start (code=exited, status=0/SUCCESS)
  Process: 7845 ExecStartPre=/usr/libexec/ipsec/addconn --config /etc/ipsec.conf --checkconfig (code=exited, status=0/SUCCESS)
 Main PID: 8105 (pluto)
   Status: "Startup completed."
   CGroup: /system.slice/ipsec.service
           └─8105 /usr/libexec/ipsec/pluto --leak-detective --config /etc/ipsec.conf --nofork

Jul 31 06:39:52 ip-10-4-1-112.ap-northeast-1.compute.internal pluto[8105]: adding interface lo/lo ::1:500
Jul 31 06:39:52 ip-10-4-1-112.ap-northeast-1.compute.internal pluto[8105]: | setup callback for interface lo:500 fd 19
Jul 31 06:39:52 ip-10-4-1-112.ap-northeast-1.compute.internal pluto[8105]: | setup callback for interface lo:4500 fd 18
Jul 31 06:39:52 ip-10-4-1-112.ap-northeast-1.compute.internal pluto[8105]: | setup callback for interface lo:500 fd 17
Jul 31 06:39:52 ip-10-4-1-112.ap-northeast-1.compute.internal pluto[8105]: | setup callback for interface eth0:4500 fd 16
Jul 31 06:39:52 ip-10-4-1-112.ap-northeast-1.compute.internal pluto[8105]: | setup callback for interface eth0:500 fd 15
Jul 31 06:39:52 ip-10-4-1-112.ap-northeast-1.compute.internal pluto[8105]: loading secrets from "/etc/ipsec.secrets"
Jul 31 06:39:52 ip-10-4-1-112.ap-northeast-1.compute.internal pluto[8105]: loading secrets from "/etc/ipsec.d/aws.secrets"
Jul 31 06:39:52 ip-10-4-1-112.ap-northeast-1.compute.internal pluto[8105]: initiating all conns with alias='Tunnel1'
Jul 31 06:39:52 ip-10-4-1-112.ap-northeast-1.compute.internal pluto[8105]: initiating all conns with alias='Tunnel2'

답변 1

답변을 작성해보세요.

0

문제가 해결되어 공유드립니다.

/etc/ipsec.conf에서 pluto 디버그 모드를 실행하고 /var/log/openswan.log를 확인하니 아래와 같은 로그가 있었습니다.

Error: Failed to add connection "Tunnel1", esp="aes128-sha1;modp1024" is invalid: ESP encryption algorithm 'aes' is not supported.

위 로그를 검색해보니 유사한 사례가 있어서서 /etc/ipsec.d/aws.conf 의 phase2alg를 아래와 같이 수정하니 정상적으로 터널이 연결 되었습니다.

phase2alg=aes_gcm

안녕하세요 안데스라마님,

 

동일한 방법으로 phase2alg를 수정하여 문제를 해결하였는데, 해결 방법을 먼저 공유해주셔서 대단히 감사드립니다. :)

 

aws와 openswan이 업데이트 되는 과정에서 발생한 문제로 추측되는데 자세한 내용을 찾게 되면 이 답변에 이어서 공유드리겠습니다.