Centos 7 Learning static IP settings

Source: Internet
Author: User

Original link: http://blog.csdn.net/johnnycode/article/details/40624403

This study is mainly for Centos 7.0.1406 version to learn to organize!

If you use VirtualBox to configure CentOS then please refer to my article CentOS 7 learning static IP settings (cont.)

1, edit the Ifcfg-eth0 file, vim minimized installation is not installed, need to install the self-description.

[plain] view plain copy

    1. # Vim/etc/sysconfig/network-scripts/ifcfg-eth0

2, modify the following content

[plain] view plain copy

    1. bootproto= "Static" #dhcp改为static
    2. onboot= "Yes" #开机启用本配置
    3. ipaddr=192.168.7.106 #静态IP
    4. gateway=192.168.7.1 #默认网关
    5. netmask=255.255.255.0 #子网掩码
    6. dns1=192.168.7.1 #DNS Configuration

3. Effect after modification

[plain] view plain copy

    1. #]# cat/etc/sysconfig/network-scripts/ifcfg-eth0  
    2. hwaddr= "00:15:5d:07:f1:02"   
    3. type= "Ethernet"   
    4. bootproto= "Static" #dhcp改为static    
    5. defroute= "yes"   
    6. peerdns= "yes"   
    7. peerroutes= "yes"   
    8. ipv4_failure_fatal= "No"   
    9. ipv6init= "yes"   
    10. ipv6_autoconf= "yes"   
    11. ipv6_defroute= "yes"   
    12. ipv6_peerdns= "yes"   
    13. ipv6_peerroutes= "yes"   
    14. ipv6_failure_fatal= "No"   
    15. name= "eth0"   
    16. uuid= "bb3a302d-dc46-461a-881e-d46cafd0eb71"   
    17. onboot= "yes" #开机启用本配置   
    18. ipaddr=192.168.7.106 #静态IP   
    19. gateway=192.168.7.1 #默认网关   
    20. netmask=255.255.255.0 #子网掩码   
    21. dns1=192.168.7.1 #DNS configuration  

4. Restart the Network Service

[plain] view plain copy

    1. # Service Network Restart

5, see the effect after the change, Centois 7 no longer use ifconfig instead of using the IP command to view network information.

[plain] view plain copy

  1. # IP Addr
  2. 1:lo: <LOOPBACK,UP,LOWER_UP> MTU 65536 qdisc noqueue State UNKNOWN
  3. Link/loopback 00:00:00:00:00:00 BRD 00:00:00:00:00:00
  4. inet 127.0.0.1/8 Scope host Lo
  5. Valid_lft Forever Preferred_lft Forever
  6. INET6:: 1/128 Scope Host
  7. Valid_lft Forever Preferred_lft Forever
  8. 2:eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> MTU qdisc pfifo_fast State UNKNOWN Qlen 1000
  9. Link/ether 00:15:5d:07:f1:02 BRD FF:FF:FF:FF:FF:FF
  10. inet 192.168.7.106/24 BRD 192.168.7.255 Scope Global eth0
  11. Valid_lft Forever Preferred_lft Forever
  12. Inet6 FE80::215:5DFF:FE07:F102/64 Scope link
  13. Valid_lft Forever Preferred_lft Forever

Centos 7 Learning static IP settings

Related Article

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.