Static IP settings for Centos7 Learning
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