User-Profile-Image
hankin
  • 5
  • 首页
  • 分类
    • Windows
    • Web
    • VoIP
    • Virtualization
    • Trading
    • Smart Home
    • SEO
    • Security
    • Python
    • Program
    • PHP
    • OSX
    • OS
    • OpenSource
    • Nginx
    • MySQL
    • Mood
    • Linux
    • Life
    • Injection
    • Hosting
    • Finance
    • Exploits
    • CDN
  • 页面
    • About
  • 友链
    • 维酷科技
Help?

Please contact us on our email for need any support

Support
  • 首页
    首页   ›   OS   ›   Linux   ›   正文
Linux

iptables仅允许指定IP访问端口

2020-04-27 17:22:52
3894  0 0

因为iptables匹配规则是逐条匹配的所以执行命令的时候有先后顺序。

比如仅允许IP 1.1.1.1访问80端口

先禁止访问80端口

iptables -I INPUT -p tcp --dport 80 -j DROP

再允许1.1.1.1访问80端口

iptables -I INPUT -s 1.1.1.1 -p tcp --dport 80 -j ACCEPT
评论 (0)

Click here to cancel reply.

欢迎您 游客  

    ProdigYu
    181文章 17评论 4点赞 602239浏览
    随机文章
    curl命令指定网卡出口访问
    3年前
    I’m come back.
    15年前
    WordPress安装Redis插件加速
    6年前
    解决Docker容器内CentOS不能使用systemctl服务
    4年前
    Docker创建CentOS8镜像自定义配置保存
    4年前
    Tags
    Apache CentOS CMD DDOS Debian DNS Docker FastCGI Google IIS IP iptables Linux Mac MySQL Nginx Opensource PHP Python Skill SSH Ubuntu Vim VMware VPN web.py Windows 删除 命令 命令提示符 安装 开源 技巧 插件 漏洞 百度 系统 组件 终端 缓存 网络电话 脚本 自建 详解 错误
    Meta
    • Log in
    • Entries feed
    • Comments feed
    • WordPress.org
    Copyright © 2025
    主页
    页面
    • About
    博主
    ProdigYu 管理员
    Something about myself
    181 文章 17 评论 602239 浏览
    测试
    测试