맛집 여행 캠핑 일상 생활

[CentOS] 8.x OpenVPN 서버 설치 방법 본문

IT이야기

[CentOS] 8.x OpenVPN 서버 설치 방법

영은파더♥ 2023. 3. 15. 13:43

OpenVPN 서버 설치를 쉽게하도록 고맙게도 스크립트 방식으로 만들어 놓았네요~
CentOS 7.x 8.x 버전 둘다 엄청 편하게 설치가 가능합니다.
크롬브라우저 확장프로그램에서 사용하는 TouchVPN 같은것을 이용해도 되겠지만 아무래도 사용하기가 꺼려집니다.
그래서 Custom VPN 서버를 구축해 개인만 사용하도록 설치해 보도록 합니다.

1. epel-release 설치
# dnf install epel-release

2. 공인 IP 알아내기
# curl ifconfig.me
    자신의 서버 IP는 아시겠지만 클라우드 VPS 는 ifconfig 명령어로는 내부아이피 밖에 알 수 없기에 이런방식으로 알아낼 수 있습니다.

3. OpenVPN 설치 스크립트 다운로드 및 실행
# wget https://raw.githubusercontent.com/Angristan/openvpn-install/master/openvpn-install.sh
# chmod +x openvpn-install.sh
# ./openvpn-install.sh

[root@itrooms ~]# ./openvpn-install.sh
Welcome to the OpenVPN installer!
The git repository is available at: https://github.com/angristan/openvpn-install

I need to ask you a few questions before starting the setup.
You can leave the default options and just press enter if you are ok with them.

I need to know the IPv4 address of the network interface you want OpenVPN listening to.
Unless your server is behind NAT, it should be your public IPv4 address.
IP address: AAA.BBB.CCC.DDD (외부 공인아이피를 입력합니다.)

Checking for IPv6 connectivity...

Your host does not appear to have IPv6 connectivity.

Do you want to enable IPv6 support (NAT)? [y/n]: n

What port do you want OpenVPN to listen to?
   1) Default: 1194
   2) Custom
   3) Random [49152-65535]
Port choice [1-3]: 1 (디폴트 1194 포트 외에 다른 포트를 사용하셔도 됩니다.)

What protocol do you want OpenVPN to use?
UDP is faster. Unless it is not available, you shouldn't use TCP.
   1) UDP
   2) TCP
Protocol [1-2]: 1

What DNS resolvers do you want to use with the VPN?
   1) Current system resolvers (from /etc/resolv.conf)
   2) Self-hosted DNS Resolver (Unbound)
   3) Cloudflare (Anycast: worldwide)
   4) Quad9 (Anycast: worldwide)
   5) Quad9 uncensored (Anycast: worldwide)
   6) FDN (France)
   7) DNS.WATCH (Germany)
   8) OpenDNS (Anycast: worldwide)
   9) Google (Anycast: worldwide)
   10) Yandex Basic (Russia)
   11) AdGuard DNS (Anycast: worldwide)
   12) NextDNS (Anycast: worldwide)
   13) Custom
DNS [1-12]: 11

Do you want to use compression? It is not recommended since the VORACLE attack makes use of it.
Enable compression? [y/n]: n

Do you want to customize encryption settings?
Unless you know what you're doing, you should stick with the default parameters provided by the script.
Note that whatever you choose, all the choices presented in the script are safe. (Unlike OpenVPN's defaults)
See https://github.com/angristan/openvpn-install#security-and-encryption to learn more.

Customize encryption settings? [y/n]: n

Okay, that was all I needed. We are ready to setup your OpenVPN server now.
You will be able to generate a client at the end of the installation.
Press any key to continue...

중략...

Tell me a name for the client.
The name must consist of alphanumeric character. It may also include an underscore or a dash.
Client name: custom-vpn

Do you want to protect the configuration file with a password?
(e.g. encrypt the private key with a password)
   1) Add a passwordless client
   2) Use a password for the client
Select an option [1-2]: 2 (1번을 선택하셔도 되지만 아무래도 비밀번호가 있는게 좋을것 같습니다.)

중략...

Client custom-vpn added.

The configuration file has been written to /home/opc/custom-vpn.ovpn.
Download the .ovpn file and import it in your OpenVPN client.

여기까지 서버 설치는 완료입니다.

위에서 만들어진 .ovpn 파일을 다운로드 받아서 사용하시면 됩니다.

그리고 방화벽 설정이 필요한데 이 부분은 다음 글(https://itrooms.tistory.com/1041)에서 작성하도록 하겠습니다.

 

Trackback : | Comments :