CentOS 7.6 虚拟机静态IP配置

静态IP配置

su root
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=d58e7ccd-1a56-4266-8964-ac609a3ff29a
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.40.130
NETMASK=255.255.255.0
GATEWAY=192.168.40.2
systemctl restart network
ifconfig

cmd.exe

ping 192.168.40.130

访问外网

关闭防火墙

解决 Redis 6379 端口无法访问

systemctl stop firewalld  # 停止
systemctl disable firewalld # 禁用自动启动
systemctl status firewalld # 查看状态

关闭 SELinux

解决 CentOS 7.6 虚拟机挂起失败

vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

重启 CentOS 7.6

sestatus
posted @ 2021-12-01 20:20  clipboard  阅读(357)  评论(0编辑  收藏  举报