Configure static IP addresses on CentOS6

Source: Internet
Author: User
By default, no network access configuration is available for CentOS6 installation. you need to configure the network interface. Solution: view the default interface configuration and save the interface configuration in the/etc/sysconfig/network-scripts directory. the default interface configuration is shown below. [Plain] for viewplaincopy & nbs, no network access configuration is available for CentOS 6 installation by default. you need to configure the network interface. Solution: view the default interface configuration and save the interface configuration in the/etc/sysconfig/network-scripts directory. the default interface configuration is shown below. [Plain]View plaincopy
  1. [Root @ CentOS65 network-scripts] # more/etc/sysconfig/network-scripts/ifcfg-eth0
  2. DEVICE = eth0
  3. HWADDR = 00: 0C: 29: C1: 48: 03
  4. TYPE = Ethernet
  5. UUID = b2bbb718-caa6-46c3-ae12-587cbedfd5fa
  6. ONBOOT = no
  7. NM_CONTROLLED = yes
  8. BOOTPROTO = dhcp
Configure static interface addresses [Plain]View plaincopy
  1. # Vi/etc/sysconfig/network-scripts/ifcfg-eth0
  2. DEVICE = "eth0"
  3. NM_CONTROLLED = "yes"
  4. ONBOOT = yes
  5. HWADDR = A4: BA: DB: 37: F1: 04
  6. TYPE = Ethernet
  7. BOOTPROTO = static
  8. UUID = 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
  9. IPADDR = 10.220.33.108
  10. NETMASK = 255.255.255.0
Configure Gateway [Plain]View plaincopy
  1. # Vi/etc/sysconfig/network
  2. NETWORKING = yes
  3. HOSTNAME = centos6
  4. GATEWAY = 10.220.33.1
Restart network interface [Plain]View plaincopy
  1. [Root @ CentOS65 network-scripts] #/etc/rc. d/init. d/network restart
  2. Shutting down interface eth0: [OK]
  3. Shutting down loopback interface: [OK]
  4. Bringing up loopback interface: [OK]
  5. Bringing up interface eth0: Determining if ip address 10.220.33.108 is already in use for device eth0...
  6. [OK]
Configure DNS server [Plain]View plaincopy
  1. # Vi/etc/resolv. conf
  2. Nameserver x. x # Replace with your nameserver ip
  3. Nameserver y. y # Replace with your nameserver ip
View Interface configuration use the "ip a" or ifconfig command to view the current Interface configuration information reference 1. Centos: Interface configuration files

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.