์ƒ์„ธ ์ปจํ…์ธ 

๋ณธ๋ฌธ ์ œ๋ชฉ

[TIL] Docker๋กœ wireguard VPN ์„œ๋ฒ„ ์‹คํ–‰ํ•˜๊ธฐ 220920-1

CLOUD/Docker

by ์—์Šคํ”„๋ฆฌํ„ฐ 2022. 9. 20. 12:07

๋ณธ๋ฌธ

728x90
๐Ÿ’ก Today I Learned ์š”์•ฝ (6ํšŒ์ฐจ)
- Docker(๋„์ปค)๋ฅผ ์‚ฌ์šฉํ•ด์„œ wireguard vpn ์„œ๋ฒ„๋ฅผ ๊ตฌ์ถ•ํ•  ์ˆ˜ ์žˆ๋‹ค

 

Docker๋กœ wireguard VPN ์„œ๋ฒ„ ์‹คํ–‰ํ•˜๊ธฐ

VPN ์„œ๋ฒ„์ธ Wireguard๋ฅผ ๋„์ปค์—์„œ ๊ตฌํ˜„ํ•˜๊ธฐ ์œ„ํ•œ ์ฐธ๊ณ  ๋ฌธ์„œ๋Š” ๋ฐฐํ‹€ํ•„๋“œ๋ฅผ ๋Œ๋ฆฌ๊ธฐ ์œ„ํ•ด ์˜ค๋ผํด ํด๋ผ์šฐ๋“œ๋ฅผ ์‚ฌ์šฉํ•ด์„œ VM์„ ๊ตฌ์„ฑํ•˜๊ณ , ๊ฑฐ๊ธฐ์— ๋„์ปค - Wireguard๋ฅผ ๋Œ๋ฆฌ๊ธฐ ์œ„ํ•œ ๋ฐฉ๋ฒ•์„ ์ˆ˜ํ–‰ํ•˜์˜€์œผ๋‚˜ ๋‚˜ ๊ฐ™์€ ๊ฒฝ์šฐ๋Š” ์žฅ๋‚œ๊ฐ์œผ๋กœ ๋Œ๋ฆฌ๊ณ  ์žˆ๋Š” ์šฐ๋ถ„ํˆฌ ์„œ๋ฒ„๊ฐ€ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ๋ช…๋ น์–ด ๋ถ€๋ถ„๋งŒ ์ •๋ฆฌ. ํ•„์š”ํ•˜์‹  ๋ถ„๋“ค์€ ์•„๋ž˜ ๋ฆฌ์„œ์น˜ ๋‚ด์—ญ์„ ์ฐธ๊ณ ํ•˜๋ฉด ๋  ๋“ฏ.

# apt update ํ•˜๊ธฐ
sudo apt-get update;sudo apt-get -y upgrade;sudo apt-get -y dist-upgrade;

# ๋„์ปค ์ค€๋น„
curl -sSL https://get.docker.com | sh
sudo usermod -aG docker $(whoami)

# ๋„์ปค run (ip์™€ ๋น„๋ฐ€๋ฒˆํ˜ธ๋Š” ๊ฐ์ž ์ทจํ–ฅ๋Œ€๋กœ..)
docker run -d --name=wg-easy -e WG_HOST=1.2.3.4 -e PASSWORD="1q2w3e4r!" -v ~/.wg-easy:/etc/wireguard -p 51820:51820/udp -p 51821:51821/tcp --cap-add=NET_ADMIN --cap-add=SYS_MODULE --sysctl="net.ipv4.conf.all.src_valid_mark=1" --sysctl="net.ipv4.ip_forward=1" --restart unless-stopped weejewel/wg-easy

# ๋„์ปค ๋„๋Š”์ง€ ํ™•์ธ
docker ps

 

์ •์ƒ์ ์œผ๋กœ ๋„์ปค๊ฐ€ ์‹คํ–‰๋˜๋Š”์ง€ ํ™•์ธํ•œ ํ›„ ์•„๋ž˜์™€ ๊ฐ™์ด ์ ‘์†ํ•˜๋ฉด ๋œ๋‹ค.

http://[๊ณต์šฉ IP ์ฃผ์†Œ]:51821

 


#VPN ๊ด€๋ จ ์ž‘์„ฑ ๋ฐ ๋ฆฌ์„œ์น˜ ๋‚ด์—ญ:

ํƒœ๊ทธ

๊ด€๋ จ๊ธ€ ๋”๋ณด๊ธฐ

๋Œ“๊ธ€ ์˜์—ญ