vritual box linux桥接网络配置

来源:互联网 发布:js对象数组按属性排序 编辑:程序博客网 时间:2024/06/18 14:59

 反反复复的总因为一点小问题折腾好久    

      这次把我遇到的问题都记录下来。最简单 。  不解释无关参数

            

     1.网卡配置:

device

hwaddr

type=Ethernet

onboot=yes

bootproto=static

ipaddr=      此处与主机同网段无冲突就行

netmask=255.255.255.0

gateway=  与主机的dns相同

dns1 = 与主机的dns相同   

  

    2.关闭SELINUX和防火墙(主机防火墙最好也关闭了)

    查看selinux状态

   [root@localhost ~]# sestatus -v
    SELinux status:                 disabled

  关闭selinux

  

1、临时关闭(不用重启机器):

setenforce 0      ##设置SELinux 成为permissive模式

setenforce 1     ##设置SELinux 成为enforcing模式

2、修改配置文件需要重启机器:(永久关闭)

修改/etc/selinux/config 文件

将SELINUX=enforcing改为SELINUX=disabled

  

   防火墙

 查询防火墙状态

[root@localhost ~]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination        
Chain FORWARD (policy ACCEPT)
target     prot opt source               destination        
Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination          
 
临时关闭  : service iptables stop
永久关闭  : chkconfig iptables off


     虚拟机下的几个关键选项  (掉坑里好多次) 
       
    很容易忽视这个问题。