软路由openwrt系统安装、设置tailscale

OpenWrt系统安装tailscale步骤

一、下载安装

1.在线下载tailscale

SSH 终端进入 Open­Wrt ,下载 tailscale

# 进入 tmp 目录
cd /tmp
# 下载tailscale
wget https://github.com/adyanth/openwrt-tailscale-enabler/releases/download/v1.36.1-fb2f6cf-autoupdate/openwrt-tailscale-enabler-v1.36.1-fb2f6cf-autoupdate.tgz

备注:也可以去github看看作者有没有发布最新版本,如有最新版本,将链接换为最新版本即可。https://github.com/adyanth/openwrt-tailscale-enabler/releases/

2.提取压缩文件到系统根目录:

tar x -zvC / -f openwrt-tailscale-enabler-v1.36.1-fb2f6cf-autoupdate.tgz

3.安装运行所需的依赖:

# 更新包列表
opkg update
# 安装依赖
opkg install libustream-openssl ca-bundle kmod-tun

二、运行tailscale

1.启动tailscale

# 启动 tailscale守护进程
/etc/init.d/tailscale start
# 屏幕显示出 tailscale 登录地址,复制地址到网页地址栏进行授权登录
tailscale up --accept-dns=false

2.设置开机启动:

# 加入开机启动
/etc/init.d/tailscale enable
# 验证是否成功加入开机启动项:
ls /etc/rc.d/S*tailscale*

三、设置访问局域网其他内网设备

# 设置IP转发
cat >> /etc/sysctl.conf <<EOF
net.ipv4.ip_forward = 1
net.ipv6.conf.all.forwarding = 1
EOF
# 使配置生效
sysctl -p /etc/sysctl.conf
tailscale up --advertise-routes=10.10.10.0/24

备注:上面命令行中需 10.10.10.0/24 需要换成自己的局域网网段,比如你家的内网是192.168.31.X,则改为192.168.31.0/24。

进入 tailscale 控制台,找到机器名称,点击 -> Edit route settings,如图打开开关即可

 

此处如果不能点选,说明前一步设置有错误,一般情况在ssh客户端也能看到系统提示的报错信息,按照其提示的报错信息,将其复制重新执行该命令,大概率就能成功设置。

四、打开“出口模式”(让家里软路由作为中转出海的服务器)

tailscale up --advertise-exit-node

在tailscale网页端,打开“出口模式”

五、禁用“密钥过期”

Tailscale 一般每隔 6 个月会要求重新进行身份验证。为避免发生这种情况,在tailsacle网页端, Machines(设备列表)中找到需要禁用的设备,并选择 Disable Key Expiry (禁用密钥过期)

 

  • 5
    点赞
  • 36
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值