FRP内网穿透
配置frp服务器端
查看 https://github.com/fatedier/frp
服务器端配置文件/etc/frps.ini
[common]
bind_port = 7000
kcp_bind_port = 7000
privilege_allow_ports = 7700,7800-7900
vhost_http_port = 5050
dashboard_port = 7500
dashboard_user = admin
dashboard_pwd = 123abc881
网页控制台为7500端口
编写/etc/systemd/system/frps.service
文件使开机启动
[Unit]
Description=frps service
After=network.target network-online.target
[Service]
Type=simple
User=nobody
Restart=on-failure
RestartSec=5s
ExecStart=/usr/local/bin/frps -c /etc/frps.ini
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable frps
sudo systemctl start frps
配置frp客户端
要穿透的代理配置 /etc/frpc.ini
[common]
server_addr = x.x.x.x
server_port = 7000
[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 7822
use_compression = true
编写/etc/systemd/system/frpc.service
开机启动
[Unit]
Description=frpc service
After=network.target network-online.target
[Service]
Restart=on-failure
TimeoutStartSec=0
ExecStart=/usr/local/bin/frpc -c /etc/frpc.ini
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable frpc
sudo systemctl start frpc
CentOS6 等没有systemd
的系统可以利用/etc/rc.d/rc.local
文件开机启动
/usr/local/bin/frps -c /etc/frps.ini > /dev/null 2>&1 &
对于Ubuntu 14.04
可以编写脚本放置于/etc/init.d/
,并赋予执行权限
frpc 或者 frps 注意自己改写
/etc/init.d/frpc.sh
#!/bin/sh
### BEGIN INIT INFO
# Provides: frp
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
/usr/local/bin/frpc -c /etc/frpc.ini > /dev/null 2>&1 &
exit 0
sudo update-rc.d frpc.sh defaults 90
重复执行会有提示 System start/stop links for /etc/init.d/frpc.sh already exist.
sudo update-rc.d -f frpc.sh remove
remove 会有提示
Removing any system startup links for /etc/init.d/frpc.sh ...
/etc/rc0.d/K90frpc.sh
/etc/rc1.d/K90frpc.sh
/etc/rc2.d/S90frpc.sh
/etc/rc3.d/S90frpc.sh
/etc/rc4.d/S90frpc.sh
/etc/rc5.d/S90frpc.sh
/etc/rc6.d/K90frpc.sh
https://github.com/ooclab/otunnel
otunnel 和 frp 功能类似
https://github.com/getqujing/qtunnel