centos7设置静态IP

1、设置桥接网络

 

 

2、修改vi /etc/sysconfig/network-scripts/ifcfg-ens33

BOOTPROTO="static" # 使用静态IP地址,默认为dhcp 
IPADDR="192.168.152.77" # 设置的静态IP地址
NETMASK="255.255.252.0" # 子网掩码 
GATEWAY="192.168.152.1" # 网关地址 
DNS1="192.168.152.1" # DNS服务器(与网关一致即可)
ONBOOT=yes  #设置网卡启动方式为 开机启动 并且可以通过系统服务管理器 systemctl 控制网卡

3、vi /etc/sysconfig/network

# Created by anaconda
NETWORKING=yes
GATEWAY=192.168.152.1

4、重启网络服务

service network restart;

5、校验下网络

ping www.baidu.com
[root@localhost ~]# ping www.baidu.com
PING www.a.shifen.com (180.101.49.11) 56(84) bytes of data.
64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=1 ttl=44 time=13.5 ms
64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=2 ttl=44 time=13.8 ms
64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=3 ttl=44 time=13.8 ms

 6、直接把防火墙也关掉吧

systemctl status firewalld
systemctl disable firewalld

 7、查看查看当前操作系统版本信息

[root@localhost ~]# cat /proc/version
Linux version 3.10.0-1127.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) ) #1 SMP Tue Mar 31 23:36:51 UTC 2020

8、查看版本当前操作系统发行版信息

[root@localhost ~]# cat /etc/redhat-release 
CentOS Linux release 7.8.2003 (Core)

 

  

 

  

posted @ 2020-04-29 09:15  测道之路  阅读(459)  评论(0编辑  收藏  举报