当我在我的 linux Redhat 6.8 版机器上运行时 - service iptables status
我得到了规则表(但不是 iptables 是否运行)
以下是否表明 iptables 正在运行?
# service iptables status
Table: filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
2 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
5 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject- with icmp-host-prohibited
Chain FORWARD (policy ACCEPT)
num target prot opt source destination …
Run Code Online (Sandbox Code Playgroud) 我们有 bash 脚本来配置chrony.conf
脚本检查 ping 是否正常ntp1
(ntp2
ntp 服务器)
然后脚本将 ntp 服务器插入到/etc/chrony.conf
(仅当 ping 成功时)
bash 脚本的示例:
ping -c 1 ntp1
if [[ $? -eq 0 ]];then
echo "server ntp1 iburst" >> /etc/chrony.conf
else
echo "sorry so much but no ping to ntp1 server , /etc/chrony.conf will not configured "
exit 1
fi
ping -c 1 ntp2
if [[ $? -eq 0 ]];then
echo "server ntp2 iburst" >> /etc/chrony.conf
else
echo "sorry so much but no …
Run Code Online (Sandbox Code Playgroud)