CentOS6.5 fixed IP Access (NAT) in virtual machines)

Source: Internet
Author: User
Tags nameserver

CentOS6.5 fixed IP Access (NAT) in virtual machines)

Use NAT Mode

The Virtual Machine network connection uses the NAT mode, and the physical machine network connection uses vmnet8. If it is not reset

In virtual machine settings-network adapter, select NAT mode for network connection.

On the VM menu bar, choose "edit"> "Virtual Network Editor", select "Vmnet8 NAT", and deselect the Use local DHCP service check to fix the IP address.

The Subnet IP address is used to control the IP segment that the Virtual Machine wants. NAT Settings takes a look at the virtual machine gateway. Here is 192.168.1.2.

After the settings are complete, click the application to exit.

Physical Machine network connection VMNet8 manual setting IP address 192.168.1.1 subnet mask 255.255.255.0

The gateway and DNS address are 192.168.1.2 (that is, the virtual machine NAT gateway address)

Edit the configuration file of the linux Nic eth0

[Root @ HE1 ~] # Vi/etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE = eth0

BOOTPROTO = none

HWADDR = 00: 0c: 29: db: 2e: ff

IPV6INIT = no

NM_CONTROLLED = yes

ONBOOT = yes

TYPE = Ethernet

UUID = "14ce5db9-8038-4d39-a347-806d20608834"

USERCTL = no

IPADDR = 192.168.1.48

NETMASK = 255.255.255.0

GATEWAY = 192.168.1.2

DNS1 = 192.168.1.2

Set DNS1; otherwise, the DNS configured in resolv. conf is invalid.

Set the DNS address and run the command # vi/etc/resolv. conf.

# Generated by NetworkManager

Search localdomain

Nameserver 192.168.1.2

Restart the network service [root @ HE1 ~] #/Etc/init. d/network restart

After the instance is restarted, check the configured IP address in ifconfig. ping the IP address on the physical machine to test whether the IP address can be accessed.

If the network can be pinged but cannot access the Internet, it is likely that the DNS1 In the NIC is not set, resulting in the clearing of the nameserver set in resolv. conf after the network service is restarted.

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.