Windows防火墙开关及入站规则

Windows打开关闭防火墙
注:使用管理员权限打开cmd或者powershell

# 打开防火墙
netsh advfirewall set allprofiles state on
# 关闭防火墙
netsh advfirewall set allprofiles state off

windows 设置出入站规则

netsh advfirewall firewall add rule name=名字 dir=in action=allow protocol=协议 localport=端口

# advfirewall  		高级防火墙功能
# firewall  		防火墙
# add  				添加新规则
# Rule  			规则
# Name 				规则的名字
# Dir  				数据方向,in 表示进入 out  表示 发出
# action 			动作 ,有 allow 允许 和 block 阻止
# protocol 			协议 可以是 0-255|icmpv4|icmpv6|icmpv4:type,code|icmpv6:type,code|tcp|udp|any (default=any) 一般是TCP
# localport 		本地使用的端口号

示例:

# 设置一个允许 HTTP 8080 端口的外来访问
netsh advfirewall firewall add rule name="Client Host Service" dir=in action=allow protocol=TCP localport=8080

netsh
在这里插入图片描述
advfirewall
在这里插入图片描述
查看防火墙现状 show
在这里插入图片描述

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值