firewalld基础试题

firewalld基础试题
1.默认public区域对外开放所有人能通过ssh服务连接,但拒绝192.168.200.0/24网段通过ssh连接服务器

[root@wjh ~]# firewall-cmd --add-rich-rule='rule family=ipv4 source address=192.168.200.0/24 port port=22 protocol=tcp drop'            
success

2.使firewalld允许所有人能访问http,nginx服务,但是只有192.168.100.10主机可以访问ssh服务

[root@wjh ~]# firewall-cmd --add-service=https --permanent
success
[root@wjh ~]# firewall-cmd --add-service=https --permanent
success
[root@wjh ~]# firewall-cmd --remove-service=ssh
success
[root@wjh ~]# firewall-cmd --add-source="192.168.100.10" --zone=trusted
success
[root@wjh ~]# firewall-cmd --reload
success

3.当用户来源IP地址是192.168.100.20主机,则将用户请求的5555端口转发后至后端192.168.100.10的22端口。

[root@wjh ~]# firewall-cmd --add-rich-rule='rule family="ipv4" source address="192.168.100.20/32" forward-port port=5555 protocol=tcp to-port=22 to-addr=192.168.100.10'  
success

4.将tcp协议端口3300-3400添加到external区域

[root@wjh ~]# firewall-cmd --zone=external  --add-port=3300-3400/tcp

5.查询internal区域中是否包含接口ens33

[root@wjh ~]# firewall-cmd --zone=internal --list-interfaces
ens33

没有可以添加

[root@wjh ~]# firewall-cmd --zone=internal --change-interface=ens33
success
[root@wjh ~]# firewall-cmd --get-zone-of-interface=ens33
internal

6.为internal区域删除绑定的网络接口ens33

[root@wjh ~]# firewall-cmd --zone=internal --remove-interface=ens33
success
[root@wjh ~]# firewall-cmd --zone=internal --list-interfaces       
[root@wjh ~]# 

7.查询internal区域中是否启用了SSH服务

[root@wjh ~]# firewall-cmd --zone=internal --list-services
dhcpv6-client ipp-client mdns samba-client ssh

8.为internal区域设置允许访问SSH服务

[root@wjh ~]# firewall-cmd --zone=internal --query-service=ssh
yes
发布了25 篇原创文章 · 获赞 0 · 访问量 664

猜你喜欢

转载自blog.csdn.net/miss_miss6/article/details/105415609
今日推荐