Centos 7 static IP settings, centosip

Source: Internet
Author: User

Centos 7 static IP settings, centosip

This course is intended for Centos 7.0.1406!


1. Edit the ifcfg-eth0 file, vim is minimized when the installation is not installed, you need to install it on your own is not described.

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

2. Modify the following content:

BOOTPROTO = "static" # Change dhcp to static ONBOOT = "yes" # enable this configuration at startup IPADDR = 192.168.7.106 # static IPGATEWAY = 192.168.7.1 # Default Gateway NETMASK = 255.255.255.0 # subnet mask DNS1 = 192.168.7.1 # DNS Configuration

3. modified results

#] # Cat/etc/sysconfig/network-scripts/ifcfg-eth0HWADDR = "00: 15: 5D: 07: F1: 02 "TYPE =" Ethernet "BOOTPROTO =" static "# Change dhcp to static DEFROUTE =" yes "PEERDNS =" yes "PEERROUTES =" yes "IPV4_FAILURE_FATAL =" no "4256init =" yes ""Listen 6_autoconf =" yes "comment 6_defroute =" yes "comment 6_peerdns =" yes "comment 6_peerroutes =" yes "comment =" no "NAME =" eth0 "UUID =" bb3a302d-dc46-461a-881e-d46cafd0eb71 "ONBOOT =" yes "# enable IPADDR = 192.168.7.106 # static IPGATEWAY = 192.168.7.1 # Default Gateway NETMASK = 255.255.255.0 # subnet mask DNS1 = 192.168.7.1 # DNS Configuration

4. Restart the network service.

# service network restart

5. Check the modified results. Centois 7 does not use ifconfig, but uses ip commands to view network information.

# ip addr1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00    inet 127.0.0.1/8 scope host lo       valid_lft forever preferred_lft forever    inet6 ::1/128 scope host        valid_lft forever preferred_lft forever2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000    link/ether 00:15:5d:07:f1:02 brd ff:ff:ff:ff:ff:ff    inet 192.168.7.106/24 brd 192.168.7.255 scope global eth0       valid_lft forever preferred_lft forever    inet6 fe80::215:5dff:fe07:f102/64 scope link        valid_lft forever preferred_lft forever


How to configure static IP addresses for CentOS 7

See:

Www.linuxidc.com/Linux/2014-10/107789.htm

Centos 64 network configuration, set static IP

Today, I also encountered this problem and found that the system/etc/resolv. conf in centos6.4 cannot directly edit and add the nameserver DNSip address. It is simply not added. Read/etc/resolv carefully. the prompt in conf shows that you need to add DNS1 = xxx in the ifcfg file corresponding to/etc/sysconfig/network-scripts/(that is, the file where you set the static IP address. xxx. xxx. xxx. After adding the NIC, restart the NIC and view the resolv. conf file. Then you will find that the namesever is added.

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.