网站首页 > 技术教程 正文
防火墙
我们都知道,外部网络想要访问虚拟机内部的linux系统,一定是要将linux防火墙开放对应端口或者直接关闭防火墙,不然外部连接会出现很大问题。
Linux中有两种防火墙软件,ConterOS7.0以上使用的是firewall,ConterOS7.0以下使用的是iptables
防火墙根据配置文件/etc/sysconfig/iptables来控制本机的”出”、”入”网络访问行为。
firewall
- 开启防火墙:
systemctl start firewalld
- 关闭防火墙:
systemctl stop firewalld
- 查看防火墙状态:
systemctl status firewalld
- 设置开机启动:
systemctl enable firewalld
- 禁用开机启动:
systemctl disable firewalld
- 重启防火墙:
firewall-cmd --reload
- 开放端口(修改后需要重启防火墙方可生效):
firewall-cmd --zone=public --add-port=8080/tcp --permanent
- 查看开放的端口:
firewall-cmd --list-ports
- 关闭端口:
firewall-cmd --zone=public --remove-port=8080/tcp --permanent
Iptables
安装
由于CenterOS7.0以上版本并没有预装Iptables,我们需要自行安装。因为centos7以上用firewall,所以暂时不用管iptables
- 安装前先关闭firewall防火墙
- 安装iptables:
yum install iptables
- 安装iptables-services:
yum install iptables-services
使用
- 开启防火墙:
systemctl start iptables.service
- 关闭防火墙:
systemctl stop iptables.service
- 查看防火墙状态:
systemctl status iptables.service
- 设置开机启动:
systemctl enable iptables.service
- 禁用开机启动:
systemctl disable iptables.service
猜你喜欢
- 2025-06-23 Linux 操作系统不需要防病毒软件和防火墙的几个原因
- 2025-06-23 Linux防火墙——iptables原理介绍
- 2025-06-23 防火墙/路由器Linux发行版Devil-Linux
- 2025-06-23 五问 Linux 网络防火墙(四):nftables 的高效框架与数据结构
- 2025-06-23 linux防火墙过滤技术iptables的原理及操作命令详解
- 2025-06-23 Linux,操作系统,防火墙,Netfilter,命令及操作
- 2025-06-23 LINUX IPTABLES 防火墙配置(linux防火墙怎么配置)
- 2025-06-23 Linux安全之网络防火墙(linux防火墙在哪)
- 2025-06-23 linux系统相关防火墙iptables命令操作
- 2025-06-23 linux 防火墙基本命令(linux防火墙主要功能)
你 发表评论:
欢迎- 最近发表
- 标签列表
-
- 下划线是什么 (87)
- 精美网站 (58)
- qq登录界面 (90)
- nginx 命令 (82)
- nginx .http (73)
- nginx lua (70)
- nginx 重定向 (68)
- Nginx超时 (65)
- nginx 监控 (57)
- odbc (59)
- rar密码破解工具 (62)
- annotation (71)
- 红黑树 (57)
- 智力题 (62)
- php空间申请 (61)
- 按键精灵 注册码 (69)
- 软件测试报告 (59)
- ntcreatefile (64)
- 闪动文字 (56)
- guid (66)
- abap (63)
- mpeg 2 (65)
- column (63)
- dreamweaver教程 (57)
- excel行列转换 (56)
本文暂时没有评论,来添加一个吧(●'◡'●)