限制端口

#!/bin/bash
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -F
iptables -P INPUT DROP
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -p icmp -m icmp --icmp-type any -j ACCEPT ##ping
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -m multiport -p tcp --dport 22,80 -j ACCEPT   ##开放端口
iptables -A INPUT -m iprange --src-range 192.168.xx.xx-192.168.10.xx -j ACCEPT  ##接受哪些IP

iptables -A INPUT -s 114.80.xx.xx-j ACCEPT
iptables -A INPUT -s 114.80.xx.xx -j ACCEPT
iptables -A INPUT -j REJECT --reject-with icmp-host-prohibited ##ping

iptables 限制端口的更多相关文章

  1. iptables进行端口重定向

    使用iptables进行端口重定向,方法如下: 在机器A上操作: #iptables -t nat -A PREROUTING -d 192.168.203.173 -p tcp -m tcp --d ...

  2. iptables 设置端口转发/映射

    iptables 设置端口转发/映射 服务器A有两个网卡 内网ip:192.168.1.3 外网ip:10.138.108.103 本地回环:127.0.0.1 服务器B有网卡,8001提供服务 内网 ...

  3. [转载]CENTOS 6.0 iptables 开放端口80 3306 22端口

    原文地址:6.0 iptables 开放端口80 3306 22端口">CENTOS 6.0 iptables 开放端口80 3306 22端口作者:云淡风轻 #/sbin/iptab ...

  4. centos7 && centos6.5部KVM使用NAT联网并为虚拟机配置firewalld && iptables防火墙端口转发

    centos7 && centos6.5 部KVM使用NAT联网并为虚拟机配置firewalld && iptables防火墙端口转发 一.准备工作: 1: 检查kvm ...

  5. iptables 配置端口及转发

    iptables端口转发指令:iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 8443 iptables配 ...

  6. iptables实现端口映射(本地和远程端口映射)

    说明:需要将外网访问本地IP(192.168.75.5)的80端口转换为访问192.168.75.3的8000端口,这就需要用到iptables的端口映射 实现:1. 需要先开启linux的数据转发功 ...

  7. Ubuntu环境下的iptables的端口转发配置实例

    打开转发开关要让iptables的端口转发生效,首先需要打开转发开关方法一:临时打开,重启后失效$sudo su#echo 1 >/proc/sys/net/ipv4/ip_forward 方法 ...

  8. iptables 开启端口

    1.开启iptables端口 开启1521端口: iptables -A INPUT -p tcp --dport  -j ACCEPT iptables -A OUTPUT -p tcp --dpo ...

  9. linux下用用iptables做端口映射的shell

    情形一:跨网络.跨主机的映射Full-Nat 我们想到达主机B的80端口,但是由于网络限制可能无法直接完成.但是我们可以到达主机A的8080端口,而主机A可以直接到达B的80端口.这时候可以使用ipt ...

  10. iptables禁止端口和开放端口

    1.关闭所有的 INPUT FORWARD OUTPUT 只对某些端口开放. 下面是命令实现: iptables -P INPUT DROP iptables -P FORWARD DROP ipta ...

随机推荐

  1. VUE组件2数据传递

    传递数据 prop验证 除了传递数组,也可以传递对象 Vue.component('test',{ props:{ price:Number, unit: String } }) 如果price不是数 ...

  2. VsCode中编写python环境配置

    1. VsCode中编写python环境配置 1.1. 前言 有过开发经验都知道idea一系列的软件虽然功能比较多,但比较容易卡,电脑不好还真容易上火,这里我想要入门python,还是选了款vscod ...

  3. iview 多选下拉列表选项回显问题

    如,简单的多选Select, <Select v-model="model" filterable clearable transfer multiple > < ...

  4. python中print用法

    print用法 参考文档:https://blog.csdn.net/sinat_28576553/article/details/81154912 目录 一.print()函数概述 二.变量的输出 ...

  5. 《linux就该这么学》课堂笔记09 存储结构、磁盘划分

    Linux一切都是文件 "/"为根目录(万物起始)  **挂载后要想永久生效,需要修改开机启动项 vim /etc/fstab  

  6. ingress controller 注解使用

    ingress controller 注解使用 官网github注解地址: https://github.com/kubernetes/ingress-nginx/blob/master/docs/u ...

  7. 一款信息收集工具-theHarvester

    用法: theHarvester -d 163.com -l 1000 -b baidutheHarvester -d 163.com -l 1000 -b google -d 后跟服务器域名     ...

  8. django项目后台权限管理功能。

    对后台管理员进行分角色,分类别管理,每个管理员登录账号后只显示自己负责的权限范围. 创建后台管理数据库 models.py文件内 # 管理员表 class Superuser(models.Model ...

  9. php构建型模式(Builder pattern)

    练代码,增加了调用时的输出. <?php /* The builder pattern separates the construction of a complex object from i ...

  10. CodeChef Tree Palindromes

    Tree Palindromes Given a tree rooted at node 1 with N nodes, each is assigned a lower case latin cha ...