【内网穿透】Tailscale在openwrt中部署,并开启子网sunbnet

准备工作

进入openwrt后台,按0退出菜单

更新组件以及安装

opkg update
opkg install libustream-openssl ca-bundle kmod-tun
opkg install tailscale

启动tailscale并配置

tailscale up

复制该链接到浏览器打开,登录自己账号,点击connect即可连接成功

配置子网subnet

tailscale up --advertise-routes=192.168.3.0/24

打开官网,配置如下

设置开机启动,验证开机启动,检查当前状态

/etc/init.d/tailscale enable
ls /etc/rc.d/S*tailscale*
tailscale status

如果不通,也可以执行下面操作

添加接口

在OpenWrt上新建一个接口,协议选静态地址,设备选tailscale0,地址为Taliscale管理页面上分配的地址,掩码255.0.0.0。防火墙区域选lan区域。

添加防火墙规则

将以下内容,加到防火墙的自定义规则当中,并重启防火墙。

iptables -I FORWARD -i tailscale0 -j ACCEPT
iptables -I FORWARD -o tailscale0 -j ACCEPT
iptables -t nat -I POSTROUTING -o tailscale0 -j MASQUERADE

现在各个Tailscale节点之间已经可以正常互访了。

参考资料

OpenWrt安装配置Tailscale实现内网穿透,异地组网

OpenWrt安装配置Tailscale

OpenWrt系统安装设置Tailscale,解决远程访问NAS、私有云的问题(油管视频)

其他参考命令

#其他参考命令、

SAGE
  tailscale [flags] <subcommand> [command flags]

For help on subcommands, add --help after: "tailscale status --help".

This CLI is still under active development. Commands and flags will
change in the future.

SUBCOMMANDS
  up         Connect to Tailscale, logging in if needed
  down       Disconnect from Tailscale
  set        Change specified preferences
  login      Log in to a Tailscale account
  logout     Disconnect from Tailscale and expire current node key
  switch     Switches to a different Tailscale account
  configure  [ALPHA] Configure the host to enable more Tailscale features
  netcheck   Print an analysis of local network conditions
  ip         Show Tailscale IP addresses
  status     Show state of tailscaled and its connections
  ping       Ping a host at the Tailscale layer, see how it routed
  nc         Connect to a port on a host, connected to stdin/stdout
  ssh        SSH to a Tailscale machine
  funnel     Serve content and local servers on the internet
  serve      Serve content and local servers on your tailnet
  version    Print Tailscale version
  web        Run a web server for controlling Tailscale
  file       Send or receive files
  bugreport  Print a shareable identifier to help diagnose issues
  cert       Get TLS certs
  lock       Manage tailnet lock
  licenses   Get open source license information
  exit-node  Show machines on your tailnet configured as exit nodes
  update     [BETA] Update Tailscale to the latest/different version
  whois      Show the machine and user associated with a Tailscale IP (v4 or v6)

FLAGS
  --socket string

留下评论