VPN 서버 간단하게 설정하기: 두 판 사이의 차이

Ubuntu Korea Community Wiki
둘러보기로 이동 검색으로 이동
편집 요약 없음
(PPTP 데몬을 재시작한다: 명령어에 한 글자가 빠져 있었습니다.)
 
(사용자 2명의 중간 판 6개는 보이지 않습니다)
1번째 줄: 1번째 줄:
VPN서버 쉽게 설치 / 운영하기
VPN서버 쉽게 설치 / 운영하기


<syntaxhighlight lang="bash">
{{TerminalWindow|{{TerminalLine|prompt=user|~|sudo apt-get install pptpd}}<br/>
sudo apt-get install pptpd
{{TerminalLine|prompt=user|~|sudo vi /etc/pptpd.conf}}}}
sudo vi /etc/pptpd.conf
 
</syntaxhighlight>


아래 두 라인을 적거나 주석을 해제한다.  localip는 해당 서버의 내부 IP주소를 적는다.  접속받을 클라이언트의 IP 주소범위 지정은 알아서.
아래 두 라인을 적거나 주석을 해제한다.  localip는 해당 서버의 내부 IP주소를 적는다.  접속받을 클라이언트의 IP 주소범위 지정은 알아서.
localip     192.168.1.1
{{TerminalWindow|{{TerminalLine|prompt=msg|localip&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;192.168.1.1}}<br/>
remoteip 192.168.1.230-235
{{TerminalLine|prompt=msg|remoteip&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;192.168.1.230-235}}}}


<syntaxhighlight lang="bash">
{{TerminalWindow|{{TerminalLine|prompt=user|~|sudo vi /etc/ppp/chap-secrets}}}}
sudo vi /etc/ppp/chap-secrets
</syntaxhighlight>


아래의 라인을 적는다.
아래의 라인을 적는다.
ID pptpd   password *
{{TerminalWindow|{{TerminalLine|prompt=msg|&nbsp;ID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pptpd&nbsp;&nbsp;&nbsp;password&nbsp;*}}<br/>
예:   jswlinux     pptpd     weicr$3frf     *
{{TerminalLine|prompt=msg|예:&nbsp;&nbsp;&nbsp;&nbsp;jswlinux&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pptpd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;weicr$3frf&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*}}}}


네트워킹 설정을 변경해야한다.  방화벽에 VPN접속을 받아서 데이터를 매스커레이딩 할 수 있게 해준다.
네트워킹 설정을 변경해야한다.  방화벽에 VPN접속을 받아서 데이터를 매스커레이딩 할 수 있게 해준다.
<syntaxhighlight lang="bash">
{{TerminalWindow|{{TerminalLine|prompt=user|~|sudo vi /etc/rc.local}}<br/>
sudo vi /etc/rc.local
{{TerminalLine|prompt=user|~|sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE}}<br/>
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
{{TerminalLine|prompt=user|~|sudo vi /etc/sysctl.conf}}}}


일부 사이트들이 PMTU문제로 접속이 되지 않을때가 있다. 아래명령어를 입력해주자
iptables -I FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu


sudo vi /etc/sysctl.conf
아래의 라인을 주석해제한다.
</syntaxhighlight>


아래의 라인을 주석해제한다.
{{TerminalWindow|{{TerminalLine|prompt=msg|net.ipv4.ip_forward<nowiki>=</nowiki>1}}}}
net.ipv4.ip_forward=1


PPTP 데몬을 재시작한다.
PPTP 데몬을 재시작한다.
<syntaxhighlight lang="bash">
{{TerminalWindow|{{TerminalLine|prompt=user|~|sudo /etc/init.d/pptpd restart}}}}
sudo /etc/init./pptpd restart
</syntaxhighlight>


공유기에서 1723번 포트를 서버로 포워딩해준다.


공유기에서 1723번 포트를 서버로 포워딩해준다.
일부 사이트들이 접속이 되지 않을 때에는 PMTU문제로 아래명령어를 입력해주자
{{TerminalWindow|{{TerminalLine|prompt=user|~|iptables -I FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu}}}}


--[[사용자:Seony|Seony]] ([[사용자토론:Seony|토론]]) 2014년 4월 25일 (금) 18:37 (KST)
--[[사용자:Seony|Seony]] ([[사용자토론:Seony|토론]]) 2014년 4월 25일 (금) 18:37 (KST)


[[Category:UbuntuKRServer]]
[[Category:UbuntuKRServer]]

2016년 3월 21일 (월) 06:54 기준 최신판

VPN서버 쉽게 설치 / 운영하기

{{#ifeq: msg|user|~|{{#ifeq: misc|user|~  sudo apt-get install pptpd|{{#ifeq: root|user|ubuntu-korea|{{#ifeq: user|user|user@ubuntu-korea|(undefined)}}}} ~ {{#ifeq: root|user|#|{{#ifeq: user|user|$|$}}}}  sudo apt-get install pptpd}}}}
{{#ifeq: msg|user|~|{{#ifeq: misc|user|~  sudo vi /etc/pptpd.conf|{{#ifeq: root|user|ubuntu-korea|{{#ifeq: user|user|user@ubuntu-korea|(undefined)}}}} ~ {{#ifeq: root|user|#|{{#ifeq: user|user|$|$}}}}  sudo vi /etc/pptpd.conf}}}}


아래 두 라인을 적거나 주석을 해제한다. localip는 해당 서버의 내부 IP주소를 적는다. 접속받을 클라이언트의 IP 주소범위 지정은 알아서.

{{#ifeq: msg|msg|localip        192.168.1.1|{{#ifeq: misc|msg|localip        192.168.1.1  {{{2}}}|{{#ifeq: root|msg|ubuntu-korea|{{#ifeq: user|msg|user@ubuntu-korea|(undefined)}}}} localip        192.168.1.1 {{#ifeq: root|msg|#|{{#ifeq: user|msg|$|$}}}}  {{{2}}}}}}}
{{#ifeq: msg|msg|remoteip        192.168.1.230-235|{{#ifeq: misc|msg|remoteip        192.168.1.230-235  {{{2}}}|{{#ifeq: root|msg|ubuntu-korea|{{#ifeq: user|msg|user@ubuntu-korea|(undefined)}}}} remoteip        192.168.1.230-235 {{#ifeq: root|msg|#|{{#ifeq: user|msg|$|$}}}}  {{{2}}}}}}}

{{#ifeq: msg|user|~|{{#ifeq: misc|user|~  sudo vi /etc/ppp/chap-secrets|{{#ifeq: root|user|ubuntu-korea|{{#ifeq: user|user|user@ubuntu-korea|(undefined)}}}} ~ {{#ifeq: root|user|#|{{#ifeq: user|user|$|$}}}}  sudo vi /etc/ppp/chap-secrets}}}}

아래의 라인을 적는다.

{{#ifeq: msg|msg| ID       pptpd   password *|{{#ifeq: misc|msg| ID       pptpd   password *  {{{2}}}|{{#ifeq: root|msg|ubuntu-korea|{{#ifeq: user|msg|user@ubuntu-korea|(undefined)}}}}  ID       pptpd   password * {{#ifeq: root|msg|#|{{#ifeq: user|msg|$|$}}}}  {{{2}}}}}}}
{{#ifeq: msg|msg|예:    jswlinux     pptpd     weicr$3frf     *|{{#ifeq: misc|msg|예:    jswlinux     pptpd     weicr$3frf     *  {{{2}}}|{{#ifeq: root|msg|ubuntu-korea|{{#ifeq: user|msg|user@ubuntu-korea|(undefined)}}}} 예:    jswlinux     pptpd     weicr$3frf     * {{#ifeq: root|msg|#|{{#ifeq: user|msg|$|$}}}}  {{{2}}}}}}}

네트워킹 설정을 변경해야한다. 방화벽에 VPN접속을 받아서 데이터를 매스커레이딩 할 수 있게 해준다.

{{#ifeq: msg|user|~|{{#ifeq: misc|user|~  sudo vi /etc/rc.local|{{#ifeq: root|user|ubuntu-korea|{{#ifeq: user|user|user@ubuntu-korea|(undefined)}}}} ~ {{#ifeq: root|user|#|{{#ifeq: user|user|$|$}}}}  sudo vi /etc/rc.local}}}}
{{#ifeq: msg|user|~|{{#ifeq: misc|user|~  sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE|{{#ifeq: root|user|ubuntu-korea|{{#ifeq: user|user|user@ubuntu-korea|(undefined)}}}} ~ {{#ifeq: root|user|#|{{#ifeq: user|user|$|$}}}}  sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE}}}}
{{#ifeq: msg|user|~|{{#ifeq: misc|user|~  sudo vi /etc/sysctl.conf|{{#ifeq: root|user|ubuntu-korea|{{#ifeq: user|user|user@ubuntu-korea|(undefined)}}}} ~ {{#ifeq: root|user|#|{{#ifeq: user|user|$|$}}}}  sudo vi /etc/sysctl.conf}}}}


아래의 라인을 주석해제한다.

{{#ifeq: msg|msg|net.ipv4.ip_forward=1|{{#ifeq: misc|msg|net.ipv4.ip_forward=1  {{{2}}}|{{#ifeq: root|msg|ubuntu-korea|{{#ifeq: user|msg|user@ubuntu-korea|(undefined)}}}} net.ipv4.ip_forward=1 {{#ifeq: root|msg|#|{{#ifeq: user|msg|$|$}}}}  {{{2}}}}}}}

PPTP 데몬을 재시작한다.

{{#ifeq: msg|user|~|{{#ifeq: misc|user|~  sudo /etc/init.d/pptpd restart|{{#ifeq: root|user|ubuntu-korea|{{#ifeq: user|user|user@ubuntu-korea|(undefined)}}}} ~ {{#ifeq: root|user|#|{{#ifeq: user|user|$|$}}}}  sudo /etc/init.d/pptpd restart}}}}

공유기에서 1723번 포트를 서버로 포워딩해준다.

일부 사이트들이 접속이 되지 않을 때에는 PMTU문제로 아래명령어를 입력해주자

{{#ifeq: msg|user|~|{{#ifeq: misc|user|~  iptables -I FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu|{{#ifeq: root|user|ubuntu-korea|{{#ifeq: user|user|user@ubuntu-korea|(undefined)}}}} ~ {{#ifeq: root|user|#|{{#ifeq: user|user|$|$}}}}  iptables -I FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu}}}}

--Seony (토론) 2014년 4월 25일 (금) 18:37 (KST)