VM CentOS Network Configuration

Source: Internet
Author: User

Install the CentOS system and view the network configuration.

Input command: ifconfig

127.0.0.1

To turn on the network

Enter the Ifcfg-eth0 file.

Input command: Vi/etc/sysconfig/network-scripts/ifcfg-eth0

Note: The non-root account is required to add sudo, or enter the VI editor and no permission to edit.

  1. Configure the dynamic IP.

    Configure the IP address by modifying the Ifcfg-eth0 content, and enter its VI edit mode by the keyboard letter "a".

    Change Onboot=no to Onboot=yes to activate the NIC.

    Change Nm_controlled=yes to Nm_controlled=no.

    After the modification, press "ESC" key to exit Edit mode, enter ": Wq" hit Enter to save the modified result.

    Note: hwaddr and UUID can be commented or deleted.

  2. Restart the Network service to view the dynamic IP configuration results.

    Input command: Service network restart (Restart Network Service)

    Input command: ifconfig-a (view network configuration)

    Note: For non-root accounts, sudo is required to restart the network service.

    Static configuration

    Configure the static IP.

    1. Also modify the Ifcfg-eth0 content, press the keyboard letter "a" to enter its vi editing mode.

    Change Onboot=no to Onboot=yes

    Change Nm_controlled=yes to Nm_controlled=no

    Change BOOTPROTO=DHCP to Bootproto=static

    Add IPAddr (IPV4): ipaddr=192.168.10.10

    Add NETMASK (Subnet mask): netmask=255.255.255.0

    Add Gateway: gateway=192.168.10.1

    After the modification, press "ESC" key to exit Edit mode, enter ": Wq" hit Enter to save the modified result.

    Note: The same hwaddr with UUID can be annotated or deleted, static IP is configured according to actual needs, above is just an example.

    2.

    Restart the Network service to view the dynamic IP configuration results.

    Input command: Service networt Restart (Restart Network Service)

    Input command: ifconfig-a (view network configuration)

    Note: For non-root accounts, sudo is required to restart the network service.

VM CentOS Network Configuration

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.