Azure虚拟机端口配置求助:保留RDP(3389)并转发端口5552
Alright, let's get your RAT port 5552 set up in Azure while keeping RDP (3389) accessible. Here's a step-by-step guide tailored to your needs:
Step 1: Find your Virtual Machine's Network Security Group (NSG)
Azure uses NSGs to control inbound/outbound traffic to VMs, so this is where we'll add the port rule:
- Log into the Azure Portal and navigate to your target virtual machine.
- In the left-hand menu under Settings, click Networking.
- Look for the linked NSG (you'll find it under the "Network interface" section, labeled "Network security group"). Click that link to open the NSG configuration.
Step 2: Add an Inbound Security Rule for Port 5552
This rule will allow external traffic to reach your VM on port 5552:
- In the NSG menu, select Inbound security rules from the left sidebar.
- Click the Add button at the top of the page.
- Fill in the rule details:
- Name: Pick something descriptive, like
Allow-RAT-5552 - Priority: Choose a number that doesn't conflict with existing rules (e.g., 900 if your RDP rule is set to 1000—lower numbers mean higher priority)
- Source: Select "Any" if you need access from anywhere, or "IP Addresses" and input your specific IP for tighter security
- Source port ranges: Leave as
*(all ports) - Destination: Keep as "Any" (or target your VM's subnet if preferred)
- Destination port ranges: Enter
5552 - Protocol: Select
TCP(most RAT tools use TCP; pick UDP if your tool requires it) - Action: Choose Allow
- Description: Optional, but helpful to note this is for your RAT tool
- Name: Pick something descriptive, like
- Click Add to save the rule.
Step 3: Allow Port 5552 in Your VM's OS Firewall
The Azure NSG rule lets traffic reach the VM, but you also need to permit it through the VM's local firewall:
For Windows VMs:
- RDP into your VM using port 3389 (this should still work as long as you didn't modify its NSG rule)
- Open Windows Defender Firewall with Advanced Settings
- Right-click Inbound Rules and select New Rule
- Choose Port > Click Next
- Select TCP, enter
5552in "Specific local ports" > Click Next - Choose Allow the connection > Click Next
- Check the network profiles that apply to your setup (Domain, Private, Public) > Click Next
- Name the rule (e.g.,
RAT-Port-5552) > Click Finish
For Linux VMs:
- SSH into your VM (or use RDP if you have it set up)
- Run this command to allow TCP traffic on 5552:
If you don't usesudo ufw allow 5552/tcpufw, useiptablesinstead:sudo iptables -A INPUT -p tcp --dport 5552 -j ACCEPT sudo iptables-save > /etc/iptables/rules.v4
Step 4: Verify the Configuration
- Test if port 5552 is open from your local machine using:
Or on Windows:nc -zv <your-vm-public-ip> 5552telnet <your-vm-public-ip> 5552 - Double-check that RDP (3389) still works by connecting to your VM as usual—this confirms you didn't disrupt existing access.
内容的提问来源于stack exchange,提问作者M. Simon
相关产品推荐
相关产品推荐

