Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
V

vlan-nats

> 编程语言
Open source

Virtual LAN over NATS

361 stars0 likes1 views
WebsiteGitHub

About

Virtual LAN over 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 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Gogogolangnatsnetworking

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

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