CentOS7.5固定IPの構成


1.NIC名を表示[root@centos ~]# ip addr
1: lo:  mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    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 forever
2: ens33:  mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:55:7d:52 brd ff:ff:ff:ff:ff:ff
    inet 192.168.18.212/24 brd 192.168.18.255 scope global noprefixroute ens33
       valid_lft forever preferred_lft forever
    inet6 fe80::cfb8:9c22:bff4:c2e3/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

2、NICプロファイルの編集
[root@centos ~]# vi/etc/sysconfig/network-scripts/ifcfg-ens33
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static"
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="ens33"
UUID="e408ab5d-6013-4f49-8e37-dfdb7202a25c"
DEVICE="ens33"
ONBOOT="yes"
IPV6_PRIVACY="no"
IPADDR=192.168.18.212
NETMASK=255.255.255.0
GATEWAY=192.168.18.1
DNS1=192.168.1.2
DNS2=8.8.8.8

3、ネットサービスの再起動[root@centos ~]# service network restart Restarting network (via systemctl): [ OK ]
ping www.baiduをテストします.comが通じません