我是靠谱客的博主 和谐网络,这篇文章主要介绍RHCE之防火墙,现在分享给大家,希望可以做个参考。

1.iptables: 开启防火墙:可以正常使用ssh服务,dns服务, httpd服务,chrony服务, nfs服务
2.firewalld: 开启防火墙:可以正常使用ssh服务,dns服务, httpd服务,chrony服务, nfs服务
且实现:访问第一台机器web服务的9090端口,转发到第二台机器的80端口(永久生效)

实验1

 安装iptables服务

 关闭防火墙,开启iptables服务,添加规则:ssh服务端口22,dns服务53,httpd服务80,chrony服务123,nfs服务111

[ root @ jingchen ~]# systemctl stop firewalld . service 
[ root @ jingchen ~]# systemctl start firewalld . service 
[ root @ jingchen ~]# iptables - t filter - A INPUT - p tcp -- dport  22- j  ACCEPT 
[ root @ jingchen ~]# iptables - t filter - A INPUT - p udp -- dport 53- j  ACCEPT 
[ root @ jingchen ~]# iptables - t filter - A INPUT - p tcp -- dport  80- j  ACCEPT 
[ root @ jingchen ~]# iptables - t filter - A INPUT - p udp -- dport 123- j  ACCEPT 
[ root @ jingchen ~]# iptables - t filter - A INPUT - p udp -- dport 111- j  ACCEPT

  • 查看规则表 

[ root @ jingchen ~]# iptables -vnL --line-numbers​​​​​​​

实验2

 1.关闭iptables,开启firewalld

[ root @ jingchen ~]# systemctl stop iptables
[ root @ jingchen ~]# systemctl start firewalld 

 2.允许协议访问:ssh,http,dns,chrony,nfs服务

[root@jingchen ~]#firewal1- Cmd -- add - service = Ssh 
 Warning : ALREADY _ENABLED :' ssh ' already in 'public'
 success
 Iroot@jingchen ~]# firewal - c - cmd -- add - service = http 
  success 
[ root@jingchen ~]# firewalL -- cmd -- add - service = dns 
 success
 Iroot@jingchen ~]# firewalL - Cmcmd -- add - port =123/udp
 success
[ root@ingchen ~]#firewal1- cmd -- add - service = n fs 
 success

 3.查看

 4.转发端口,永久生效,需要重新加载并测试

 

 

最后

以上就是和谐网络最近收集整理的关于RHCE之防火墙的全部内容,更多相关RHCE之防火墙内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(72)

评论列表共有 0 条评论

立即
投稿
返回
顶部