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?
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
- Installing Xray via Entware on Huawei and Other Modems
- Installing Xray on OLAX Portable Routers via OpenWRT
- Xray Configuration and Setup
- Hardware Requirements and Limitations
- Troubleshooting Common Issues
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:
# 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:
# 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:
- Reboot the router
- Create a new “4G” interface connected to the appropriate port (usually eth2)
- 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
- Download OpenWRT firmware for your OLAX model
- Upload the firmware through the router’s web interface
- 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:
# 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):
{
"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:
- Configure routing on the router
- Create iptables rules for traffic redirection
- 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:
- Check that the modem is not in flash storage mode
- Install necessary drivers for your Linux distribution
- 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:
- Check your firmware compatibility
- Ensure there is enough free space on flash memory
- Try manual installation from Entware archives
XrayUI Issues
If XrayUI is not working properly:
- Check the correctness of configuration files
- Ensure all dependencies are installed
- Check logs for errors
Sources
- XrayUI – A Simple Way to Manage Xray-Core on the ASUS Router | SNBForums
- OpenWrt Table of Hardware - Device Compatibility Guide
- Support for OLAX AX5 PRO 4G LTE ROUTER - OpenWrt Forum
- Installing luci-app-xray onto GL-MT6000 router - Reddit
- XRay for OpenWRT - 12VPX
- Huawei usb 4G modem not detected - Ask Ubuntu
- How to use a Huawei E3372 on OpenWRT · GitHub
- Xray client on RT-AX58U | SNBForums
- OLAX Technology - Quality Portable Wifi Routers
- 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.