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