Common CentOS network settings

Source: Internet
Author: User

Shutdown: shutdown-h now

Restart: reboot

Network Settings: vi/etc/sysconfig/network-sripts/ifcfg-eth0 # Set network connection type, IP, gateway, subnet mask

Vi/etc/sysconfig/network # Set the Host Name

Vi/etc/resolv. conf # Set DNS

Service network restart # restart the network service after the configuration is complete.

Virtual Machine network settings:

Method 1: with bridging, set IP (same as the network segment of the host), subnet mask (255.255.255.0), Gateway (same as the host) in/etc/sysconfig/network-sripts/ifcfg-eth0 ), enable ONBOOT = yes and set BOOTPROTO = static. You can achieve two-way access to the host and Virtual Machine without moving anything else.

Method 2: Use network Address Translation NAT, set BOOTPROTO = dhcp in/etc/sysconfig/network-sripts/ifcfg-eth0, enable ONBOOT = yes, other do not need to set, to share the network access of the host. When the host uses a wired network, the virtual machine can access the host, and the host cannot access the virtual machine. When the host uses a Wi-Fi network, the virtual machine and the host can be accessed in two directions.

You do not need to set this parameter in/etc/sysconfig/network.

The DNS address in/etc/resolv. conf is automatically obtained, consistent with the host

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.