centos7 修改静态ip

 需要更改的部门:设置静态ip

  

[root@rabbitmq /]# vim /etc/sysconfig/network-scripts/ifcfg-ens33 
[root@rabbitmq /]# cat /etc/sysconfig/network-scripts/ifcfg-ens33 
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=9960e90c-691b-40fb-9227-97deafb55bca
DEVICE=ens33
ONBOOT=yes

IPADDR=192.168.217.130
NETMASK=255.255.255.0
GATEWAY=192.168.217.2
PREFIX=24 DNS=192.168.1.1 DNS1=8.8.8.8 DNS2=8.8.4.4

DNS3=4.2.2.2
DNS4=223.5.5.5
 

 

[root@rabbitmq /]# cat /etc/resolv.conf 
# Generated by NetworkManager
search localdomain
nameserver 192.168.217.2
nameserver 8.8.8.8
nameserver 8.8.4.4
[root@rabbitmq /]# vim /etc/resolv.conf

             

[root@localhost ~]# cat /etc/sysconfig/network
# Created by anaconda
NETWORKING=yes
GATEWAY=198.168.217.2

 

[root@rabbitmq /]# service network restart  重启网络

设置的ip的网段要跟下面在一个网段

参照博客 https://segmentfault.com/a/1190000011954814

http://www.xfcodes.com/centos/32903_2.htm

192.168.217.2
posted @ 2018-02-11 00:25  zsls-lang  阅读(200)  评论(0编辑  收藏  举报