Skip to content

Instantly share code, notes, and snippets.

@pbelskiy
Last active November 14, 2024 16:10
Show Gist options
  • Save pbelskiy/a07c1453cd0c37a60b3b3855b1e87a81 to your computer and use it in GitHub Desktop.
Save pbelskiy/a07c1453cd0c37a60b3b3855b1e87a81 to your computer and use it in GitHub Desktop.
XRay Core setup on router

XRay Core Setup on Router

Follow these instructions to install and configure Xray on your router.

Tested on GL-MT3000

Step 1: Connect to the Router

Step 2: Create a directory for Xray

mkdir ~/xray
cd ~/xray

Step 3: Download and Install Xray

wget https://github.com/XTLS/Xray-core/releases/download/v24.11.11/Xray-linux-arm64-v8a.zip -O xray.zip
unzip xray.zip && rm xray.zip

Step 4: Configure Xray

  1. In your Amnezia Client, go to Share VPN Access -> Share -> XRay native format.
  2. Save the provided configuration as config.json in the ~/xray directory.
  3. Change "listen": "127.0.0.1" to "listen": "0.0.0.0"

Step 5: Set Up Xray as a Service

  1. Open and edit the init script for Xray:
vim /etc/init.d/xray
  1. Add the following script to automate the start and stop of Xray:
#!/bin/sh /etc/rc.common
START=99
start() {
  /root/xray/xray -config /root/xray/config.json &
}
stop() {
  killall xray
}
  1. Save and exit the file.

Step 6: Make the Script Executable

chmod +x /etc/init.d/xray

Step 7: Enable and start xray service

/etc/init.d/xray enable
/etc/init.d/xray start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment