
서버에 OpenVPN을 설정하려고 하는데 작동하지 않습니다. 기본 포트를 변경했지만(주로 가능한 VPN 차단을 우회하기 위해) 서버에 연결할 수 없습니다.
openvpnas@ip-xxx-xx-xx-xx:~$ sudo netstat -uapn | grep openvpn
udp 0 0 0.0.0.0:1190 0.0.0.0:* 1455/openvpn-openss
또 다른 출력
openvpnas@ip-xxx-xx-xx-xx:~$ netstat -atnp
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:904 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:905 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:906 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:907 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:908 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:909 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:943 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 172.31.42.30:22 xx.xx.xxx.xx:52882 ESTABLISHED -
tcp 0 0 127.0.0.1:42390 127.0.0.1:908 TIME_WAIT -
tcp 0 150 xxx.xx.xx.xx:34884 xxx.xxx.xx.xx:443 ESTABLISHED -
tcp6 0 0 :::22 :::* LISTEN -
내 로컬 컴퓨터에서 연결 시간이 초과되었습니다.
(base) ➜ dir nc -v x.xx.xx.xx 1190
nc: connect to x.xx.xx.xx port 1190 (tcp) failed: Connection timed out
이 문제를 해결하기 위해 다음 명령을 실행해 보았으나 소용이 없었습니다.
sudo iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 1190 -j ACCEPT
Linux에서 OpenVPN 클라이언트에 연결할 때 다음을 얻습니다.
2022-06-13 17:49:00 WARNING: --ns-cert-type is DEPRECATED. Use --remote-cert-tls instead.
2022-06-13 17:49:00 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
2022-06-13 17:49:00 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
2022-06-13 17:49:00 TCP/UDP: Preserving recently used remote address: [AF_INET]x.xx.xx.xx:1190
2022-06-13 17:49:00 Socket Buffers: R=[212992->212992] S=[212992->212992]
2022-06-13 17:49:00 UDP link local: (not bound)
2022-06-13 17:49:00 UDP link remote: [AF_INET]x.xx.xx.xx:1190
2022-06-13 17:49:04 Server poll timeout, restarting
2022-06-13 17:49:04 SIGUSR1[soft,server_poll] received, process restarting
2022-06-13 17:49:04 WARNING: --ns-cert-type is DEPRECATED. Use --remote-cert-tls instead.
2022-06-13 17:49:04 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
2022-06-13 17:49:04 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
2022-06-13 17:49:04 TCP/UDP: Preserving recently used remote address: [AF_INET]x.xx.xx.xx:1190
2022-06-13 17:49:04 Socket Buffers: R=[212992->212992] S=[212992->212992]
2022-06-13 17:49:04 UDP link local: (not bound)
2022-06-13 17:49:04 UDP link remote: [AF_INET]x.xx.xx.xx:1190
문제 해결 및 수정에 대한 도움을 주시면 감사하겠습니다.
답변1
여기에는 몇 가지가 있습니다.
- 게시물의 첫 번째 코드 블록은 UDP를 수신하는 OpenVPN을 보여줍니다.
- 두 번째 코드 블록은 TCP를 보여줍니다.
nc
UDP 포트 1190이 아닌 TCP 포트 1190에 연결을 시도합니다.- 규칙
iptables
에 다시 TCP가 표시됩니다. UDP가 아닙니다.
기본적으로 OpenVPN은 UDP를 사용합니다.좋은 이유로.
UDP는 또한 TCP처럼 쉽게 연결을 확인할 수 없다는 것을 의미합니다. 방화벽이 자동으로 패킷을 삭제하는 것과 서비스가 알 수 없는 입력을 자동으로 삭제하는 것의 차이점을 말하기는 어렵습니다.
NC가 아닌 OpenVPN 클라이언트로 테스트하세요. TCP와 UDP의 문제를 해결하세요.