Skip to content

Instantly share code, notes, and snippets.

@nimaid
Last active February 19, 2025 21:09
Show Gist options
  • Select an option

  • Save nimaid/88bd1023956682b374bc99a0f176264c to your computer and use it in GitHub Desktop.

Select an option

Save nimaid/88bd1023956682b374bc99a0f176264c to your computer and use it in GitHub Desktop.
Easy Scripts for `switch-lan-play` on Linux (made for my Raspberry Pi)

Easy Scripts for switch-lan-play on Linux (made for my Raspberry Pi)

Features

  • Animal Crossing: New Horizons PMTU fix
  • Automatically finds the eth0 adapter ID

Requirements

  • bash
  • wget

How To Install

Run the following in a bash shell to install:

pushd /tmp &>/dev/null

wget https://gist.githubusercontent.com/nimaid/88bd1023956682b374bc99a0f176264c/raw/install_slp.bash -O install_slp.bash
sudo chmod +x ./install_slp.bash
sudo ./install_slp.bash
sudo rm ./install_slp.bash

wget https://gist.githubusercontent.com/nimaid/88bd1023956682b374bc99a0f176264c/raw/run_slp.bash -O run_slp
sudo chmod +x ./run_slp
sudo mv ./run_slp /usr/local/bin/

wget https://gist.githubusercontent.com/nimaid/88bd1023956682b374bc99a0f176264c/raw/run_slp_tmux.bash -O run_slp_tmux
sudo chmod +x ./run_slp_tmux
sudo mv ./run_slp_tmux /usr/local/bin/

popd &>/dev/null

How To Use

Simply plug in an ethernet cable and type the following command in your bash shell:

run_slp [Address:Port]

Replace [Address:Port] with the server you want to connect to.

You can find a list of public servers with their player count and open game rooms by clicking this link.

Example command:

run_slp frog-skins.com:11451

Once the server is running connect to the same network on your switch using the settings explained in step 1 of the linked guide.

Your internet settings should look something like the following:

  • IP Address Settings
    • IP Address: 10.13.1.1
    • Subnet Mask: 255.255.0.0
    • Gateway: 10.13.37.1
  • DNS settings
    • Primary DNS: 163.172.141.219
    • Secondary DNS: 207.246.121.77
  • MTU: 1500

Once you connect, you won't be able to use the internet for things such as downloading games or updates. This is normal, and you should be able to now connect to the lan-play server of your choice.

Read the full guide for more details.

#!/bin/bash
set -e
sudo apt-get update
sudo apt install -y libpcap0.8-dev git gcc g++ cmake tmux git
pushd /tmp &>/dev/null
git clone https://github.com/spacemeowx2/switch-lan-play.git
cd switch-lan-play
mkdir build
pushd build &>/dev/null
cmake -DCMAKE_BUILD_TYPE=Release ..
make
sudo cp ./src/lan-play /usr/local/bin/switch-lan-play
popd &>/dev/null
rm -rf switch-lan-play
popd &>/dev/null
#!/bin/bash
set -e
if [ -z "$1" ]; then
SLP_SERVER="frog-skins.com:11451"
else
SLP_SERVER="$1"
fi
echo "Connectiong to server: $SLP_SERVER"
ADAPTER_NAME="eth0"
ADAPTER_ID="$(sudo switch-lan-play --list-if | grep $ADAPTER_NAME | cut -d " " -f1 | sed 's/\.$//g')"
sudo switch-lan-play --netif $ADAPTER_ID --relay-server-addr $SLP_SERVER --pmtu 500
#!/bin/bash
set -e
SLP_SESS_NAME=lan-play-relay
echo "Trying to start SLP server in tmux session '$SLP_SESS_NAME'"
tmux new-session -d -s $SLP_SESS_NAME "run_slp $1"
echo "Type 'tmux attach -t $SLP_SESS_NAME' to attach."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment