Linux virtual machine CentOs set static IP

Source: Internet
Author: User

In general, the use of VMware Workstation Pro Linux system by default may be automatically assigned IP address, if you change to static IP address change how to set it.

This method is NAT mode non-bridging

First look at the current host IP configuration for running the virtual machine environment

IP address of IPv4:192.168.254.1

Link Linux system execution

Vim Etc/sysconfig/network-scripts/ifcfg-eth0

Edit the configuration of this file:

Set to static IP

bootproto= "Static"

To configure the IP address, IP field above the IP segment of the IPv4 we queried

ipaddr=192.168.254.129

Sub-off Network code
netmask=255.255.255.0

Default Gateway Segment
gateway=192.168.254.2

Access to DNS (not available for the current virtual machine system to access the extranet)

dns1=114.114.114.114
dns2=8.8.8.8

After modification:

Service Network restart Restart IP configuration

See if IP has been modified after completion

#ifconfig

And check if you can access the extranet

#ping www.baidu.com

Bridging mode, if bridged mode is used, the IP segment of the routing configuration is used as a reference, and no records and demonstrations are made here.

Linux virtual machine CentOs set static IP

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.