我跟着这在我的 ubuntu 服务器上安装 KVM 虚拟机的教程。现在我需要将一个端口从客户机绑定到主机。我尝试了几个教程来绑定端口,但都没有用。
我的设置是:
主机:Ubuntu 14.04,IP:192.168.122.1(KVM IP),我可以访问主机的 IP:10.211.55.4
eth1 Link encap:Ethernet HWaddr 00:1c:42:d0:7a:75
inet addr:10.211.55.4 Bcast:10.211.55.255 Mask:255.255.255.0
inet6 addr: fe80::21c:42ff:fed0:7a75/64 Scope:Link
inet6 addr: fdb2:2c26:f4e4:0:21c:42ff:fed0:7a75/64 Scope:Global
inet6 addr: fdb2:2c26:f4e4:0:19bb:354a:25f2:6d0f/64 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:701 errors:0 dropped:0 overruns:0 frame:0
TX packets:218 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:110682 (110.6 KB) TX bytes:28366 (28.3 KB)
virbr0 Link encap:Ethernet HWaddr fe:54:00:9e:7b:58
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:131 errors:0 dropped:0 overruns:0 frame:0
TX packets:112 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:15021 (15.0 KB) TX bytes:11985 (11.9 KB)
访客:Ubuntu 14.04,IP:192.168.122.141
eth0 Link encap:Ethernet HWaddr 52:54:00:9e:7b:58
inet addr:192.168.122.141 Bcast:192.168.122.255 Mask:255.255.255.0
inet6 addr: fe80::5054:ff:fe9e:7b58/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:404 errors:0 dropped:3 overruns:0 frame:0
TX packets:186 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:33867 (33.8 KB) TX bytes:24842 (24.8 KB)
有人能帮我把客户机上的 80 端口绑定到主机吗,这样我就可以从客户机上获取 web 服务器了http://10.211.55.4?
提前致谢!
答案1
您可以将 VM iface 桥接到“外部”网络,或者设置 iptables 并为所需的端口创建 DNAt 条目。