데비안 호스트와 우분투 게스트가 있습니다. 포트 8055를 사용하여 외부에서 웹 서버(포트 80)에 연결하고 싶습니다. 나는 이 "해킹"을 시도했다http://wiki.libvirt.org/page/Networking#Forwarding_Incoming_Connections 그러나 성공하지 못했습니다. 그런 다음 수동 iptables를 시도했습니다.
iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 8055 -j DNAT --to-destination 192.168.122.234:80
iptables -A FORWARD -p tcp -d 192.168.122.234 --dport 8080 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
아무것도 작동하지 않습니다. 나는 당신과 무엇을 더 공유해야할지 모르겠습니다.
root@ms532:~# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT udp -- anywhere anywhere udp dpt:domain
ACCEPT tcp -- anywhere anywhere tcp dpt:domain
ACCEPT udp -- anywhere anywhere udp dpt:bootps
ACCEPT tcp -- anywhere anywhere tcp dpt:bootps
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere 192.168.122.0/24 state NEW,RELATED,ESTABLISHED
ACCEPT tcp -- anywhere 192.168.122.234 state NEW tcp dpt:9901
ACCEPT tcp -- anywhere 192.168.122.234 state NEW tcp dpt:http
ACCEPT all -- anywhere 192.168.122.0/24 ctstate RELATED,ESTABLISHED
ACCEPT all -- 192.168.122.0/24 anywhere
ACCEPT all -- anywhere anywhere
REJECT all -- anywhere anywhere reject-with icmp-port-unreachable
REJECT all -- anywhere anywhere reject-with icmp-port-unreachable
ACCEPT all -- anywhere 192.168.122.0/24 state NEW,RELATED,ESTABLISHED
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ACCEPT udp -- anywhere anywhere udp dpt:bootpc