How to open a port on Xiaomi devices: routers, phones and smart home

Opening ports on Xiaomi devices is a challenge that both experienced users and beginners face. Without the right port configuration, you will not be able to run a home server, remote access to Mi Home cameras, organize torrent downloads or set up online games. The problem is that the interfaces of routers Mi Router, phones Redmi/POCO Smart devices differ, and official documentation is often silent about the nuances of the.

In this article, we will analyze three key scenarios: 1) Port rollover on Xiaomi routers (including models with MiWiFi and Padavan firmware), 2) Port configuration on phones for developers or remote access, 3) Features of working with ports on smart devices (cameras, NAS).

You will learn how to avoid common errors (such as conflicts with UPnP), which ports are safe to open, and what to do if settings do not apply.

1.Why to open ports on Xiaomi and what risks it carries

Opening ports is about creating doors to the outside world for your local device.

  • ๐ŸŽฎ Start a Game Server (Minecraft, CS:GO) friend;
  • ๐Ÿ“ก Connect to Xiaomiโ€™s home camera from another network;
  • ๐Ÿ’ป Provide remote access to files through FTP or SSH;
  • โšก Accelerate torrent uploading (if the port is closed, the speed drops by a small amount) 30-50%).

But every open port is a potential vulnerability, and hackers scan networks for open ports (especially 22, 80, 445) and try to find passwords. In 2023, for example, the Mirai botnet infected Xiaomi routers through weak credentials on port 7547 (control). TR-069).

โš ๏ธ Warning: Never open port 37215 (used by the Death virus for DDoS attacks) and 1900 (a vulnerability in the protocol) SSDP, traffic-amplified).

Before setting up, check if the ports are already open: telnet is your external_IP port (if the connection is established, the port is open).

Or use online services like YouGetSignal.

๐Ÿ“Š Why you open ports on Xiaomi?
Game server
Remote access to cameras
Torrents
FTP/SSH
Another option

2. Ports transfer on Xiaomi routers (Mi Router) 3/4/Pro, AX)

Xiaomi routers use MiWiFi (Chinese/global) or alternative (Padavan, OpenWRT) firmware. The instructions for these are different. 4A Gigabit.

Step 1: Preparing the router

Before setting up:

  • ๐Ÿ”Œ Connect the device you open the port to the router via cable (Wi-Fi can block some functions).
  • ๐Ÿ“‹ Set it up locally. IP customized DHCP (So it doesn't change. Go to Settings for that. โ†’ Local area network โ†’ DHCP โ†’ Reservation of addresses.
  • ๐Ÿ”„ Restart the router after reservation IP.

Step 2: Set up port port rollover

Open the router control panel (192.168.31.1) and do:

  1. Go to the Supplementary โ†’ Redirection โ†’ Port transfer.
  2. Press Add the rule.
  3. Fill in the fields: Rule name: Any (e.g., "Minecraft Server: TCP, UDP or TCP/UDP. External port: Port that will be visible from the Internet (for example, the port of the Internet, 25565 Internal port: Port on a local device (may match an external device). IP: Local. IP devices, for example, 192.168.31.100).

Save the rule and restart the router.

โ˜‘๏ธ Checking port passage

Done: 0 / 4

Step 3: Checking and Resolving Errors

If the port does not open:

  • ๐Ÿ” Check if UPnP blocks it (disable it in Settings). โ†’ Redirection โ†’ UPnP).
  • ๐Ÿ›ก๏ธ Make sure the firewall is in place. Windows/Antivirus does not block the connection.
  • ๐ŸŒ If you have a gray" IP (not white, the skid will not work โ€“ contact the provider for static IP.
How do you know if you have white? IP grey?
If your external IP (For example, 109.123.45.67) is the same as the service. 2ip.ru โ€” IP If not (e.g. 192.168.1.1) - gray, and port spilling is not possible without additional settings from the provider.
Mistake.Reason.Decision
The port is not open, although the rule is maintained.Conflict with UPnP or FirewallDisable UPnP and check for exceptions in the firewall
Outside IP pingoProvider locks in ICMP or gray IPCall the support provider and request white. IP
Port open, but no connection is establishedLocal device does not listen to portCheck if the service is running on the device (e.g. netstat) -ano | findstr 25565)

3. Opening ports on Xiaomi phones (Redmi, POCO, Mi)

On Xiaomi smartphones, opening ports is relevant for:

  • ๐Ÿ“ฑ ADB-Debugging (port 5555 for PC connection);
  • ๐Ÿ”ง Remote access (e.g., via TeamViewer or VNC);
  • ๐Ÿ•น๏ธ Game emulators (e.g, PPSSPP multiplayer).

Unlike routers, there's no "drift" here -- you just let an application use a network port. MIUI energy saving that can block connections.

Instructions for ADB (port 5555)

To open the port for ADB:

  1. Activate Developer Mode: Go to Settings โ†’ About Phone โ†’ MIUI version and tap 7 times.
  2. Enable USB debugging in Settings โ†’ Additional โ†’ For developers.
  3. Connect your phone to your PC and execute in the command line: adb tcpip 5555 adb connect IP_phone:5555

๐Ÿ’ก

If the adb connect command gives an error "cannot connect", check that the phone and PC are on the same network, and the firewall MIUI (Settings โ†’ Annexes โ†’ Permit management โ†’ Auto-start) does not block ADB.

Setup for remote access (VNC/RDP)

For applications like TeamViewer or RealVNC:

  1. Install the app from Google Play.
  2. Run it and write it down. ID device.
  3. In the application settings, allow AutoRun and turn off Battery Optimization for it.
  4. If you use VNC, Open port 5900 on the router (see section 2).

โš ๏ธ Note: Remote access applications (TeamViewer, AnyDesk) use their own intermediary servers, so port port port rolling on the router is not required. IP:port (e.g. through RDP or VNC).

4.Ports for Xiaomi smart devices (cameras, NAS, lamps)

Smart devices Xiaomi (Mi Home cameras, routers Mi WiFi, NAS Mi Storage often requires port openings to:

  • ๐Ÿ“น Viewing cameras from the outside (ports 80, 443, 554 for the RTSP);
  • ๐Ÿ’พ Access to NAS (port 21 FTP, 22 for SSH);
  • ๐Ÿ”Œ Smart home management via Mi Home (port 8080).

Xiaomi cameras (e.g. Mi Home Security Camera 360)ยฐ) By default, they use the cloud service for remote access, but if you want to connect directly to the Internet, IP, You will need to open port 554 for the protocol. RTSP. However, this only works with alternative firmware (such as Hack Mi Home Cameras), as standard Xiaomi software blocks local access.

Setup for Mi Home cameras

For direct connection to the camera:

  1. Install alternative software (e.g. iSpy or TinyCam Pro).
  2. Find the local. IP cameras in the Mi Home app (Device settings) โ†’ General information).
  3. On the router, flip port 554 (or another if you changed the camera settings) to IP camera.
  4. Use it for viewing. URL: rtsp://IP_camera:554/stream1

๐Ÿ’ก

Xiaomiโ€™s standard cameras do not support direct access. RTSP For a legal solution, use the Mi Home cloud service or buy cameras with support ONVIF (For example, Xiaomi Mi Home Camera 2K Pro).

Ports for Xiaomi NAS

For devices like Mi Storage or a hard drive connected to a router:

ServicePort portProtocolAppointment
FTP21TCPFile transfer
SSH22TCPRemote control
Samba445TCP/UDPNetwork folders (Windows)
HTTP80TCPWeb interface

For security: 1 Always change standard ports (e.g, SSH 22 to 2222); 2) Use complex passwords (generator: passphrase.ru); 3 IP router-setting.

5. Typical errors and their solutions

Even after you set up the ports correctly, here are the most common problems and ways to fix them:

Error 1: The port is open, but the connection is not established

Reasons:

  • ๐Ÿ”Œ Local device does not listen to the port (service is not running).
  • ๐Ÿ›ก๏ธ Firewall on the device blocks incoming connections.
  • ๐ŸŒ The provider blocks the port (especially for ports 80, 443, 25).

Decision: netstat -ano | findstr "port" (Windows) or ss -tulnp | grep port (Linux) โ€“ checks whether the host port is listening.

If not, run a service (e.g., a game server or a game server). FTP-demon).

Mistake 2: External IP pingo

If your external IP It doesn't respond to ping, it could mean:

  • Provider locks in ICMP-Packages (normal practice for safety).
  • You're gray. IP (see spoiler in section 2).
  • The router does not let ping into the external network (turn off Settings). โ†’ Security โ†’ Protection against DoS attacks).

Error 3: Port is running, but speed is low

A common problem with torrents or game servers.

  • ๐Ÿ“ถ The provider trotts traffic on certain ports (try changing the port, for example, from 6881 to 51413).
  • ๐Ÿ”„ Conflict with QoS on the router (disable in Settings) โ†’ Redirection โ†’ QoS).
  • ๐Ÿ“ก Wi-Fi signal weak (connect the device via cable).

๐Ÿ’ก

For torrents, use ports above 49152 (dynamic range). These are less likely to be blocked by providers. Example: 51413 (used in qBittorrent by default).

6. Alternatives to port opening

If the port port port port is not working (for example, due to gray IP) Or you donโ€™t want to risk security, consider alternatives:

1. Cloud services

For Xiaomi cameras: Mi Home Cloud is the official solution for remote viewing without opening ports. TinyCam Pro supports cloud connection to the cameras through the developer server.

2. VPN

Set up OpenVPN or WireGuard on Xiaomi router: Pros:

โœ… More secure than open ports;

โœ… He works with the grays. IP.

Cons

โŒ Requires server configuration (can be rented for a 3-5$/moss).

Instructions for Mi Router:

Settings โ†’ VPN โ†’ OpenVPN โ†’ Create a server

3. Services like Ngrok or Cloudflare Tunnel

These tools create a โ€œtunnelโ€ from the Internet to your local device without port-dropping.

Example for Ngrok:

  1. Download Ngrok from the official website.
  2. Register and get a token.
  3. Execute the command: ngrok authtoken your token ngrok tcp 25565
  4. Connect to the address. 0.tcp.ngrok.io:XXXX (where XXXX โ€” port).

๐Ÿ’ก

Ngrok and Cloudflare Tunnel are the best solutions for temporary access (for example, for project demonstration). VPS tune in VPN.

7.Security: How to Protect Open Ports

An open port is like an unlocked door, to minimize the risks of:

Basic protection measures

  • ๐Ÿ”’ Change the standard ports: For example, SSH 22 to 2222, RDP 3389 to 3390.
  • ๐Ÿ›ก๏ธ Use it. fail2ban: Utility locks in IP after several failed login attempts (install on a server or router with OpenWRT).
  • ๐Ÿ”‘ Turn off password authentication in favor of keys SSH.
  • ๐ŸŒ Restrict access by IP In the router settings (let only your own) IP).

Advanced protection

For critical services (e.g, RDP or FTP):

  • ๐Ÿ”„ Port knocking โ€“ the port opens only after a series of connections to closed ports.
  • ๐Ÿ›ก๏ธ Use a reverse proxy (such as Nginx) with authentication.
  • ๐Ÿ” Enable two-factor authentication (e.g., through Google Authenticator).

โš ๏ธ Attention: Port 3389 (RDP) โ€” One of the most attacked. If you want remote access to Windows, be sure to: 1) Change port to non-standard; 2) Set up Network Level Authentication (NLA); 3) Restrict access to IP Windows firewall.

FAQ: Frequent questions about opening ports on Xiaomi

Can I open ports on Xiaomi without a router (for example, via mobile Internet)?
No, port forwarding requires a white router. IP. When connecting via mobile Internet (4G/5G) Your phone gets gray. IP It's a carrier, and external devices won't be able to connect to you. Alternatively, you can use services like Ngrok or Cloudflare Tunnel.
How do I know which port my Xiaomi camera is using?
Standard ports for Mi Home cameras: 80 โ€“ web interface; 443 โ€“ secure connection; 554 โ€“ streaming video (RTSP); 34567 โ€” P2P-Connection (for cloud access), but standard Xiaomi software does not allow you to connect directly to the Internet. IP โ€” For local access, you need to install alternative firmware (for example, Hack Mi Home Cameras).
Why does the connection only work on the local network after the port is rolled over?
Probable reasons: 1 You have a gray IP (check through 2ip.ru); 2) Provider blocks incoming connections (call for support); 3) No settings are saved on the router (reboot it); 4) Local device blocks the connection with firewall (check settings MIUI Windows Defender).
How to open a port for torrents on Xiaomi?
To speed up torrents: In the client (qBittorrent, uTorrent), set a static port (for example, 51413). On the router, throw this port to the IP Your PC/phone (see section) 2). In the torrent client settings, enable UPnP and NAT-PMP (But you better turn them off after manually dropping them off. Check the port on YouGetSignal. If the speed hasn't increased, try changing the port to another one in the range. 49152-65535.
Can I open a port on Xiaomi via the Mi Home app?
No. Mi Home does not provide port-driving features; it is only configured via the router's web interface (192.168.31.1) or alternative firmware (e.g. Padavan), except for cloud-access smart devices (cameras, light bulbs) where no pass-through is required.