Find file Copy path
98e5577 Jan 18, 2019
3 contributors

Users who have contributed to this file

@spacemeowx2 @Cubuss @AngryPowman
201 lines (142 sloc) 4.52 KB


Build status Chat on discord

Make you and your friends play games like in a LAN.

                  [SOCKS5 Proxy] (optional)
        ARP,IPv4        |          LAN Packets
Switch <-------->  PC(lan-play)  <-------------> Server


  • This project is in an early stage. The protocol may change frequently.


To play with your friends, you and your friends should run lan-play client connecting to the same Server on your PC, and set static IP on your Switch.

Your PC and Switch must be connected to the same router.

1. Windows Client

  1. Download and install WinPcap from

  2. Download the latest lan-play.exe from

  3. Run lan-play.exe with paramter --relay-server-addr. For example:

lan-play.exe --relay-server-addr

After that, you may see the list like below:

1. \Device\NPF_{538AED4A-7BC9-47D9-A1DD-3F8E0AD2D2B0} (Microsoft Corporation)
        IP: []
2. \Device\NPF_{A885EB2A-D362-4846-8554-E6F59A044EB9} (Intel(R) Ethernet Connection (2) I219-V)
        IP: []
Enter the interface number (1-2):

Select the interface which is in the same LAN with your Switch.

2. Switch

  1. Make sure lan-play client is running.

  2. Go to your Switch settings page, set the IP address to static. The IP address can be any from to, excepting But don't use the same IP address with your friend.

    IP Address 10.13.?.?
    Subnet Mask
  3. Click save. Your Switch now can access the Internet via your PC.

  4. Launch your game, hold L+R+LStick to enter lan-play mode. Host or join a game, enjoy!


git clone
cd switch-lan-play/server
npm install
npm run build
npm run server

SOCKS5 Proxy

lan-play --socks5-server-addr

Data sent to the relay server does not pass through the proxy.


Debug or Release

cmake -DCMAKE_BUILD_TYPE=Debug .. cmake -DCMAKE_BUILD_TYPE=Release ..

Ubuntu / Debian

This project depends on libpcap, you can install libpcap0.8-dev on Ubuntu or Debian:

sudo apt install libpcap0.8-dev git gcc g++ cmake

Prepare a cmake, gcc, and run like this:

mkdir build
cd build
cmake ..


Use MSYS2 to compile.

pacman -Sy
pacman -S make \
    mingw-w64-x86_64-cmake \

To compile 32bit program:

pacman -S mingw-w64-i686-cmake \

Open MSYS2 MinGW 64-bit or MSYS2 MinGW 32-bit.

mkdir build
cd build
cmake -G "MSYS Makefiles" ..

Mac OS

brew install cmake
mkdir build
cd build
cmake ..



docker run -d -p 11451:11451/udp -p 11451:11451/tcp spacemeowx2/switch-lan-play


git clone
cd switch-lan-play/server
npm install
npm run build # build ts to js. run it again when code changed.
npm start

The server will listen to port 11451/udp.

Meanwhile the monitor service will be started on port 11451/tcp by default, you can get online client count via HTTP request:

Request: GET http://{YOUR_SERVER_IP}:11451/info

Response: { "online": 42 }


The protocol is very simple now, but I'm going to add some fileds to calculate network quality(packet loss, ping), like timestamp, seq_id, etc.

struct packet {
    uint8_t type;
    uint8_t payload[packet_len - 1];
enum type {
    KEEPALIVE = 0,
    IPV4 = 1,
    PING = 2,
    IPV4_FRAG = 3

The server can read IP addresses from payload and save source IP -> LAN IP to a cache table. If target ip address shown in payload doesn't hit the cache, broadcast this packet to the entire room(now a server is a room).