CentOS6.5 configure network parameters in text mode (static IP)

Source: Internet
Author: User

CentOS6.5 configure network parameters in text mode (static IP)

I. Description

When CentOS6.5 is started, the network is not automatically connected by default. The IP address is automatically allocated through DHCP. If you want to temporarily change the IP address, run the following command: ifconfig eth0 192.168.202.129, ifconfig indicates the interface parameter configuration, eth0 indicates the first Ethernet Card, and finally the static IP address you want to configure, but this configuration is temporary, if you restart the server, the configured IP address becomes invalid. Therefore, you can change the configuration file to set a valid static IP address for a long time.

Ii. Configure IP addresses in text mode

The path to the configuration file is:/etc/sysconfig/network-scripts/ifcfg-eth0 file, the default configuration of this file is as follows:

[Tong @ tong network-scripts] $ cat ifcfg-eth0DEVICE = eth0HWADDR = 00: 0C: 29: 85: FC: 09 TYPE = EthernetUUID = Signature = noNM_CONTROLLED = yesBOOTPROTO = dhcp

In this case, set ONBOOT to yes, that is, automatically connect to the network after the instance is started, and change the dynamic DHCP mode to static IP allocation. The configuration file is as follows;

[Tong @ tong network-scripts] $ cat ifcfg-eth0DEVICE = eth0HWADDR = 00: 0C: 29: 85: FC: 09 TYPE = EthernetUUID = 6b218dfa-ff8e-4455-be44-ffdfd95ccefbONBOOT = yesNM_CONTROLLED = yesIPADDR = 192.168.202.129BOOTPROTO = noneNETMASK = 255.255.255.0GATEWAY = 192.168.202.1

 

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.