Raspberry Pi 无线网络透传部署(未完待续)
sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/g' /etc/sysctl.conf
sysctl -p
apt -y install mtr tcpdump iftop kpartx ipmitool dnsutils ddrescue autossh whois unzip wget vim-conque golang git htpdate
cd /tmp
VERSION=$(curl -Ss https://api.github.com/repos/fatedier/frp/releases/latest |grep tag_name|grep -Po '[0-9]+\.[0-9]+\.[0-9]+.*(?=")')
#wget $(curl -Ss https://api.github.com/repos/fatedier/frp/releases/latest |grep browser_download_url|grep linux_arm| cut -d '"' -f 4) -O - | tar xz
wget https://github.com/fatedier/frp/releases/download/v${VERSION}/frp_${VERSION}_linux_arm.tar.gz -O - | tar xz
cd frp_*_linux_arm
mkdir /etc/frp
sed -i 's/network.target/network.target ntpdate.service/g' systemd/frp{c,s}.service
install frp{c,s} /usr/bin/
install systemd/frp{c,s}.service /usr/lib/systemd/system/
install frp{c,s}.ini /etc/frp/
systemctl daemon-reload
systemctl enable frpc.service
systemctl start frpc.service
systemctl status frpc.service
frpc.ini配置为默认.
附:
Nginx的stream四层转发串口方案
stream {
server {
listen 3501;
proxy_connect_timeout 15s;
proxy_timeout 30s;
proxy_pass unix:/dev/ttyUSB0;
#allow 333.333.333.0/24; #白名单IP段
#deny all;
}
server {
listen 3502;
proxy_connect_timeout 15s;
proxy_timeout 30s;
proxy_pass unix:/dev/ttyUSB1;
#allow 333.333.333.0/24; #白名单IP段
#deny all;
}
}
通过frp可以直接把串口丢到公网上去, 直接用telnet登陆进入串口.
telnet 公网IP 端口
frp和nginx主要做转发方案, 其他的还有隧道内网方案, 但基于没有独立IP的情况涉及第三方服务器服务, 像wireguard/ZeroTier/花生壳/蒲公英等等, 由于精力有限这里就暂时不涉及了. .
本文为草稿, 未完待续.
none