VMware Bridge mode under CentOS, static IP sisu Network

Source: Internet
Author: User
Tags domain name server

Bridge network card Selection on window with Ipconfig/allcentos under VMware Bridge mode, static IP sisu Network

15, wrote a blog: VMware network settings Bridged is also about Linux under the VMware Bridge mode, static IP sisu network configuration, but at that time more is to use the graphical interface to achieve, the versatility is not strong. Production environment, very few Linux installation graphical interface. Even the original blog is not modified, a re-article won. Here I am using CentOS6.5 's minimal system to demonstrate. Currently, because CentOS belongs to the Red Hat family, the approach described in this article applies to the Linux network configuration of the Redhat series.

First, the bridge mode VMware settings:

Vmware-> "edit" and "Virtual Network edit"

Second, the bridge mode virtual machine settings:

Third, the bridge mode setting static IP address

A virtual machine configured as a bridge network connection mode is considered as part of the Ethernet of the host, and the relationship between the virtual system and the host machine, like two computers connected to the same hub, can access all the shared resources and network connections in the Ethernet as a host. You can access the Internet directly by sharing the Internet access line of the host network. You can exchange visits between the host and the virtual machine, as well as between the virtual machines. The corresponding virtual machine is considered as an independent physical machine on the host Ethernet, and the virtual machine is connected with the host Ethernet through the default VMNET0 network card, and the virtual network between virtual machines is VMnet0. Your virtual machine is like a standalone physical machine in a local area network. The operating system in the virtual machine can ping the other host, which in turn can ping the virtual machine. To make them communicate with each other, you need to configure the IP address and subnet mask for the virtual system, or you will not be able to communicate.

So before I configure, I want to take a look at the IP address of the physical host: (I am here the physical host with WiFi card WiFi internet access)

1. Ipconfig view the IP address of the physical host (the IP address of the network card used by the Sisu network)

2. Set the IP address of the Linux virtual machine according to the IP address of the physical host:
Vim/etc/sysconfig/network-scripts/ifcfg-eth0device=eth0        #虚拟机网卡名称. Type=ethernetonboot=yes      #开机启用网络配置. Nm_controlled=yesbootproto=static      #static, static IP, rather than DHCP, automatically obtains an IP address. ipaddr=192.168.31.77 #设置我想用的静态ip地址 to the same network segment as the physical host, but not the same. netmask=255.255.255.0  #子网掩码, just like a physical host. getway=192.168.31.1   #和物理主机一样DNS1 =8.8.8.8 #DNS, to write Google's address on it. Hwaddr=00:0c:29:22:05:4cipv6init=nouserctl=no

I use Xshell to connect to Linux, so it looks more clear:

Restart Network Service:

[Email protected] ~]# service network restart

3. Add the gateway address in the network profile/etc/sysconfig/network.

[Email protected] ~]# vim/etc/sysconfig/networknetworking=yeshostname=xiaolyu77gateway=192.168.31.1   #网关地址, Gateway address of the same physical host

4. Test: 1) Virtual Machine Ping Physical host:

[[email protected] ~]# Ping 192.168.31.160

2) Physical host ping virtual machine

C:\users\administrator>ping 192.168.31.77

3) Virtual machine Test External network:

[[email protected] ~]# Ping www.baidu.com

OK, get it done!

5. Question: If still cannot sisu the net, appears: "Ping:unknown host Www.baidu.com"

If a Linux server ping does not pass the domain name, the following prompt:

[[email protected] ~]# Ping www.baidu.com
Ping:unknown Host Www.baidu.com

Solution:

First determine that the router is connected and the router has access to the extranet, which can be determined by accessing the gateway

[[email protected] ~]# Ping 192.168.31.1

If you determine that the network is not a problem, you can find a workaround by following these steps:

1) Confirm that the domain name server is set up

If not, we recommend setting up Google's public DNS service, which should not be problematic.

[Email protected] ~]# cat/etc/resolv.conf

Adding DNS to the file, which was not necessary during the testing process, is also possible when the network management is added to the file.

2) Make sure the gateway is set

[[email protected] ~]# grep gateway/etc/sysconfig/network-scripts/ifcfg*

My xiaolyu75 machine can not sisu the net, is because the network management set the wrong, I set the getway=192.168.31.1.

If it is not set, the gateway is increased in the following ways:

[[email protected] ~]# route add default GW 192.168.31.1

Or, after manually writing the/etc/sysconfig/network-scripts/ifcfg* file, restart the network service:

[Email protected] ~]# service network restart

/etc/sysconfig/network-scripts/ifcfg-eth0:gateway=192.168.31.1

3) ensure available DNS resolution

[[email protected] ~]# grep hosts/etc/nsswitch.conf

#hosts: DB Files Nisplus NIS DNS
Hosts:files DNS

4) Test:

[Email protected] ~]# ping-c 3 www.baidu.com

VMware Bridge mode under CentOS, static IP sisu Network

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.