Note: Detailed analysis of specific operations see: http://www.wtoutiao.com/a/2362248.html Brief steps:
first, in the virtual machine selection bridge mode;
Second, the preparation of networks, so that virtual machines and hosts, virtual machines and virtual machines can be network interoperability between;
1, using the Setup tool for configuration; 2, or select Edit Text to configure;
vi /etc/sysconfig/network-scripts/ifcfg-eth0
- Service network restart; After the configuration is complete, the network must be restarted to take effect;
- [Email protected] ~]$ cat/etc/sysconfig/network-scripts/ifcfg-eth0# Broadcom Corporation netxtreme II BCM5709 Gigabit E thernetdevice=eth0bootproto=staticbroadcast=10.151.18.255hwaddr=00:26:b9:3f:2a:9fipaddr=10.151.18.26netmask= 255.255.255.0network=10.151.18.0onboot=yesgateway=10.151.18.28type=ethernetuserctl=noipv6init=nopeerdns=yes
//Configure the network according to the actual situation, after the configuration completes the host and the virtual function communicates with each other, tries to ping the virtual machine in the host;
[[email protected] /]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
HWADDR="00:0C:29:EC:1D:DE"
NM_CONTROLLED="yes"
ONBOOT=YES
IPADDR=192.168.0.22 //ip地址
NETWORK=192.168.0.1 //
NETMASK=255.255.255.0 //掩码
BROADCAST=192.168.0.255 //广播地址
DNS1=172.16.99.25 //按照主机的DNS配置
DNS2=172.16.99.26
GATEWAY=192.168.0.1 //网关
Example :
Third, configure DNS VI/etc/Sysconfig/Network-Scripts/ifcfg-eth0 in the network card configuration file Ifcfg-eth0, add the DNS provisioning, directly follow the host's DNS information to configure the line. after configuration, perform service network restart, make the net effective, test ping www.baidu.com;
Four, if the configuration of DNS, can not access the external network, the problem is also the need to configure the default gateway;
The discovery or ping does not pass. What's going on?
To configure the gateway:
DNS settings Yes, or ping does not pass www.baidu.com
Check that it is now possible to ping the host, the virtual machine, and the gateway. And DNS is also formulated correctly, supposedly, should be able to access the outside network AH.
But there is a critical step: the configuration of the default gateway, not done. How to communicate with the outside world without the configuration of the default gateways?
Okay, let's do it now. To configure a gateway: There are two ways
The first method: temporary configuration via the command line:
Add a default gateway to the command line:
Route add Defalult GW 192.168.1.1
The default gateway, which is the case where the corresponding route is not found, takes this route (the default gateway), which is the setting necessary to set up access to the extranet.
In order not to affect the following steps, first delete the command line prepared gateway
To delete the default gateway:
Route del default GW 192.168.1.1
The second method: in the network card configuration file for permanent configuration, pay attention to the Red label section. This is done, and you need to restart the network.
From for notes (Wiz)
Linux Configuration network detailed analysis, Sisu network