How to configure the IPv4 address of the Centos Nic

Source: Internet
Author: User
Linux and Windows also have the IP configuration function. you can use DHCP to automatically obtain or manually specify an IP address. In Linux, how does one modify the nic ip address? 1. the configuration file path cd/etc/sysconfig/network-scripts Nic file is generally & ldquo; ifcfg-eth0 & rdquo; the name of the configuration file, the more NICs, accumulate from 0, 1, 2 & hellip.

Linux and Windows also have the IP configuration function. you can use DHCP to automatically obtain or manually specify an IP address. In Linux, how does one modify the nic ip address?

1. configuration file path
cd /etc/sysconfig/network-scripts

Nic file is generally the name of the "ifcfg-eth0" configuration file, the more the NIC, from 0, 1, 2... Accumulate.

To bind one Nic to multiple addresses, such as the Nic configuration file name is ifcfg-eth0, create a second IP configuration file named ifcfg-eth0: 0, with the naming format of multiple child IP addresses: "ifcfg-eth0: 0", "ifcfg-eth0: 1" and so on, the maximum cannot exceed 255.


II. DHCP automatically obtains IP addresses
# Realtek semiconduco ., ltd. RTL-8139/8139C/8139C + # Nic brand (can be deleted) DEVICE = eth0 # Nic address code BOOTPROTO = dhcp # DHCP automatically get HWADDR = 00: 16: 3E: BC: 82: 0F # Nic MAC address ONBOOT = yes # automatic start upon startup

Refer to the above case, DHCP is used to automatically obtain network information from the route and automatically start the route when it is started.


3. Static IP settings
TYPE = Ethernet # network type device = eth0: 0 # Nic address code/sub-code ONBOOT = yes # boot and run BOOTPROTO = static # Use Protocol (static) IPADDR = 216.18.194.3 # IP address NETMASK = 255.255.255.255.mask # subnet mask GATEWAY = 216.18.194.1 # gateway hwaddr = 00: 16: 3E: 89: 85: 38 # MAC address BROADCAST = 216.18.194.199 # BROADCAST address DNS1 = 8.8.8.8 # domain name resolution server 1DNS2 = 8.8.4.4 # domain name resolution server 2

Refer to the above content to manually set the IP address (generally used for networks without DHCP ).


4. restart the network service to make it take effect
Service network restartifconfig # view the current IP 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.