CentOS 7.0 NAT network configuration, centosnat

Source: Internet
Author: User

CentOS 7.0 NAT network configuration, centosnat

Resource:

Virtual Machine Software: VMware Version: 10.0.3 build-1895310

CentOS7 mounting Disk: CentOS-7.0-1406-x86_64-DVD.iso

 

Step 1 create a VM.

Right-click VMware on the left and choose new virtual machine ".

Select Custom Mode

Select the installation disk, my address here is: F: \ thunder Download \ CentOS-7.0-1406-x86_64-DVD.iso

Select a system based on the version:

Network Connection Method: NAT

 

A problem occurs when starting a virtual machine. This problem occurs only when a 64-bit system is installed. the solution is to enter the bios and start Intel-x. (In fact, you can enable the support of virtual machines in the bios)

Start virtual Installation

 

Step 2 install CentOS_7.0

Select Install CentOS 7

Select Chinese support for Installation

The idea is to install the desktop.

You can select multiple installation modes. Enter the network, and then configure it.

Then start the installation.

Next, configure the root user password. You can configure it on your own.

Step 3 configure the network configuration of the CentOS7.0 system. The virtual machine accesses the Internet through the NAT link.

Check whether the NIC of the current virtual machine is configured in NAT mode.

Right-click your Vm and select "Settings" to check whether your network connection mode is in NAT mode.

 

After the virtual machine is configured, configure the virtual network card vmware8

Several configurations enclosed by the idea. This option is selected. The subnet ip address is used to limit the CIDR Block of the NAT internal LAN. Here I set 192.168.10.0 and the mask is 255.255.255.0.

In addition, you can set the NAT Internal Gateway. The default value is ip address 2 of the network segment, that is, 192.168.10.2.

DHCP configuration can be used to configure the ip addresses allocated to machines on the NAT intranet. NOTE: If your VM system uses a fixed ip address, you cannot use the ip address in the dhcp settings range. Otherwise, a routing problem may occur and an exception may occur.

For example, the segment I configured is 192.168.10.128 ~ 192.168.10.254, if you want to set a fixed ip address for the host network, you need to use 192.168.10.3 ~ The ip address in the range of 192.168.10.127 is used as a fixed ip address. If you select DHCP mode, 192.168.10.128 ~ The ip address in 192.168.10.254 is assigned to your virtual system. For the validity period, refer to the configuration here. (The ip address of the virtual system will be retrieved again after the validity period. We recommend that you use a fixed ip address for the installation cluster)

 

After the virtual network card is configured, the virtual network card cannot access the external network. If it is a NAT internal cluster, you do not need to connect to the Internet. However, if your machine needs to access the Internet, you need to put the virtual network card into the shared network list.

Enable your Nic Configuration:

I use a wireless network adapter. If you use a wired or broadband connection, share the network adapter you used to access the Internet with the virtual network adapter.

Select:

Shared home network card: VMnet8

 

In fact, the default installation configuration is used, and now you can access the internet. The following is the content of the configuration file installed by default. It can be seen that dhcp is used by default.

The assigned ip address is

Access Baidu for testing:

Additional: set a fixed ip Address

However, as a server, the variable IP address is not easy to use. So proceed with the fixed ip configuration below.

After entering the system, open the terminal and switch to the root user

Modify the network configuration file:

# Vi/etc/sysconfig/network-scripts/ifcfg-eno16777736

Note: Change BOOTPROTO to static, that is, static IP Mode.

IP address IPADDR, select the network segment 192.168.10.3 ~ An ip address between 192.168.10.127. The reason is already described in the previous section about the virtual Nic configuration.

NETMASK is a subnet mask, which is the same as the previously configured 255.255.255.0

GATEWAY, the default GATEWAY, which is also the same as previously configured 192.168.10.2

DNS1 (Domain Name Server) also serves as a virtual gateway. 192.168.10.2

 

Then modify the Domain Name Server Configuration:

# Vi/etc/resolv. conf

Nameserver 192.168.10.2

 

Then, make the modified network configuration take effect, and restart the NIC:

# Systemctl restartnetwork

# Systemctlstatusnetwork

Note: CentOS7 no longer uses the service command, but uses the new system service component systemctl. Therefore, we use the command above to restart the network service.

 

In addition to vi modifying/etc/sysconfig/network-scripts/ifcfg-eno16777736 to modify network configurations, you can also use the text interface tool:

Nmtui-edit to modify the NIC configuration. For example:

# nmtui-editeno16777736

Enter the preceding content in the command line to obtain the following text interface. However, you must install this tool first. The installation command is as follows:

# yum -y installNetworkManager-tui

# nmtui-connect eno16777736

After nmtui-edit is used, the nmtui-connect command is used to make the modification take effect. Do not restart the network service (as mentioned earlier)

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.