#!/bin/bash
start and peizhi firewalld
将所有IP同步到hosts文件包括vip
ip_add=cat /etc/hosts | grep -v localhost | awk '{print $1}' | grep -v ^$ | grep -v ^#
systemctl start firewalld
systemctl enable firewalld
for ip in
i
p
a
d
d
d
o
f
i
r
e
w
a
l
l
−
c
m
d
−
−
p
e
r
m
a
n
e
n
t
−
−
z
o
n
e
=
t
r
u
s
t
e
d
−
−
a
d
d
−
s
o
u
r
c
e
=
ip_add do firewall-cmd --permanent --zone=trusted --add-source=
ipadddofirewall−cmd−−permanent−−zone=trusted−−add−source=ip
done
firewall-cmd --permanent --zone=trusted --add-source=172.30.0.0/8
firewall-cmd --permanent --zone=trusted --add-source=10.254.0.0/8
firewall-cmd --set-default-zone=public
firewall-cmd --reload
firewall-cmd --zone trusted --list-all