NeuroAgent

Complete Guide: Installing Xray on 4G Modem

Installing Xray on 4G modem: step-by-step guide for Huawei and OLAX. Learn how to configure Entware and OpenWRT to work with Xray. Complete guide for beginners.

How to install Xray client on a 4G modem?

Could you please advise if there are USB modems, such as Huawei models, or modems with built-in batteries like OLAX, that allow installing the Xray client? My search suggests that it might be possible to install Entware on Huawei devices, and then install the Xray package through that. I’m also interested in the option of installing Xray on a pocket modem-router with a battery. Is this possible through OpenWRT?

NeuroAgent

Installing Xray Client on 4G Modems: A Comprehensive Guide

For installing the Xray client on a 4G modem, there are two main approaches: through Entware on supported routers (such as Huawei with ASUSWRT Merlin firmware) or through OpenWRT on portable battery-powered routers (for example, OLAX). Most modern 4G modems and routers can have Xray installed, but hardware compatibility and proper firmware configuration are required.

Contents

Preparing Equipment for Xray Installation

Before installing Xray on a 4G modem, you need to ensure that the equipment supports the required software. The main requirements include:

Hardware Compatibility:

  • For Entware installation: Routers with ASUSWRT Merlin firmware (version 384.15+ or 3006.102.1+)
  • For OpenWRT installation: Hardware supported by the OpenWRT project
  • USB interface support for 4G modems
  • Sufficient memory (minimum 128MB RAM recommended)

Supported Equipment Types:

  • Huawei USB modems (E3372 and other models)
  • Portable battery-powered OLAX routers (AX5 PRO, MT30, G5010, etc.)
  • Other 4G CPE routers with OpenWRT support

Important: Not all Huawei models support Entware installation. You must check compatibility of the specific model with the target firmware.


Installing Xray via Entware on Huawei and Other Modems

The process of installing Xray via Entware on Huawei modems includes several stages:

Step 1: Install Entware

For most modern routers with Entware support, installation is performed as follows:

bash
# Connect to the router via SSH
ssh admin@192.168.1.1

# Install Entware
wget -O - http://bin.entware.net/other/installer/installer.sh | sh

Step 2: Install Xray via Entware

After successfully installing Entware, you can install Xray:

bash
# Update packages
opkg update

# Install Xray
opkg install xray-core

# Or install via XrayUI for convenient management
opkg install luci-app-xray

Step 3: Configure Huawei 4G Modem

For proper operation of the Huawei 4G modem, you need to create a network interface:

  1. Reboot the router
  2. Create a new “4G” interface connected to the appropriate port (usually eth2)
  3. Assign the interface to the WAN zone in firewall settings

Interface Configuration Example:

config interface '4g'
    option ifname 'eth2'
    option proto 'dhcp'
    option enabled '1'

As indicated in the Huawei E3372 usage guide on OpenWRT, proper interface configuration is critical for stable operation [source 8].


Installing Xray on OLAX Portable Routers via OpenWRT

Portable battery-powered OLAX routers (such as AX5 PRO, MT30, G5010) are an excellent option for installing Xray due to their portability and OpenWRT support.

Checking Hardware Compatibility

Before installation, check if your OLAX model is supported in the OpenWRT compatibility table [source 2]. At the time of research, AX5 PRO and MT30 models have OpenWRT support.

OpenWRT Installation Process

  1. Download OpenWRT firmware for your OLAX model
  2. Upload the firmware through the router’s web interface
  3. Reboot the device to complete installation

Installing Xray via Luci-app-xray

For convenient Xray management through the web interface, use the luci-app-xray package:

bash
# Add repository to feeds.conf
echo 'src-git-full luci_app_xray https://github.com/yichya/luci-app-xray' >> feeds.conf.default

# Update packages
./scripts/feeds update -a

# Install packages
./scripts/feeds install -a

# Build firmware
make defconfig
make

Important: The Xray installation process on OpenWRT is complex and requires careful configuration, as noted in the guide [source 9].


Xray Configuration and Setup

After installing Xray, you need to properly configure the client to work with the 4G connection.

Basic Xray Configuration

Example Xray configuration file (in JSON format):

json
{
  "inbounds": [
    {
      "port": 1080,
      "protocol": "socks",
      "settings": {}
    }
  ],
  "outbounds": [
    {
      "protocol": "vless",
      "settings": {
        "vnext": [
          {
            "address": "server.example.com",
            "port": 443,
            "users": [
              {
                "id": "your-uuid",
                "encryption": "none"
              }
            ]
          }
        ]
      }
    }
  ]
}

Integration with 4G Connection

To automatically route traffic through Xray when working with a 4G modem:

  1. Configure routing on the router
  2. Create iptables rules for traffic redirection
  3. Configure automatic Xray startup on system boot

Hardware Requirements and Limitations

Memory and Processor Requirements

  • RAM: Minimum 128MB for stable Xray operation
  • Processor: ARMv7 or newer with at least 400MHz frequency
  • Flash Memory: Minimum 32MB for installation and operation

Supported Protocols

  • VLESS
  • VMess
  • Shadowsocks
  • Trojan

Battery Limitations

  • When operating in router mode with Xray, OLAX battery may last 4-8 hours depending on load
  • Recommended to use power saving mode for extended operation

Troubleshooting Common Issues

Huawei Modem Detection Issues

If the Huawei USB modem is not detected by the system:

  1. Check that the modem is not in flash storage mode
  2. Install necessary drivers for your Linux distribution
  3. Check the modem’s USB mode settings

As discussed on Ask Ubuntu, Huawei modems are often initially mounted as flash drives [source 6].

Entware Installation Issues

If Entware installation fails:

  1. Check your firmware compatibility
  2. Ensure there is enough free space on flash memory
  3. Try manual installation from Entware archives

XrayUI Issues

If XrayUI is not working properly:

  1. Check the correctness of configuration files
  2. Ensure all dependencies are installed
  3. Check logs for errors

Sources

  1. XrayUI – A Simple Way to Manage Xray-Core on the ASUS Router | SNBForums
  2. OpenWrt Table of Hardware - Device Compatibility Guide
  3. Support for OLAX AX5 PRO 4G LTE ROUTER - OpenWrt Forum
  4. Installing luci-app-xray onto GL-MT6000 router - Reddit
  5. XRay for OpenWRT - 12VPX
  6. Huawei usb 4G modem not detected - Ask Ubuntu
  7. How to use a Huawei E3372 on OpenWRT · GitHub
  8. Xray client on RT-AX58U | SNBForums
  9. OLAX Technology - Quality Portable Wifi Routers
  10. GitHub - zw963/asuswrt-merlin-v2ray

Conclusion

Installing the Xray client on a 4G modem is quite possible but requires thorough equipment preparation and following step-by-step instructions. Key points:

  • For Huawei modems: Use installation via Entware on routers with ASUSWRT Merlin support
  • For OLAX portable routers: Install OpenWRT and use the luci-app-xray package for convenient management
  • Importance of compatibility checking: Always check support for your specific equipment model before installation
  • Resource requirements: Ensure your router has sufficient memory and processing power

For beginners, it’s recommended to use pre-built installations with pre-installed XrayUI, which significantly simplifies the configuration process. If problems arise, refer to official documentation and equipment support forums.