CentOS Internet configuration under VMware

Source: Internet
Author: User

Set up network 1, check the network configuration just installed virtual machine, inside or the original network configuration. There is only one loopback network card. You can view it by using the IFCONIFG command.  2, add network card from above see only loopback network card, now need to add a network card for subsequent network configuration and operation. If you do not add a network card and make a good networking, you will not be able to communicate with the physical host,  can add a network card through the command line: # command line Add a NIC, and set its IP to 192.168.1.22ifconfig eth0 192.168.1.22 netmask 192.168.1.255 But the command line added, just temporarily add, change the terminal environment or the next time you restart the server, this setting will be invalidated. So now consider adding from the configuration, adding it permanently. In order to make the subsequent configuration undisturbed, the network card added by the previous command line is switched off. Ifconfig eth0 down  Adding a network card by adding a configuration: Enter the/etc/sysconfig/network-scripts/network configuration directory to  ifcfg-  switch configuration file is the network configuration of the NIC , you can add a new network card in a similar way ETH0CP Ifcfg-lo Ifcfg-eth0 First look at the configuration of the loopback network card configuration. I marked the part of the message with a red word. According to the gourd painting scoop, change the ifcfg-eth0 to the way we want it to be,  3, test the Internal network Restart Network: Service network restart  Another virtual machine in the same way, Another virtual machine IP is 192.168.1.11 good, now, the host, both virtual machines are in the same network segment, then they should be able to communicate with each other. Ping test to verify that: 4, set up the external network through the previous settings, the host, the two virtual machines can communicate with each other 22. But it seems that you can't access the extranet. Ping www.baidu.com through the error message, you can find that the virtual machine to "www.baidu.com" This domain name does not know. Good. Well, let's make it up. dns.  preparation Dns:dns How to prepare, first through windows to see how the DNS is configured on Windows, in the preparation of Linux up to it. On my winddows machine, there are two ways to:  a DNS: The first method:/etc/resolv.conf A DNS configuration file to enter a Linux virtual machine vim/etc/resolv.conf   Edit the DNS configuration file, followed by the following redColor section: Note: Above two nameserver, the first is the primary DNS server, the second service DNS server.   The second method: in the network card configuration file Ifcfg-eth0, add the DNS configuration note: Here to add, you need to restart the network Oh!   Good, DNS has been prepared, then can ping through the www.baidu.com to find or ping does not pass. What's going on here.   Configuration gateway: DNS settings Yes, or ping www.baidu.com check, it is now possible to ping the host, virtual machines, as well as gateways. 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, right now. To configure a gateway: There are two ways   the first method: temporary configuration from the command line: command line Add default gateway: Route add defalult GW 192.168.1.1 default gateway, which is the case where the corresponding route is not found, Take 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 remove the command line configuration gateway 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. The service network restart   can now ping www.baidu.com, which means it can access the extranet.

CentOS Internet configuration under VMware

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.