Mik*_*e S 1 remote virtualbox centos apache-2.2
我正在尝试在 Windows 7 主机盒上使用 CentOS 6 Minimalist Install 和 VirtualBox 4.1.4r74291 在 VM 中构建 CI 服务器。
在你问之前:
这是一些命令输出:
ifconfig -a eth1
eth1 Link encap:Ethernet HWaddr 08:00:27:2B:4E:3C
inet addr:192.168.1.104 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe2b:4e3c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:320629 errors:0 dropped:0 overruns:0 frame:0
TX packets:171826 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:445888239 (425.2 MiB) TX bytes:14540682 (13.8 MiB)
nmap localhost
Nmap scan report for localhost (127.0.0.1)
Host is up (0.0000080s latency).
Hostname localhost resolves to 2 IPs. Only scanned 127.0.0.1
Not shown: 994 closed ports
PORT STATE SERVICE
22/tcp open ssh
25/tcp open smtp
80/tcp open http
8009/tcp open ajp13
8080/tcp open http-proxy
9418/tcp open git
Nmap done: 1 IP address (1 host up) scanned in 0.09 seconds
iptables -vL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
315K 441M ACCEPT all -- any any anywhere anywhere state RELATED,ESTABLISHED
0 0 ACCEPT icmp -- any any anywhere anywhere
6010 281K ACCEPT all -- lo any anywhere anywhere
4 208 ACCEPT tcp -- any any anywhere anywhere state NEW tcp dpt:ssh
8676 668K REJECT all -- any any anywhere anywhere reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 REJECT all -- any any anywhere anywhere reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT 184K packets, 13M bytes)
pkts bytes target prot opt in out source destination
netstat -aln | grep 80
tcp 0 0 :::8009 :::* LISTEN
tcp 0 0 :::8080 :::* LISTEN
tcp 0 0 :::80 :::* LISTEN
tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN
unix 2 [ ACC ] STREAM LISTENING 8093 public/cleanup
unix 3 [ ] STREAM CONNECTED 8099
unix 3 [ ] STREAM CONNECTED 8098
unix 3 [ ] STREAM CONNECTED 8096
unix 3 [ ] STREAM CONNECTED 8095
unix 3 [ ] STREAM CONNECTED 8092
unix 3 [ ] STREAM CONNECTED 8091
unix 3 [ ] STREAM CONNECTED 8089
unix 3 [ ] STREAM CONNECTED 8088
unix 2 [ ] DGRAM 8054
unix 2 [ ] DGRAM 8013
Run Code Online (Sandbox Code Playgroud)
来自主持人:
telnet 192.168.1.104 80
Could not open connection to the host, on port 80: Connect failed
Run Code Online (Sandbox Code Playgroud)
所以,两个端口都是开放的,看起来防火墙允许从外部连接这些端口(但是,说实话,我只是猜测。我真的不知道如何读取输出来自iptables -L
.) 然而,每当我尝试从主机访问 Chrome 中的 192.168.1.104:(80|8080) 时,我都会得到臭名昭著的:
Oops! Google Chrome could not connect to 192.168.1.104
Run Code Online (Sandbox Code Playgroud)
这是可能的,因为我之前通过 Kubuntu 安装(仍然是 .1.103)完成了它,并且我试图移动到内存占用较小且安全性更高的虚拟机。
有什么建议?需要更多信息?此刻我全神贯注。
编辑:
在遵循 Janne 的回答之后,httpd 现在正在侦听192.168.1.104:80
. 因此,我不能再 lynx 到 localhost,并且执行 awget 127.0.0.1
会给我一个连接被拒绝的错误。这是合适的,因为现在我必须lynx/wget 192.168.1.104
得到我事先得到的结果 127.0.0.1(分别来自 Apache 的“It Works!”页面和 index.html 的下载。)也许是另一个线索?
我在您的 iptable4s 中没有看到允许在端口 80 上进行连接的规则(除了在 lo 上的毯子允许)尝试打开端口 80
iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT
Run Code Online (Sandbox Code Playgroud)
或者
iptables -I INPUT -i eth1 -p tcp -m tcp --dport 80 -j ACCEPT
Run Code Online (Sandbox Code Playgroud)
如果您想限制对 eth1 上的连接的访问。