Configuring the static IP tutorial in the CentOS virtual machine NAT mode

Source: Internet
Author: User

This tutorial is a 32-bit CentOS6.5 For example, the CentOS network card is NAT mode


1. Open VMware Virtual machine, edit---> virtual network Editor to set up NAT network card

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/76/FE/wKioL1ZgOFjBhmUhAAEJQrvyk64435.png "style=" float: none; "Title=" 1 (2). png "alt=" Wkiol1zgofjbhmuhaaejqrvyk64435.png "/>


To check the DHCP service, click NAT settings to view the gateway

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/76/FE/wKioL1ZgOFiSbQglAABtEixuwrQ947.png "title=" 2 (2). PNG "style=" Float:none; "alt=" Wkiol1zgofisbqglaabteixuwrq947.png "/>

This is not a modification, note the gateway IP (or later on in CentOS), leave the default

2. Enter the CentOS virtual machine and run the dhclient command to get the IP automatically

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/76/FE/wKiom1ZgMdSB0EocAAAFKPuXFt8059.png "title=" 3.png " alt= "Wkiom1zgmdsb0eocaaafkpuxft8059.png"/>


3. Execute the ifconfig command to view the acquired IP

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/76/FF/wKiom1ZgMvDiSbsAAAA7egJD02U627.png "title=" 4.png " alt= "Wkiom1zgmvdisbsaaaa7egjd02u627.png"/>


4. Configuration Related files

Input command: Vi/etc/sysconfig/network-scripts/ifcfg-eth0

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/76/FF/wKiom1ZgNoHTHj3fAAAX03vLjxU120.png "title=" 1.png " alt= "Wkiom1zgnohthj3faaax03vljxu120.png"/>

Change Onboot=no to Onboot=yes

Change BOOTPROTO=DHCP to Bootproto=static

At the end of the file, add the following:

Ipaddr=192.168.xxx.xxx (You can automatically get the IP, but also set your own, but note that the IP and gateway in the same paragraph)

netmask=255.255.255.0 (Subnet mask)

GATEWAY=192.168.XXX.XXX (Set the gateway, you can use the Route-n command to view the local gateway if you don't remember the top)

dns1=8.8.8.8 (DNS server can set itself)

And then save the exit

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/76/FE/wKioL1ZgOYzCIJcNAAAnTWwLwvM368.png "title=" 5.png " alt= "Wkiol1zgoyzcijcnaaantwwlwvm368.png"/>


5. Restart the network card: Service Network restart

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/76/FE/wKioL1ZgOevi6ypKAAAeqr43naw951.png "title=" 3.png " alt= "Wkiol1zgoevi6ypkaaaeqr43naw951.png"/>

6. Test: Ping www.baidu.com

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/76/FF/wKiom1ZgOcvDsS8zAAArn0_M4ys856.png "title=" 4.png " alt= "Wkiom1zgocvdss8zaaarn0_m4ys856.png"/>

As shown, the networking is OK.

In addition, the steps to configure the static IP for the CentOS virtual Machine bridge mode are similar to the NAT mode configuration except for step 1.




This article is from the "looking South is clear Sky" blog, please be sure to keep this source http://9007730.blog.51cto.com/8997730/1719365

Configuring the static IP tutorial in the CentOS virtual machine NAT mode

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.