
AWS에서 Pritunl을 사용하여 OpenVPN 서버를 설정하려고 하는데 VPN을 통해 AWS 노드를 VPC 외부 노드에 연결하는 데 문제가 있습니다.
기본적으로 내 설정은
[ AWS Instance ] -- [ AWS OpenVpn Instance ] -- [ Local OS X Machine ]
현재 OS X 시스템에서 발생하는 트래픽은 정상적으로 작동합니다. VPC 뒤에 있는 모든 인스턴스를 ping할 수 있습니다. 그러나 로컬 OS X 컴퓨터에 ping을 시도하거나 더 정확하게는 해당 컴퓨터에서 실행 중인 서버에 액세스하려고 하면 연결이 중단됩니다.
AWS 노드는 172.31.0.0/16 서브넷에 있고 OS X 시스템은 192.168.241.0/24 서브넷에 있습니다. OpenVpn 인스턴스 시스템에서 ping은 정상적으로 작동합니다.
ubuntu@ip-172-31-11-153:~$ ping 192.168.241.2
PING 192.168.241.2 (192.168.241.2) 56(84) bytes of data.
64 bytes from 192.168.241.2: icmp_seq=1 ttl=64 time=186 ms
64 bytes from 192.168.241.2: icmp_seq=2 ttl=64 time=170 ms
AWS 인스턴스에서 ping이 중단됩니다.
ubuntu@ip-172-31-32-5:~$ ping 192.168.241.2
PING 192.168.241.2 (192.168.241.2) 56(84) bytes of data.
^C
--- 192.168.241.2 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2015ms
OpenVPN 시스템에서 tcpdump를 사용하면 패킷이 시스템에 도달하는 것을 볼 수 있지만 응답은 전송되지 않습니다.
ubuntu@ip-172-31-11-153:~$ sudo tcpdump -i any -n icmp
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes
02:04:32.706204 IP 172.31.32.5 > 192.168.241.2: ICMP echo request, id 31959, seq 1, length 64
02:04:33.705490 IP 172.31.32.5 > 192.168.241.2: ICMP echo request, id 31959, seq 2, length 64
02:04:34.705519 IP 172.31.32.5 > 192.168.241.2: ICMP echo request, id 31959, seq 3, length 64
02:04:35.705436 IP 172.31.32.5 > 192.168.241.2: ICMP echo request, id 31959, seq 4, length 64
비교를 위해 OpenVPN 시스템이 로컬 OS X 시스템을 핑할 때 발생하는 상황은 다음과 같습니다.
ubuntu@ip-172-31-11-153:~$ sudo tcpdump -i any -n icmp
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes
02:06:13.214559 IP 192.168.241.1 > 192.168.241.2: ICMP echo request, id 4169, seq 1, length 64
02:06:13.791529 IP 192.168.241.2 > 192.168.241.1: ICMP echo reply, id 4169, seq 1, length 64
02:06:14.215124 IP 192.168.241.1 > 192.168.241.2: ICMP echo request, id 4169, seq 2, length 64
02:06:14.370423 IP 192.168.241.2 > 192.168.241.1: ICMP echo reply, id 4169, seq 2, length 64
AWS 콘솔의 라우팅 테이블이 구성되었습니다( 192.168.241.0/24 -> OpenVpn Instance
).
OpenVPN 인스턴스에 IP 전달이 활성화되어 있습니다( echo 1 > /proc/sys/net/ipv4/ip_forward
).
OpenVPN 인스턴스의 소스/대상 확인이 비활성화됩니다.
시도했지만 ip route add
(11.153은 openvpn 인스턴스입니다) 오류가 반환됩니다.
ubuntu@ip-172-31-32-5:~$ sudo ip route add 192.168.241.0/24 via 172.31.11.153
RTNETLINK answers: Network is unreachable
내 IP 테이블은 다음과 같이 정의됩니다.
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere ip-172-31-0-0.us-east-2.compute.internal/16 /* pritunl-5a1f3acaf55623048c5ccaf0 */
ACCEPT all -- anywhere ip-192-168-241-0.us-east-2.compute.internal/24 /* pritunl-5a1f3acaf55623048c5ccaf0 */
DROP all -- anywhere anywhere /* pritunl-5a1f3acaf55623048c5ccaf0 */
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- ip-172-31-0-0.us-east-2.compute.internal/16 anywhere ctstate RELATED,ESTABLISHED /* pritunl-5a1f3acaf55623048c5ccaf0 */
ACCEPT all -- anywhere ip-172-31-0-0.us-east-2.compute.internal/16 /* pritunl-5a1f3acaf55623048c5ccaf0 */
ACCEPT all -- ip-192-168-241-0.us-east-2.compute.internal/24 anywhere /* pritunl-5a1f3acaf55623048c5ccaf0 */
ACCEPT all -- anywhere ip-192-168-241-0.us-east-2.compute.internal/24 /* pritunl-5a1f3acaf55623048c5ccaf0 */
DROP all -- anywhere anywhere /* pritunl-5a1f3acaf55623048c5ccaf0 */
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- ip-172-31-0-0.us-east-2.compute.internal/16 anywhere /* pritunl-5a1f3acaf55623048c5ccaf0 */
ACCEPT all -- ip-192-168-241-0.us-east-2.compute.internal/24 anywhere /* pritunl-5a1f3acaf55623048c5ccaf0 */
DROP all -- anywhere anywhere /* pritunl-5a1f3acaf55623048c5ccaf0 */
답변1
팔로잉 -https://docs.pritunl.com/v1/docs/routing-issues,
"라우팅 제한" 옵션을 선택 취소했습니다.