移动宽带frp内网穿透访问家中网络(by quqi99)

版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明 (作者:张华 发表于:2019-04-30)

移动宽带没有公网IP, 除了采用ssh正向代理可以经vps访问家里机器外, 也可以可用frp内网穿透实现.

# server side
wget https://github.com/fatedier/frp/releases/download/v0.27.0/frp_0.27.0_linux_amd64.tar.gz
sudo cp frps /usr/bin/ && sudo cp frps.ini /etc/frp/
sudo bash -c 'cat > /etc/frp/frps.ini ' << EOF
[common]
bind_port = 7000
privilege_token = 'admintoken'
log_file = /var/log/frps.log

[http_proxy]
type = tcp
remote_port =7070
plugin = http_proxy
#plugin_http_user = quqi
#plugin_http_passwd = password

[socks5]
type = tcp
remote_port =7070
plugin = socks5
#plugin_http_user = quqi
#plugin_http_passwd = password
EOF
sudo /usr/bin/frps -c /etc/frps.ini
sudo cp systemd/frps.service /lib/systemd/system/
sudo systemctl enable frps.service
sudo systemctl restart frps.service

#cliet side
wget https://github.com/fatedier/frp/releases/download/v0.27.0/frp_0.27.0_linux_amd64.tar.gz
sudo cp frpc /usr/bin/ && sudo cp frpc.ini /etc/frp/
sudo bash -c 'cat > /etc/frp/frpc.ini ' << EOF
[common]
server_addr = vps
server_port = 7000
privilege_token = 'admintoken'
log_file = /var/log/frpc.log
use_encryption = true
use_compression = true

[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 2222

[dns]
type = udp
local_ip = 8.8.8.8
local_port = 53
remote_port = 5353

[http_proxy]
type = tcp
remote_port =7070
plugin = http_proxy
#plugin_http_user = quqi
#plugin_http_passwd = password

[socks5]
type = tcp
remote_port =7070
plugin = socks5
#plugin_http_user = quqi
#plugin_http_passwd = password
EOF
sudo /usr/bin/frpc -c /etc/frpc.ini
sudo cp systemd/frpc.service /lib/systemd/system/
sudo systemctl enable frpc.service
sudo systemctl restart frpc.service

ssh hua@vps -p 2222 -v
dig @vps -p 5353 google.com
#env ALL_PROXY=socks5h://quqi:password@vps:7070 curl https://www.google.com --verbose

# reference
# https://diannaobos.com/post/612.html
# https://www.cnblogs.com/sanduzxcvbnm/p/8508741.html

你可能感兴趣的:(Linux,Application)