Vm CentOS set static IP address

Source: Internet
Author: User

The CentOS is created in the VM, and the IP address always changes after each reboot.

1. Modify the configuration in the VM

Edit----> virtual Network Editor

Turn on NAT settings


Remember this Gateway IP

2. Go to the CentOS modification configuration file

Mainly involves 3 documents

/etc/sysconfig/network

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

/etc/resoly.conf

First modify the network file

Networking=yes
Hostname=localhost.localdomain
gateway=192.168.113.2

Specify the gateway address:

Modify the Ifcfg-eth0 file

Device= "Eth0"
#BOOTPROTO = "DHCP"
bootproto= "Static"
ipaddr=192.168.113.113
netmask=255.255.255.0
Hwaddr= "00:0c:29:56:8f:ad"
Ipv6init= "No"
Nm_controlled= "Yes"
onboot= "Yes"
Type= "Ethernet"
Uuid= "Ba48a4c0-f33d-4e05-98bd-248b01691c20"
dns1=192.168.113.2

Modify the resoly.conf file

NameServer 192.168.113.2

Restarting the client can



Vm CentOS set static IP address

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.