Linux 搭建 VPN1

2022-06-30 00:03:05 浏览数 (1)

安装pptpd软件包

代码语言:javascript复制
[root@pptp-server ~]# yum list all | grep -i pptp 
NetworkManager-pptp.x86_64                   1:0.8.0-1.git20100411.el6    epel  
pptp.x86_64                                  1.7.2-8.1.el6                base  
pptp-setup.x86_64                            1.7.2-8.1.el6                base  
pptpd.x86_64                                 1.4.0-3.el6                  epel  
[root@pptp-server ~]# yum -y  install  pptpd.x86_64 
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package pptpd.x86_64 0:1.4.0-3.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================
 Package                      Arch                          Version                               Repository                   Size
====================================================================================================================================
Installing:
 pptpd                        x86_64                        1.4.0-3.el6                           epel                         75 k

Transaction Summary
====================================================================================================================================
Install       1 Package(s)

Total download size: 75 k
Installed size: 178 k
Downloading Packages:
pptpd-1.4.0-3.el6.x86_64.rpm                                                                                 |  75 kB     00:00     
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Retrieving key from http://yum.ksyun.cn/epel/RPM-GPG-KEY-EPEL-6
Importing GPG key 0x0608B895:
 Userid: "EPEL (6) <epel@fedoraproject.org>"
 From  : http://yum.ksyun.cn/epel/RPM-GPG-KEY-EPEL-6
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : pptpd-1.4.0-3.el6.x86_64                                                                                         1/1 
  Verifying  : pptpd-1.4.0-3.el6.x86_64                                                                                         1/1 

Installed:
  pptpd.x86_64 0:1.4.0-3.el6                                                                                                        

Complete!
[root@pptp-server ~]# 

打开内核参数 net.ipv4.ip_forward

代码语言:javascript复制
[root@pptp-server ~]# sysctl  -a | grep forward 
net.ipv4.conf.all.forwarding = 0
net.ipv4.conf.all.mc_forwarding = 0
net.ipv4.conf.default.forwarding = 0
net.ipv4.conf.default.mc_forwarding = 0
net.ipv4.conf.lo.forwarding = 0
net.ipv4.conf.lo.mc_forwarding = 0
net.ipv4.conf.eth0.forwarding = 0
net.ipv4.conf.eth0.mc_forwarding = 0
net.ipv4.ip_forward = 0
net.ipv6.conf.all.forwarding = 0
net.ipv6.conf.all.mc_forwarding = 0
net.ipv6.conf.default.forwarding = 0
net.ipv6.conf.default.mc_forwarding = 0
net.ipv6.conf.lo.forwarding = 0
net.ipv6.conf.lo.mc_forwarding = 0
net.ipv6.conf.eth0.forwarding = 0
net.ipv6.conf.eth0.mc_forwarding = 0
[root@pptp-server ~]# vim /etc/sysctl.conf 
[root@pptp-server ~]# grep forward /etc/sysctl.conf 
net.ipv4.ip_forward = 1
[root@pptp-server ~]# sysctl  -p 
net.ipv4.ip_forward = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key
error: "net.bridge.bridge-nf-call-iptables" is an unknown key
error: "net.bridge.bridge-nf-call-arptables" is an unknown key
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.ip_local_port_range = 1024 65535
net.ipv4.conf.all.rp_filter = 0
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.eth0.rp_filter = 0
error: "net.ipv4.conf.eth1.rp_filter" is an unknown key
net.ipv4.conf.all.arp_announce = 2
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.eth0.arp_announce = 2
error: "net.ipv4.conf.eth1.arp_announce" is an unknown key
[root@pptp-server ~]# sysctl  -a | grep forward 
net.ipv4.conf.all.forwarding = 1
net.ipv4.conf.all.mc_forwarding = 0
net.ipv4.conf.default.forwarding = 1
net.ipv4.conf.default.mc_forwarding = 0
net.ipv4.conf.lo.forwarding = 1
net.ipv4.conf.lo.mc_forwarding = 0
net.ipv4.conf.eth0.forwarding = 1
net.ipv4.conf.eth0.mc_forwarding = 0
net.ipv4.ip_forward = 1
net.ipv6.conf.all.forwarding = 0
net.ipv6.conf.all.mc_forwarding = 0
net.ipv6.conf.default.forwarding = 0
net.ipv6.conf.default.mc_forwarding = 0
net.ipv6.conf.lo.forwarding = 0
net.ipv6.conf.lo.mc_forwarding = 0
net.ipv6.conf.eth0.forwarding = 0
net.ipv6.conf.eth0.mc_forwarding = 0
[root@pptp-server ~]# 

0 人点赞