OpenVPN을 사용하여 VPN 서버 구축
배경
최근에는 스타벅스 등 공용 무선 LAN 사용이 늘고 있다.
공공 무선 LAN은 매우 편리하지만 https가 아닌 사이트에 로그인하는 등 암호화되지 않은 통신을 하는 것은 무섭다.
따라서 모든 패킷을 암호화하고 자체 VPN 서버를 통해 통신함으로써 안심하고 게임을 할 수 있다.
환경
집안은 NAPT를 사용하는 네트워크입니다.
생성 과정
서버 측 환경 구축
http://centossrv.com/openvpn.shtml 와 같이 구축됩니다.OpenVPN 2.3.6을 사용합니다./etc/openvpn/server.conf 아래와 같습니다.port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1"
push "dhcp-option DNS 192.168.11.1" # 自宅のDNSサーバのIP
keepalive 10 120
tls-auth ta.key 0
user nobody
group nobody
persist-key
persist-tun
status openvpn-status.log
log-append /var/log/openvpn.log
verb 3
management localhost 7505
crl-verify crl.pem
VPN 네트워크는 10.8.0.0/24 입니다.push "redirect-gateway def1" 클라이언트로부터 모든 통신이 VPN 서버를 통해 이루어집니다.
클라이언트 환경 구축
제작은 다음과 같습니다client.conf.client
remote hogehoge.co.jp
ca ca.crt
cert client.crt
key client.key
tun-mtu 1350
dev tun
proto udp
remote-cert-tls server
tls-auth ta.key 1
nobind
auth-nocache
script-security 2
persist-key
persist-tun
user nobody
group nogroup
tun-mtu의 값을 점으로 설정합니다.
TU 값을 추가하면 중간에 경로가 그룹화되어 제대로 동작하지 못할 수도 있습니다(이 근처는 잘 모르겠습니다...).
클라이언트 사용1350.필요한 패키지가 설치되었습니다.$ sudo apt-get install network-manager-openvpn network-manager-openvpn-gnome
네트워크 아이콘에서 network-manager-openvpn-gnomeVPN接続 -> VPNを設定 -> 追加 -> 保存したVPN設定をインポートする을 선택합니다.
클라이언트의 설정은 여기서 끝납니다.
네트워크 설정
라우터에 대해 다음과 같이 설정합니다.
집안은 NAPT를 사용하는 네트워크입니다.
생성 과정
서버 측 환경 구축
http://centossrv.com/openvpn.shtml 와 같이 구축됩니다.OpenVPN 2.3.6을 사용합니다./etc/openvpn/server.conf 아래와 같습니다.port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1"
push "dhcp-option DNS 192.168.11.1" # 自宅のDNSサーバのIP
keepalive 10 120
tls-auth ta.key 0
user nobody
group nobody
persist-key
persist-tun
status openvpn-status.log
log-append /var/log/openvpn.log
verb 3
management localhost 7505
crl-verify crl.pem
VPN 네트워크는 10.8.0.0/24 입니다.push "redirect-gateway def1" 클라이언트로부터 모든 통신이 VPN 서버를 통해 이루어집니다.
클라이언트 환경 구축
제작은 다음과 같습니다client.conf.client
remote hogehoge.co.jp
ca ca.crt
cert client.crt
key client.key
tun-mtu 1350
dev tun
proto udp
remote-cert-tls server
tls-auth ta.key 1
nobind
auth-nocache
script-security 2
persist-key
persist-tun
user nobody
group nogroup
tun-mtu의 값을 점으로 설정합니다.
TU 값을 추가하면 중간에 경로가 그룹화되어 제대로 동작하지 못할 수도 있습니다(이 근처는 잘 모르겠습니다...).
클라이언트 사용1350.필요한 패키지가 설치되었습니다.$ sudo apt-get install network-manager-openvpn network-manager-openvpn-gnome
네트워크 아이콘에서 network-manager-openvpn-gnomeVPN接続 -> VPNを設定 -> 追加 -> 保存したVPN設定をインポートする을 선택합니다.
클라이언트의 설정은 여기서 끝납니다.
네트워크 설정
라우터에 대해 다음과 같이 설정합니다.
port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1"
push "dhcp-option DNS 192.168.11.1" # 自宅のDNSサーバのIP
keepalive 10 120
tls-auth ta.key 0
user nobody
group nobody
persist-key
persist-tun
status openvpn-status.log
log-append /var/log/openvpn.log
verb 3
management localhost 7505
crl-verify crl.pem
client
remote hogehoge.co.jp
ca ca.crt
cert client.crt
key client.key
tun-mtu 1350
dev tun
proto udp
remote-cert-tls server
tls-auth ta.key 1
nobind
auth-nocache
script-security 2
persist-key
persist-tun
user nobody
group nogroup
$ sudo apt-get install network-manager-openvpn network-manager-openvpn-gnome
client.conf로 전송합니다.hogehoge.co.jp:1194로 보낸 그룹을 192.168.11.10:1194에 전달합니다.동작 확인
공용 무선 LAN을 연결합니다.
그런 다음 네트워크 아이콘에서 10.8.0.0/24 을 선택하고 VPN에 연결합니다.
외부로의 통신이 자기 집을 통해 이루어진 것을 확인하다.$ traceroute www.google.co.jp
1 10.8.0.1 (10.8.0.1) 48.214 ms 48.138 ms 48.148 ms
2 xxxxxxxx (192.168.11.1) 50.558 ms 50.846 ms 50.707 ms
(以下略)
Reference
이 문제에 관하여(OpenVPN을 사용하여 VPN 서버 구축), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/shibataka000/items/cd77176f4f938dafa251
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
$ traceroute www.google.co.jp
1 10.8.0.1 (10.8.0.1) 48.214 ms 48.138 ms 48.148 ms
2 xxxxxxxx (192.168.11.1) 50.558 ms 50.846 ms 50.707 ms
(以下略)
Reference
이 문제에 관하여(OpenVPN을 사용하여 VPN 서버 구축), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/shibataka000/items/cd77176f4f938dafa251텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)