VMware安装CentOS 6.8教程:
---传送门-->
可能是史上最详细的VMware安装Centos 6.8 minimal版图文教程
1.VMware中虚拟网络编辑器设置
2.查看系统IP地址与网关
3.编辑虚拟机设置,添加网络适配器
若没有网络适配器则添加即可
4.Windows端网络配置
5.虚拟机中网络配置
[root@192 ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens32 TYPE=Ethernet #网络类型,以太网 PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static #启用静态IP地址 DEFROUTE=yes IPV4_FAILURE_FATAL=no NAME=ens32 #网卡设备名,请勿修改名字 UUID=501ee3a3-7dc9-4ed6-b77a-78e7bc98d35a DEVICE=ens32 ONBOOT=yes #开启自动启用网络连接 IPADDR=192.168.0.155 #设置IP地址 PREFIX=24 #子网掩码 GATEWAY=192.168.0.1 #设置网关 DNS1=192.168.0.1 #设置DNS(根据自身的网络环境配置相应的DNS地址)
5.查看虚拟机IP地址
[root@192 ~]# yum search ifconfig //搜索含有ifconfig命令的安装包 已加载插件:fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com ================================== 匹配:ifconfig =================================== net-tools.x86_64 : Basic networking tools [root@192 ~]# yum -y install net-tools [root@192 ~]# ifconfig ens32: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.0.155 netmask 255.255.255.0 broadcast 192.168.0.255 inet6 fe80::20c:29ff:febb:482b prefixlen 64 scopeid 0x20<link> ether 00:0c:29:bb:48:2b txqueuelen 1000 (Ethernet) RX packets 754 bytes 62909 (61.4 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 455 bytes 49140 (47.9 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@192 ~]# cat /etc/resolv.conf //DNS配置文件中的地址会根据各个网卡中配置的DNS地址而自动发生改变 # Generated by NetworkManager nameserver 192.168.0.1
6.测试外网
[root@192 ~]# ping -c 2 192.168.0.1 //ping网关地址 PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data. 64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=0.919 ms 64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=1.18 ms --- 192.168.0.1 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1001ms rtt min/avg/max/mdev = 0.919/1.052/1.185/0.133 ms [root@192 ~]# ping -c 2 www.baidu.com //ping百度 PING www.a.shifen.com (14.215.177.38) 56(84) bytes of data. 64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=1 ttl=54 time=33.5 ms 64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=2 ttl=54 time=33.7 ms --- www.a.shifen.com ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1000ms rtt min/avg/max/mdev = 33.539/33.662/33.785/0.123 ms
可以看到网络已经通了。
注意:
使用桥接模式的过程中,如果更换网络环境,则需要修改虚拟机中的网卡配置,修改IP地址、子网掩码、DNS等配置,如果是同一网络环境断网重连后,使用桥接模式的虚拟机可能会出现无网络的情况,这个时候不需要修改虚拟机配置,只需要将电脑网络适配器中的桥接虚拟网卡“禁用”,在重新“启用”,重启一下虚拟机中的网络,网络就会恢复。