CentOS7.5 配置固定IP
阿新 • • 發佈:2018-10-23
ethernet com link bootp lin etc ast 重啟網絡服務 pri 1、查看網卡名稱
[root@centos ~]# ip addr
[root@centos ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> 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: <BROADCAST,MULTICAST,UP,LOWER_UP> 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、編輯網卡配置文件
[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 restartRestarting network (via systemctl): [ OK ]
測試ping www.baidu.com 看通不通
CentOS7.5 配置固定IP