"Linux" CentOS set static IP (non-dynamic acquisition IP)

Source: Internet
Author: User

When Linux is installed on VMware, the default set of dynamic IP, each start of the IP is different, remote connection is very laborious.

So, you need to set a static IP, at least I am more convenient to connect from the remote tool. In addition, in order to install some software, also need to access the Internet.

> Release Notes
cat /etc/6.5  (Final) Kernel \ r on an \m

> VMware Settings

Network configuration for virtual machines: Right-click > Settings > Network adapter > Bridging mode (B): Direct connection to physical network

> Set static address, gateway address

Because the network is shared with a PC (not a virtual machine), query the network-related information that the PC is connected to, such as the default gateway

c:\users\administrator>ipconfigwindows IP configurationethernet Adapter Local Area Connection:   Connection-  Specific DNS Suffix  .:   192.168.  1.3   255.255.  255.0   192.168.  1.1

PC with 192.168.1.3, then the virtual machine with 192.168.1.9 bar, the default gateway is 192.168.1.1.

Based on the above information, start modifying the Linux 3 configuration and recommend a pre-change backup. The modified file is probably as follows (hidden hwaddr, UUID)

cat /etc/sysconfig/networknetworking=yeshostname=Localhost.localdomaingateway =192.168. 1.1

[Email protected] ~]$Cat/etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE="eth0"# Bootproto="DHCP"Bootprote="Static"ipaddr=192.168.1.9NETMASK=255.255.255.0HWADDR="YOUR MAC ADDRESS"Ipv6init="No"nm_controlled="Yes"Onboot="Yes"TYPE="Ethernet"UUID="YOUR UUID"DNS1=192.168.1.1

cat /etc/ in/etc/sysconfig/network-scripts like so:## DNS1=xxx.xxx.xxx.xxx# DNS2=xxx.xxx.xxx.xxx# DOMAIN=192.168. 1.1

Finally, restart the network

Service Network restart

> Testing

Visit under Baidu to see

[Email protected] ~]$ Curl www.baidu.com

If it goes well, the static IP configuration and the Internet are completed.

"Linux" CentOS set static IP (non-dynamic acquisition 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.