CentOS6.4 Virtual Machine NAT connection

Source: Internet
Author: User

CentOS6.4 Virtual Machine NAT connection

Install CentOS6.4. The KVM is installed on it, and then the CentOS6.4 virtual machine is installed on KVM. The default Internet access mode for this CentOS6.4 virtual machine is NAT. Network Configuration of the virtual machine:

Enter the terminal:
# Vim/etc/sysconfig/network-scripts/ifcfg-eth0
To:
DEVICE = "eth0 ″
BOOTPROTO = "dhcp" # Note
HWADDR = "52 *****" # corresponding MAC address
NM_CONTROLLED = "yes"
ONBOOT = "yes" # Note
TYPE = "Ethernet"
UUID = "2ca *****"

Enter the terminal:
# Service network restart

If the VM still cannot access the Internet, but the domain name can be resolved, that is, ping baidu.com can resolve the problem but the IP address cannot be pinged, the hen does not forward the IP address. solution:
Enter HEN:
Modify the parameters in/etc/sysctl. conf to allow ip forwarding:
# Vim/etc/sysctl. conf
To:
Net. ipv4.ip _ forward = 1. It takes effect permanently and needs to be restarted.
Or
Echo 1>/proc/sys/net/ipv4/ip_forward takes effect immediately.

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.