管理员
发布于 2023-08-30 / 635 阅读 / 0 评论 / 0 点赞

Centos搭建vpn的几种办法

第一步 安装依赖 推荐

centos

yum update
yum install python-setuptools && easy_install pip  
pip install shadowsocks

Debian / Ubuntu:

apt-get install python-pip  
pip ins
tall shadowsocks

第二步 修改配置文件

修改配置文件`/etc/shadowsocks.json`,如果没有则新建。

创建单个账号

{  
    "server":"0.0.0.0",  
    "server_port":8388,  
    "local_address": "127.0.0.1",  
    "local_port":1080,  
    "password":"mypassword",  
    "timeout":300,  
    "method":"aes-256-cfb",  
    "fast_open": false  
}

创建多个账号

{  
    "server":"0.0.0.0",  
    "port_password":{  
     "8381":"xxxxxxx",  
     "8382":"xxxxxxx",  
     "8383":"xxxxxxx",  
     "8384":"xxxxxxx"  
     },  
    "timeout":300,  
    "method":"aes-256-cfb",  
    "fast_open": false  
}

配置字段说明

字段

说明

server

ss服务监听地址

server_port

ss服务监听端口

local_address

本地的监听地址

local_port

本地的监听端口

password

密码

timeout

超时时间,单位秒

method

加密方法,默认是aes-256-cfb

fast_open

使用TCP_FASTOPEN, true / false

workers

workers数,只支持Unix/Linux系统

启动

前台启动

ssserver -c /etc/shadowsocks.json

后台启动与停止

ssserver -c /etc/shadowsocks.json -d start  
ssserver -c /etc/shadowsocks.json -d stop

开机启动

修改`/etc/rc.local`,加入以下内容

ssserver -c /etc/shadowsocks.json -d start

日志

shadowsocks的日志保存在 /var/log/shadowsocks.log`

shadowsocks客户端安装

// Windows   
https://github.com/shadowsocks/shadowsocks-windows/releases   
  
// Mac OS X   
https://github.com/shadowsocks/ShadowsocksX-NG/releases 

// Linux   
https://github.com/shadowsocks/shadowsocks-qt5/wiki/Installation   
https://github.com/shadowsocks/shadowsocks-qt5/releases  

// IOS   
https://itunes.apple.com/app/apple-store/id1070901416?pt=2305194&ct=shadowsocks.org&mt=8   
https://github.com/shadowsocks/shadowsocks-iOS/releases

// Android   
https://play.google.com/store/apps/details?id=com.github.shadowsocks   
https://github.com/shadowsocks/shadowsocks-android/releases

这里我以mac电脑做示例,安装`https://github.com/shadowsocks/ShadowsocksX-NG/releases `

启动`shadowsocks` 配置服务器

地址就是你的服务器ip

port就是端口

密码就是服务器配置的密码

选择我们配置的服务器,并且把`shadowsocks`开启自动模式,我们访问下谷歌,就可以成功访问了

其它VPN搭建方式

搭建l2tp vpn(推荐)

[查看搭建教程](http://blog.noahsun.top/2018/04/07/%E6%90%AD%E5%BB%BA%E8%87%AA%E5%B7%B1%E4%B8%93%E5%B1%9E%E7%9A%84vpn%E2%80%94%E2%80%94Centos%E6%90%AD%E5%BB%BAvpn%E7%9A%84%E5%87%A0%E7%A7%8D%E5%8A%9E%E6%B3%95/)

搭建openvpn(不推荐)

[查看搭建教程](http://blog.noahsun.top/2018/04/07/%E6%90%AD%E5%BB%BA%E8%87%AA%E5%B7%B1%E4%B8%93%E5%B1%9E%E7%9A%84vpn%E2%80%94%E2%80%94Centos%E6%90%AD%E5%BB%BAvpn%E7%9A%84%E5%87%A0%E7%A7%8D%E5%8A%9E%E6%B3%95/)

搭建pptpd vpn(不推荐)

[查看搭建教程](http://blog.noahsun.top/2018/04/07/%E6%90%AD%E5%BB%BA%E8%87%AA%E5%B7%B1%E4%B8%93%E5%B1%9E%E7%9A%84vpn%E2%80%94%E2%80%94Centos%E6%90%AD%E5%BB%BAvpn%E7%9A%84%E5%87%A0%E7%A7%8D%E5%8A%9E%E6%B3%95/)


评论