Port forwarding (or port forwarding) on Xiaomi router is a key feature for those who want to organize remote access to the home network. It is necessary to do without it when setting up a game server, connecting a IP- camera over the Internet or working with NAS- drives. However, many users face difficulties: the settings do not remain, the external IP does not ping, the router blocks traffic. In this article, we will discuss the process from A to Z - from network preparation to testing the result.
Itβs important to understand that port rollout is not just a tick in the settings, but a set of measures that includes the configuration of the router, setting up the firewall on the device and sometimes even changing the providerβs parameters. We will focus on the current Xiaomi Mi Router 4/4A/5/6 models (including the MiWiFi ROM and OpenWRT firmware), but the principles apply to other devices of the brand. If you have never visited the routerβs administrator panel, donβt worry: we will explain each step in as much detail as possible.
Before you start, check two key points: you should have a static local IP for the device you're tapping into, and a white (public) IP- address from the provider. Without this, the skip just won't work. If you don't know how to check it, don't miss the section on preparation!
1.Preparation for port transfer: what to do before setting up a router
Many users jump right into the router settings, but 90% of the redirect problems are due to an unprepared network.
- π Check the type of IP- addresses from the provider. Go to 2ip.ru β if your IP starts with 10., 192.168. or 172.16., you have a gray IP, and the dashboard wonβt work without additional actions (read the section on CGNAT).
- π‘ Lock the local IP device. If your computer or camera receives IP from DHCP, it may change after the router restarts. Attach MAC- device address to static IP in the settings DHCP β Address Reservation.
- π Turn off the firewall on the target device. Even if the dash is configured correctly, Windows firewalls or iptables on Linux can block incoming connections. Check the firewall rules!
- π Refine port requirements. For example, a Minecraft server needs a 25565 port, and a RTSP- camera stream needs a 554 port. Some applications require port bandwidth (e.g., 30000-30010 for a utorrent).
Pay special attention to the item with IP- address. If you have Beeline, MTS or Rostelecom with CGNAT technology, the standard methods will not work, in which case you will either need to order a white IP from the provider (often a paid option), or use bypass solutions like Cloudflare Tunnel or Ngrok. We will come to this later.
2. Entry into the Administrator Panel of the Xiaomi router: where to look for settings
To set up a redirect, you need to go to the router's web interface, and you can do this in two ways:
- Browser via IP- address: Connect to the router network via Wi-Fi or cable. Open your browser and type in the address bar 192.168.31.1 (for most Xiaomi models) or miwifi.com. Enter your login and password (by default - admin and password from the sticker on the router).
- Through the Mi Wi-Fi app (mobile): Download the app from Google Play or the App Store. Connect to the router network and open the app. Go to Settings β Additional β Port Redirects.
If the page does not open, check:
- π Are you connected to the right network (not the guest network)?
- π§ Does the antivirus (e.g. Kaspersky or Avast) block access to local IP
- π‘ Whether the network settings have gone wrong after the router is reset (try 192.168.0.1 or 192.168.1.1).
π‘
If you forget the password from the router, reset it to factory settings by pressing the Reset button on the 10 seconds. After resetting, the login / password will become standard (admin/ password from the sticker).
3. Step-by-step set up port forwarding on the MiWiFi ROM firmware
Consider the process using the standard firmware MiWiFi ROM (installed on most Xiaomi routers by default) and the instructions are suitable for Mi Router 4/4A/5/6 models and their modifications.
Steps:
- Open the redirect section: Go to Additional β Port forwarding (or Advanced β Port Forwarding in English). Where to look for configuration on older versions of firmware?On firmware until 2021, the section could be called NAT forwarding or Virtual servers.
- Add a new rule: Click Add a rule and fill in the fields: Rule name: arbitrary (e.g., "Minecraft Server"). Protocol: select TCP, UDP or TCP/UDP (if you're not sure, choose the latter option). External port: port that will be opened "outside" (e.g., 25565 for Minecraft). Internal port: port on the target device (often the same as the external device). Internal IP: local IP device (e.g., 192.168.31.100).
Save and apply
Click Save and restart the router (optional, but recommended for changes).
Example of filling for IP- camera:
| Parameter | Meaning | Explanation |
|---|---|---|
| Name of the rule | IP Camera RTSP | arbitrary name |
| Protocol | TCP/UDP | RTSP can use both protocols. |
| Outer port | 554 | Standard port for RTSP- stream |
| Inland port | 554 | It matches the outside. |
| Internal IP | 192.168.31.200 | IP camera on a local network |
Correct local IP device |Ports do not conflict with other rules |Protocol (TCP/UDP) complies with the requirements of the application |External port is not used by the provider (for example, 80 or 443 may be blocked)
-->
A critical feature of Xiaomi routers is that once you add a redirect rule, it may not appear in the list before the device is restarted. Donβt worry β just restart the router through System Settings β Reboot.
4. port port transfer on alternative firmware (OpenWRT, Padavan)
If your router runs on custom firmware (like OpenWRT or Padavan), the process will be different.
For OpenWRT:
- Go to the web interface (192.168.1.1 by default).
- Go to Network β Firewall β Port Forwards.
- Click Add and fill in: Name: arbitrary name. Protocol: TCP/UDP. External zone: wan. External port: port outside (e.g. 8080). Internal IP: local IP of devices. Internal port: port on the device.
Save & Apply
For Padavan:
- Go to Advanced Settings β NAT Passthrough.
- In Port Forwarding, add the rule: Rule Name: rule name. External Port: external port. Internal IP:Port: local IP and port (e.g. 192.168.1.100:80). Protocol: TCP/UDP/Both.
Save the settings and restart the router.
π‘
On custom firmware, port port port overlay often requires additional firewall settings (iptables). If the rule does not work, check router logs via SSH with logread | grep DROP.
5.Redirecting Check: How to Make Sure Everything Is Configured Correctly
So you can set up the scattering, half the way, and now you have to check if it works. Here are 3 reliable methods.
- π Online Services: Use YouGetSignal or PortChecker. Enter your external IP (you can find out at 2ip.ru) and the port will show if it is open.
- π» Telnet/NC Test: From another device (e.g., a mobile phone over the Internet), run the command: telnet [your external IP] [port] If the connection is established, the airbrush works. Windows may need Ncat.
- π± Mobile Apps: Install Network Scanner (Android) or Fing (iOS) and scan the port.
If the port is closed:
β οΈ Warning: A common mistake is checking the pass-through from the LAN, so you're testing internal routing, not external access, always checking from a device connected to another network (e.g., mobile Internet).
Another common problem is dual NAT (when you have two routers, for example, from the provider + Xiaomi), in which case you either need to configure the bridge mode on the first router or to flip ports on both devices.
6. Problem Solving: Why Redirection Doesn't Work
If youβve set up everything but the port still doesnβt open, hereβs a list of possible causes and solutions:
| Problem. | Reason. | Decision |
|---|---|---|
| The port doesn't open outside. | Gray IP (CGNAT) from the provider | Order white IP or use Cloudflare Tunnel/Ngrok |
| The rule is maintained but not applied | Conflict with other rules or firewall | Delete all the rules and add them again. Check the router logs. |
| Port open, but no connection is established | Firewall on target device blocks traffic | Turn off the firewall temporarily or add an exception for the port. |
| After the router restarts, the rule disappears. | Firmware failure or lack of memory | Update the firmware or reset the router to factory settings. |
It is especially difficult to diagnose problems if you have a dynamic external IP. In this case, after each router reboot (or a connection break with the provider), your IP may change.
- π DDNS: Configure dynamic DNS (e.g., via No-IP or built-in Xiaomi service DDNS).
- π‘ Order static IP: Many providers provide it for an additional fee.
How to check if your external IP is changing?
7. Alternative methods of access without port transfer
If port spillage is not possible (for example, due to CGNAT), consider alternative solutions:
- π Cloud services: Cloudflare Tunnel: creates a secure tunnel to your device without opening ports. Ngrok: provides public URL for a local server (free to 40 connections/min). LocalXpose: analog Ngrok with a large traffic limit.
- π VPN- Server on a router: Set up WireGuard or OpenVPN on a router, which will allow you to connect securely to your home network from anywhere in the world.
- π¦ P2P- Solutions: Some IP- cameras (e.g. Xiaomi Mi Home Camera) support P2P- connection through the manufacturer's cloud - port rollover is not required.
Example of Cloudflare Tunnel setup:
- Install cloudflared on your device on a local network (for example, on a Raspberry Pi or PC).
- Sign in via cloudflared tunnel login.
- Create a tunnel and provide a local address (e.g. http://192.168.31.100:80).
- Set up a DNS- record in Cloudflare Dashboard by specifying a domain (e.g. home.yourdomain.com).
The advantage of this approach is security (no open ports) and circumvention of CGNAT. The disadvantage is dependence on a third-party service.
8 Security: How to prevent hackers from accessing
Port port port port port port port port port is not only a convenience, but also a potential vulnerability, an open port can become an entry point for attacks.
- π Use custom ports: For example, choose 8085 or 22 instead of 80 (HTTP) or 22 (SSH. This will make it harder for bots to scan your network.
- π‘οΈ Restrict access to IP: In the rollover rule, specify the allowed IP- addresses (if the router supports). For example, allow only your workman to connect IP.
- π Regularly update your firmware: Outdated versions of MiWiFi ROM contain vulnerabilities. Check for updates to System Settings β Update to firmware.
- π Set up authentication: For services like SSH or RDP, turn off password login, use access keys.
β οΈ Note: Never scatter ports 80.HTTP) and 443 (HTTPS) on Xiaomi routers with standard firmware β this can lead to remote exploitation of vulnerabilities in the routerβs web interface. Use a reverse proxy (such as Nginx) or VPN.
If you want remote router administration, you'd better set up a VPN- server (like WireGuard) and connect through it, which is safer than opening the web interface out.
π‘
Even if you only skip a port for "your own needs," hackers scan the networks for open ports automatically. Always assume that your open port will be found within a day.