Virtual LAN over 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-natsThen, on each machine, do:
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 vnats0You 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.
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.
No open issues yet, or sync has not completed.