Commit 1f4e6c8c authored by insun park's avatar insun park
Browse files

fix: docker-windows-vm의 iptables 오류 수정

parent d05dd1b3
......@@ -43,19 +43,27 @@ fi
echo "Windows VM IP Address: $VM_IP"
# On the Docker HOST, add a rule to the DOCKER-USER chain to allow
# incoming RDP traffic to be forwarded to the container.
# This is the correct way to allow traffic when the FORWARD policy is DROP.
echo "Allowing RDP forwarding on the Docker host..."
iptables -I DOCKER-USER -p tcp --dport 33890 -j ACCEPT
# Inside the container, configure iptables for RDP port forwarding to the VM
echo "Configuring iptables for RDP..."
# Enable IP forwarding and configure NAT
echo "Enabling IP forwarding and NAT for RDP..."
sysctl -w net.ipv4.ip_forward=1
# iptables에 필요한 커널 모듈 로드
echo "Loading required kernel modules for iptables..."
modprobe ip_tables
modprobe iptable_nat
modprobe nf_nat
modprobe xt_conntrack
iptables -t nat -A PREROUTING -p tcp --dport 3389 -j DNAT --to-destination "$VM_IP":3389
iptables -t nat -A POSTROUTING -j MASQUERADE
echo "Port forwarding rule added."
echo "RDP connections to this container on port 3389 will be forwarded to the Windows VM."
# Configure RDP forwarding inside the container
echo "Allowing RDP forwarding to the VM..."
iptables -I FORWARD -d "$VM_IP" -p tcp --dport 3389 -j ACCEPT
iptables -I FORWARD -s "$VM_IP" -j ACCEPT
# Keep the container running to maintain the VM session
echo "Windows VM is running. You can connect via RDP at $VM_IP."
# Keep the container running
echo "Container is running. Use 'docker exec' to access it."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment