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

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

parent d05dd1b3
...@@ -43,19 +43,27 @@ fi ...@@ -43,19 +43,27 @@ fi
echo "Windows VM IP Address: $VM_IP" echo "Windows VM IP Address: $VM_IP"
# On the Docker HOST, add a rule to the DOCKER-USER chain to allow # Enable IP forwarding and configure NAT
# incoming RDP traffic to be forwarded to the container. echo "Enabling IP forwarding and NAT for RDP..."
# This is the correct way to allow traffic when the FORWARD policy is DROP. sysctl -w net.ipv4.ip_forward=1
echo "Allowing RDP forwarding on the Docker host..."
iptables -I DOCKER-USER -p tcp --dport 33890 -j ACCEPT # iptables에 필요한 커널 모듈 로드
echo "Loading required kernel modules for iptables..."
# Inside the container, configure iptables for RDP port forwarding to the VM modprobe ip_tables
echo "Configuring iptables for RDP..." 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 PREROUTING -p tcp --dport 3389 -j DNAT --to-destination "$VM_IP":3389
iptables -t nat -A POSTROUTING -j MASQUERADE iptables -t nat -A POSTROUTING -j MASQUERADE
echo "Port forwarding rule added." # Configure RDP forwarding inside the container
echo "RDP connections to this container on port 3389 will be forwarded to the Windows VM." 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 # Keep the container running
echo "Container is running. Use 'docker exec' to access it." 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