百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
V

vlan-nats

> 编程语言
开源

基于 NATS 的虚拟局域网

361 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

基于 NATS 的虚拟局域网

vlan-nats

Disclaimer: This is only a fun experiment. Do not use it for anything serious.

vlan-nats creates a virtual LAN using NATS. Backed by a NATS server (or cluster), vlan-nats can create and run a network interface that is connected to a virtual L2 switch.

vlan-nats is written in entirely in Go. Currently, it works only on Linux. Multicast is not supported.

First, get and build vlan-nats:

$ go get github.com/rapidloop/vlan-nats

Then, on each machine, do:

bash
sudo vlan-nats -n nats://{MY-NATS-SERVER}:4222 &
sudo ip addr add 10.1.0.{CHANGEME} broadcast 10.1.255.255 dev vnats0
sudo ip link set vnats0 up
sudo ip route add 10.1.0.0/16 dev vnats0

You should replace {CHANGEME} with a unique number. The {MY-NATS-SERVER} is the IP or host of a reachable NATS server (all machines must connect to the same NATS cluster).

Congratulations! You now have all your machines reachable on the virtual subnet 10.1.0.0/16. You should be able to ping each other:

…

Cool!

To cleanup, just sudo pkill vlan-nats. The interface is not persisted.

How It Works

vlan-nats creates a TAP interface. All broadcast frames from the interface are published to the NATS topic vlan.{ID} and unicast frames are published to vlan.{ID}.{DST_ETHADDR}. The process subscribes to vlan.{ID} and vlan.{ID}.{OWN_ETHADDR} and writes out any received frames into the TAP interface.

Windows and OS X do not natively support TAP devices, but (free) 3rd party drivers are available.

Things To Try Out

  • Windows and OS X can be supported with 3rd party TAP drivers.
  • Run a DHCP server instead of assigning static IPs.
  • Use a TLS-enabled, authenticated, public NATS server -- like a VPN!

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Gogogolangnatsnetworking

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言