Configure static IP addresses in Centos in VMware NAT Mode

Source: Internet
Author: User

Configure static IP addresses in Centos in VMware NAT Mode

1. First, deselect the "use local DHCP service to allocate IP addresses to virtual machines" option, view the gateway address of the virtual network card in NAT mode, and record it (default VMnet8 ).

2. Enter the following command on the terminal to edit the/etc/sysconfig/network file.

# vim  /etc/sysconfig/network  

Add GATEWAY address 192.168.166.2

NETWORKING = yesHOSTNAME = localhost. localdomain # Add GATEWAY = 192.168.166.2 as follows

3. Then enter the following command on the terminal to edit the/etc/sysconfig/network-scripts/ifcfg-eth0 File

# vim /etc/sysconfig/network-scripts/ifcfg-eth0

Modify as follows:

DEVICE = "eth0" # BOOTPROTO = "dhcp" comment out the original dhcp # --- Add the following --- BOOTPROTO = "static" IPADDR = 192.168.166.175NETMASK = 255.255.255.0GATEWAY = 192.168.166.2 # --- add the above --- HWADDR =" 00: 0C: 29: 56: 8F: AD "IPV6INIT =" no "# --- NM_CONTROLLED changed to no --- NM_CONTROLLED =" no "ONBOOT =" yes "TYPE =" Ethernet "UUID =" ba48a4c0-f33d-4e05-98bd-248b01691c20 "# --- add DNS1, don't write the DNS---DNS1 = 192.168.166.2

4. Restart the service

# service network restart

5. Auxiliary matters

  1. If the Restart service does not take effect, restart centOS
  2. If the restart of centOS does not take effect, disable centOS, manually modify the IP address of the NAT virtual Nic, and then start centOS (replace the IP addresses in the preceding steps ).
  3. 6. The reason why Device eth0 does not seem to be present and delaying initialization is wrong is displayed in the clone Vm of VMware: linux Nic bound to the original mac address causes 1. Use ifconfig-a to view the mac address of the current host

Run the following command to modify HWaddr:

vim /etc/sysconfig/network-scripts/ifcfg-eth0

2. Delete the 70-persistent-net.rules file.

rm -rf /etc/udev/rules.d/70-persistent-net.rules

4. restart the system.

reboot -h now

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.