CentOS设置IP案例
静态IP案例,修改黄色部分:
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-em1
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="none"
IPADDR=172.16.26.124
PREFIX=24
GATEWAY=172.16.26.1
DNS1=223.5.5.5
DNS2=223.6.6.6
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="em1"
DEVICE="em1"
UUID=
ONBOOT="yes"
不设置IP案例:
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-em1
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=em1
UUID=
DEVICE=em1
ONBOOT=yes
DHCP案例:
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-em1
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=em1
UUID=
DEVICE=em1
ONBOOT=yes
有道云笔记 https://note.youdao.com/ynoteshare/index.html?id=9495345711d4d71e82e9e78d69979ed5