1.环境

centos6.4

vm player

nginx1.8

2.虚拟机的防火墙

参考http://blog.csdn.net/qilovehua/article/details/45507135

/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT

不知道为什么不能保存,即使iptables-save也不行啊。

我也不是运维,不想花太多时间磨蹭这个。

硬方法就是sudo vim /etc/sysconfig/iptables

查看添加的效果,复制编辑-j ACCEPT 的行。

vi的复制一行,直接yyp,然后8w跳单词改成80

查看当前的效果 sudo iptables -L -n

如果没有刷新,用sudo service iptables restart

如果不配置的话,宿主机能ping通虚拟机但是浏览器不能访问。

# Generated by iptables-save v1.4.7 on Tue Oct 10 15:35:17 2017
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [9675:529327]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 6379 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 7001:7006 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Completed on Tue Oct 10 15:35:17 2017
~                                                                                                                                                                    
~                                                

以上就是我的配置

3.桥接

桥接,虚拟机改为静态ip

4.nat

nat,用动态ip就行,不用改

nat的端口转换。

C:\ProgramData\VMware\vmnetnat.conf

修改为

# WEB (make sure that if you are using named webhosting, names point to
# your host, not to guest... And if you are forwarding port other
# than 80 make sure that your server copes with mismatched port
# number in Host: header)
# lynx http://localhost:8888
8888 = 192.168.190.128:80

此时访问127.0.0.1:8888即可

5.宿主机的防火墙

虚拟机ping宿主机也是ping不通,关掉防火墙就ping通了

应该开放个端口就行了,以后有需求再处理。

6.吐槽vbox

1.安装分类太少,连centos分类都找不到

2.centos无法安装,卡在centos安装界面的logo那里。

3.今天一打开提示升级,一点击确定程序崩溃,自动关闭。

 

相关文章:

  • 2021-10-17
  • 2021-06-04
  • 2021-07-09
  • 2021-07-08
  • 2021-09-26
  • 2021-08-18
  • 2021-12-29
  • 2022-12-23
猜你喜欢
  • 2021-12-15
  • 2022-03-02
  • 2021-07-02
  • 2021-05-19
  • 2022-01-04
  • 2021-10-14
  • 2021-06-25
相关资源
相似解决方案