IT Talks/Linux

OpenVPN Server ์„ค์น˜ํ•˜๊ธฐ

OkOJJ 2022. 8. 1. 15:03

์ˆœ์„œ

  1. ๊ณต์ธ IP ํ™•์ธ
  2. openvpn-install.sh ๋‹ค์šด๋ฐ›๊ธฐ
  3. openvpn-install.sh ์‹คํ–‰ํ•ด์„œ OpenVPN ์„œ๋ฒ„ ์„ค์น˜ํ•˜๊ธฐ
  4. ๊ฐ OS ๋ณ„ Client ๋ฅผ ์ด์šฉํ•ด OpenVPN ์„œ๋ฒ„์— ์—ฐ๊ฒฐํ•˜๊ธฐ
  5. ์—ฐ๊ฒฐ ํ™•์ธ

 

1. ๊ณต์ธ IP ํ™•์ธ

์„œ๋ฒ„์— ๋”ฐ๋ผ ๊ณต์ธ IP๊ฐ€ ์ง์ ‘ ์—ฐ๊ฒฐ๋œ ๊ฒฝ์šฐ๋„ ์žˆ๊ณ , NAT ์•„๋ž˜์— ์œ„์น˜ํ•˜์—ฌ ์‚ฌ์„ค IP๋งŒ ์žˆ๋Š” ๊ฒฝ์šฐ๋„ ์žˆ์–ด ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ๋Œ€๋ถ€๋ถ„์˜ ์ผ€์ด์Šค์— ๋Œ€ํ•ด ๊ณต์ธ IP ํ™•์ธ์ด ๊ฐ€๋Šฅํ•˜๋‹ค.

$ curl ip.ojj.kr
Your IP is 121.131.xxx.xxx

 

2. openvpn-install.sh ๋‹ค์šด๋ฐ›๊ธฐ

$ wget https://git.io/vpn -O openvpn-install.sh

 

3. openvpn-install.sh ์‹คํ–‰ํ•ด์„œ OpenVPN ์„œ๋ฒ„ ์„ค์น˜ํ•˜๊ธฐ

์Šคํฌ๋ฆผํŠธ๋ฅผ ์‹คํ–‰ ๊ฐ€๋Šฅํ•˜๋„๋ก ๊ถŒํ•œ์„ ์ˆ˜์ •ํ•˜๊ณ  ์‹คํ–‰.

$ sudo chmod +x openvpn-install.sh
$ sudo ./openvpn-install.sh

์‹คํ–‰ ํ›„ ์•„๋ž˜์™€ ๋น„์Šทํ•œ ํ™”๋ฉด์ด ๋‚˜์˜ค๋ฉด ๋‹ต๋ณ€์„ ํ•˜๊ณ  ์—”ํ„ฐ

Welcome to this OpenVPN road warrior installer!
Which protocol should OpenVPN use?
1) UDP (recommended)
2) TCP
Protocol [1]: 1

What port should OpenVPN listen to?
Port [1194]:

Select a DNS server for the clients:
1) Current system resolvers
2) Google
3) 1.1.1.1
4) OpenDNS
5) Quad9
6) AdGuard
DNS server [1]: 2

Enter a name for the first client:
Name [client]: iphone

OpenVPN installation is ready to begin.
Press any key to continue...

client ์„ค์ • ํŒŒ์ผ์ด /root/iphone.ovpn ๊ณผ ๊ฐ™์ด ์ƒ์„ฑ๋จ.

 

4. ๊ฐ OS ๋ณ„ Client ๋ฅผ ์ด์šฉํ•ด OpenVPN ์„œ๋ฒ„์— ์—ฐ๊ฒฐํ•˜๊ธฐ

์ƒ์„ฑ๋œ ์„ค์ • ํŒŒ์ผ๋กœ OpenVPN Client ์— ์ถ”๊ฐ€ํ•˜์—ฌ ์—ฐ๊ฒฐ ์„ค์ • ํ›„ ์ž˜ ๋˜๋Š”์ง€ ํ™•์ธ~

 

5. ์—ฐ๊ฒฐ ํ™•์ธ

OpenVPN Client ์—์„œ ์ •์ƒ์ ์œผ๋กœ ๋™์ž‘ํ•˜๋ฉด https://ip.ojj.kr ์— ์ ‘์†ํ•ด์„œ ํ‘œ์‹œ๋˜๋Š” IP ๊ฐ€ OpenVPN Server IP ์™€ ๋™์ผํ•œ์ง€ ํ™•์ธ.
(๋™์ผ ํ•˜๋ฉด ์„ฑ๊ณต~)

 

๊ธฐํƒ€ ๋‚ด์šฉ์€ ์•„๋ž˜ ์›๋ฌธ์—์„œ ํ™•์ธ

* ์ถœ์ฒ˜ : https://www.cyberciti.biz/faq/howto-setup-openvpn-server-on-ubuntu-linux-14-04-or-16-04-lts/

 

728x90