CentOS Virtual Machine Internet configuration IP method _linux

Source: Internet
Author: User
Tags centos

This article mainly introduces the CentOS virtual machine need to quickly configure IP network, if the virtual machine direct access to the Internet is very simple, if it is connected with the host need bridge link, specific as follows:

If it's just a virtual machine that needs to be online, it's easy.

1. Enter the CentOS system to view the network configuration.

Enter command: ifconfig-a

2. Enter the Ifcfg-eth0 file.

Enter command: Vim/etc/sysconfig/network-scripts/ifcfg-eth0

Note: The non-root account must be sudo, otherwise it is not authorized to edit, or direct su switch to root user.

3. Configure dynamic IP.

Configure the IP address by modifying the Ifcfg-eth0 content;

Change Onboot=no to Onboot=yes to activate the network card.

4. Restart Network services to view dynamic IP configuration results.

Input command: Service network restart (Restart Network Service)

Note: The root user will still be used

If you want to communicate with each other between the virtual machine and the host, you need to configure the bridging mode

1. Stop virtual machine,virtualbox-> regular-> network

Change the connection mode of NIC 1 to: Bridging network card

2. Enter the Ifcfg-eth0 file.

Enter command: Vim/etc/sysconfig/network-scripts/ifcfg-eth0

Note: The non-root account must be sudo, otherwise it is not authorized to edit, or direct su switch to root user.

3. Configure static IP

ipaddr=192.168.1.10 set the IP address of the virtual machine to the host in a network segment, but cannot duplicate the name
netmask=255.255.255.0 Set Subnet mask
gateway=192.168.1.1 Settings Gateway
dns1=140.207.198.6 set DNS (same as host)
Defroute=yes

4. Restart Network services to view dynamic IP configuration results.

Input command: Service network restart (Restart Network Service)

Note: The root user will still be used

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

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.