Configure static IP address in CentOS6.7

Source: Internet
Author: User

Configure static IP address in CentOS6.7

To configure static IP addresses in CentOS, follow these steps:
Servers generally have their own static IP addresses so that they can be connected to the LAN.
1. Edit the NIC file and modify the NIC Configuration

 vim /etc/sysconfig/network-scripts/ifcfg-eth0

Change the contents of the ifcfg-eth0 to the following:

    

ENI must have DEVICE = eth0 # The DEVICE alias corresponding to the network adapter must have HWADDR = 00: 07: E9: 05: E8: B4 # The network adapter address, that is, if the mac address is too many then TYPE = Ethernet # indicates that the network TYPE is Ethernet too many then UUID: the UUID of the NIC (which can not be found in the file) when the system starts, it automatically loads eth0 when it starts. When the system starts, it automatically loads eth0 when it comes to running NM_CONTROLLED = yes # whether the device is managed by NetworkManager. when the device is running successfully, it BOOTPROTO = static # Set the NIC through different protocols how to obtain the IP address, -static-bootp-dhcp dynamic route protocol 255.255.255.ipaddr = 192.168.118.10 # Set the nic ip address 255.255.255.255.255.netmask = 255.255.255.0 # Set the NIC mask address 255.255.255.255.255.network = 192.168.118.0 # Set the NIC corresponding network address 255.255.255.255.broadcast = 192.168.118.255 # Set the BROADCAST address of the network card

2. Modify the gateway Configuration

 vi /etc/sysconfig/network

Change the network content to the following:

    

Required bandwidth used when NETWORKING = yes # indicates whether the system uses the network (IPV4), which is generally set to yes. Zookeeper without NETWORKING_IPV6 = no # IPV6 zookeeper without HASTNAME # Set the host name, localhost. localhostdomain is the default host name named   GATEWAY = 192.168.118.1 # Set the GATEWAY and select an unused address.

3. Modify DNS

 vi /etc/resolv.conf

Change resolv. conf to the following:

    

Add two available dns servers

4. Restart the network service.

 service network restart

5. Use another terminal to verify that ping is successful

6. The IP address is configured and verified successfully.


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.