Configure static IP addresses for RHEL

Source: Internet
Author: User
Tags nameserver

For the first NIC:

(1) configure the nic ip address, modify the content of the/etc/sysconfig/network-scripts/ifcfg-eth0 file:


Device = eth0 # Physical device name

Bootproto = static # Static allocation

Broadcast = 255.255.255.255 # Broadcast address (optional)

Ipaddr = 192.168.1.103 # This is the static IP address you set

Netmask = 255.255.255.0 # Subnet Mask

Network = 192.168.1.0 # Network address (optional)

Hwaddr = 00: 0C: 29: 01: 98: 27 # MAC address

Gateway = 192.168.1.1 # Gateway address

Onboot = Yes # Whether to activate the device during boot



(2) configure the nic dns:


Modify the/etc/resolv. conf file:

Nameserver 202.109.14.5 # Primary DNS
Nameserver 219.141.136.10 # Secondary DNS
Search localdomain


(3) restart the network service:

Service Network restart

Or

/Etc/init. d/network restart


(4) Note: If you back up the/etc/sysconfig/network-scripts/ifcfg-eth0 file and back up it in the same directory (for example, back up the file name for the ifcfg-eth0_bak), so even if you configure the static IP address according to the above steps, restart the network service, it may also find that the IP address does not become your configured static IP address, what is going on? Because RHEL still reads the configuration of the ifcfg-eth0_bak file, so you can move this file to another folder, and then restart the network service to try, this time your static IP configuration takes effect, I have encountered this problem twice.

 

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.