当前位置: 首页 > news >正文

云龙湖旅游景区网站建设招标电子专业毕设做网站

云龙湖旅游景区网站建设招标,电子专业毕设做网站,档案网站建设的步骤,义乌购物网站建设多少钱iptables是一个非常强大的Linux防火墙工具#xff0c;你可以使用它来控制网络流量的访问和转发。 前面已经学习了iptables的基本原理#xff0c;四表五链的基本概念#xff0c;也已经安装好了iptables#xff0c;下面我们主要学习iptables命令的基本使用。 可以使用iptable… iptables是一个非常强大的Linux防火墙工具你可以使用它来控制网络流量的访问和转发。 前面已经学习了iptables的基本原理四表五链的基本概念也已经安装好了iptables下面我们主要学习iptables命令的基本使用。 可以使用iptables -h来查看帮助 $ iptables -h iptables v1.6.1Usage: iptables -[ACD] chain rule-specification [options]iptables -I chain [rulenum] rule-specification [options]iptables -R chain rulenum rule-specification [options]iptables -D chain rulenum [options]iptables -[LS] [chain [rulenum]] [options]iptables -[FZ] [chain] [options]iptables -[NX] chainiptables -E old-chain-name new-chain-nameiptables -P chain target [options]iptables -h (print this help information)Commands: Either long or short options are allowed.--append -A chain Append to chain--check -C chain Check for the existence of a rule--delete -D chain Delete matching rule from chain--delete -D chain rulenumDelete rule rulenum (1 first) from chain--insert -I chain [rulenum]Insert in chain as rulenum (default 1first)--replace -R chain rulenumReplace rule rulenum (1 first) in chain--list -L [chain [rulenum]]List the rules in a chain or all chains--list-rules -S [chain [rulenum]]Print the rules in a chain or all chains--flush -F [chain] Delete all rules in chain or all chains--zero -Z [chain [rulenum]]Zero counters in chain or all chains--new -N chain Create a new user-defined chain--delete-chain-X [chain] Delete a user-defined chain--policy -P chain targetChange policy on chain to target--rename-chain-E old-chain new-chainChange chain name, (moving any references) Options:--ipv4 -4 Nothing (line is ignored by ip6tables-restore)--ipv6 -6 Error (line is ignored by iptables-restore) [!] --protocol -p proto protocol: by number or name, eg. tcp [!] --source -s address[/mask][...]source specification [!] --destination -d address[/mask][...]destination specification [!] --in-interface -i input name[]network interface name ([] for wildcard)--jump -j targettarget for rule (may load target extension)--goto -g chainjump to chain with no return--match -m matchextended match (may load extension)--numeric -n numeric output of addresses and ports [!] --out-interface -o output name[]network interface name ([] for wildcard)--table -t table table to manipulate (default: filter)--verbose -v verbose mode--wait -w [seconds] maximum wait to acquire xtables lock before give up--wait-interval -W [usecs] wait time to try to acquire xtables lockdefault is 1 second--line-numbers print line numbers when listing--exact -x expand numbers (display exact values) [!] --fragment -f match second or further fragments only--modprobecommand try to insert modules using this command--set-counters PKTS BYTES set the counter during insert/append [!] --version -V print package version.iptables的命令语法通常如下 iptables [-t 表名] 管理选项 [链名] [匹配条件] [-j 动作]iptables -t 表名 -A/I/D/R 链名 [规则号] -i/o 网卡名 -p 协议名 -s 源IP/源子网 --sport 源端 -d 目标IP/目标子网 --dport 目标端口 -j 动作这里的各个部分解释如下 -t 表名这是可选的用于指定你要操作的表。如果没有指定默认是“filter”表。其他可用的表包括“nat”“mangle”和“raw”。管理选项这是你要执行的操作比如添加-A或删除-D一条规则插入一条规则-I替换一条规则-R清空链-F等。匹配条件这是可选的用于指定匹配条件。比如你可以匹配源或目标IP地址源或目标端口输入或输出接口等。-j 动作这是规则的动作当匹配条件满足时执行的操作。比如你可以接受ACCEPT数据包拒绝DROP数据包记录LOG数据包或者跳转到另一个链JUMP。 规则的管理 规则的查询 查看当前防火墙规则 $ sudo iptables -t nat -nvL Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)pkts bytes target prot opt in out source destinationChain INPUT (policy ACCEPT 0 packets, 0 bytes)pkts bytes target prot opt in out source destinationChain OUTPUT (policy ACCEPT 0 packets, 0 bytes)pkts bytes target prot opt in out source destinationChain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)pkts bytes target prot opt in out source destination选项 -n将地址和端口显示为数字-t table指定表名默认为filter-v显示更为详细的信息--line-numbers显示规则的ID 规则的添加 向表的链中添加规则 $ sudo iptables -t filter -A INPUT -p icmp -j REJECT$ sudo iptables -t filter -nvL Chain INPUT (policy ACCEPT 44 packets, 2912 bytes)pkts bytes target prot opt in out source destination0 0 REJECT icmp -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-port-unreachableChain FORWARD (policy ACCEPT 0 packets, 0 bytes)pkts bytes target prot opt in out source destinationChain OUTPUT (policy ACCEPT 33 packets, 2508 bytes)pkts bytes target prot opt in out source destination这条规则的含义就是在filter表的INPUT链上增加一条拒绝所有icmp请求的规则这样所有的ping请求将无法通讯 $ ping 172.29.142.35 -c 3 PING 172.29.142.35 (172.29.142.35) 56(84) bytes of data.--- 172.29.142.35 ping statistics --- 3 packets transmitted, 0 received, 100% packet loss, time 2044ms再添加一条规则 $ sudo iptables -t filter -A INPUT -p tcp -j ACCEPT$ sudo iptables -t filter -nvL --line-numbers Chain INPUT (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination 1 6 588 REJECT icmp -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-port-unreachable 2 96 5568 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destinationChain OUTPUT (policy ACCEPT 49 packets, 3724 bytes) num pkts bytes target prot opt in out source destination-A选项表示在尾部规则链中进行追加。 如果想在规则链的指定位置插入规则可以使用-I选项需要指定插入到规则链的哪个位置默认为1。 $ sudo iptables -t filter -I INPUT 2 -p udp -j ACCEPT$ sudo iptables -t filter -nvL --line-numbers Chain INPUT (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination 1 6 588 REJECT icmp -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-port-unreachable 2 0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 3 327 19308 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destinationChain OUTPUT (policy ACCEPT 51 packets, 3876 bytes) num pkts bytes target prot opt in out source destination规则的替换 使用-R选项进行规则的替换。 $ sudo iptables -t filter -R INPUT 1 -p icmp -j ACCEPT$ sudo iptables -t filter -nvL --line-numbers Chain INPUT (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination 1 0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 2 0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 3 473 27740 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destinationChain OUTPUT (policy ACCEPT 6 packets, 488 bytes) num pkts bytes target prot opt in out source destination规则的删除 使用-D选项进行规则的删除可以根据规则的ID进行删除也是根据整个规则进行删除。 $ sudo iptables -t filter -D INPUT 2$ sudo iptables -t filter -D INPUT -p tcp -j ACCEPT$ sudo iptables -t filter -nvL --line-numbers Chain INPUT (policy ACCEPT 8 packets, 464 bytes) num pkts bytes target prot opt in out source destination 1 0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destinationChain OUTPUT (policy ACCEPT 5 packets, 388 bytes) num pkts bytes target prot opt in out source destination可以使用-F来删除所有的规则 $ sudo iptables -t filter -F$ sudo iptables -t filter -nvL --line-numbers Chain INPUT (policy ACCEPT 8 packets, 464 bytes) num pkts bytes target prot opt in out source destinationChain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destinationChain OUTPUT (policy ACCEPT 5 packets, 380 bytes) num pkts bytes target prot opt in out source destination可以使用-Z选项让规则的计数器从0重新开始 $ sudo iptables -t filter -Z匹配条件 iptables可以根据不同的匹配条件来过滤网络数据包。iptables的匹配条件可以分为通用匹配条件和扩展匹配条件两种。 通用匹配条件 -p指定协议类型如TCP、UDP、ICMP等。-s指定源IP地址或地址段。-d指定目标IP地址或地址段。–sport指定源端口号。–dport指定目标端口号。-i指定数据包进入的网络接口。-o指定数据包输出的网络接口。 扩展匹配条件除了通用匹配条件其余可用于匹配的条件称为扩展配条件这些扩展匹配条件在netfilter中以模块的形式存在如果想使用这些条件则需要依赖对应的拓展模块。 扩展匹配条件包括 –mac-source指定源MAC地址。–mac-destination指定目标MAC地址。–state指定连接状态如NEW、ESTABLISHED、RELATED等。–tcp-flags指定TCP标志位。–icmp-type指定ICMP类型。–limit限制匹配规则的匹配次数。–comment为匹配规则添加注释。 处理动作 iptables规则的处理动作是指对匹配到的数据包所采取的操作。 常见的处理动作包括 ACCEPT允许数据包通过DROP直接丢弃数据包不给任何回应信息。。REJECT拒绝数据包通过必要时会给数据发送端一个相应的信息客户端刚请求就会收到拒绝的信息。SNAT源地址转换解决内网用户用同一个公网地址上网的问题。MASQUERADE是SNAT的一种特殊形式适用于动态的、临时会变的IP上。DNAT目标地址转换REDIRECT在本机做端口映射。LOG在/var/log/mesages文件中记录日志信息然后将数据包传递给下一条规则。即除了记录外不对数据包做任何其他操作仍然让下一条规则进行匹配 自定义链 在iptables中可以创建自定义链Custom Chains来组织和管理防火墙规则。 自定义链可以以更高层次和更好的可读性来管理规则使配置和维护更加简单。 创建链mychain $ sudo iptables -N MYCHAIN$ sudo iptables -t filter -nvL Chain INPUT (policy ACCEPT 201 packets, 12360 bytes)pkts bytes target prot opt in out source destinationChain FORWARD (policy ACCEPT 0 packets, 0 bytes)pkts bytes target prot opt in out source destinationChain OUTPUT (policy ACCEPT 127 packets, 9820 bytes)pkts bytes target prot opt in out source destinationChain MYCHAIN (0 references)pkts bytes target prot opt in out source destination此时filter表中多了一条MYCHAIN链。 添加规则到自定义链 $ sudo iptables -t filter -A MYCHAIN -s 192.168.1.0/24 -j DROP禁止192.168.1.0/24的网段访问本机丢弃源地址的流量。 调用自定义链 $ sudo iptables -t filter -A INPUT -p tcp --dport 80 -j MYCHAIN$ sudo iptables -t filter -nvL --line-numbers Chain INPUT (policy ACCEPT 6 packets, 348 bytes) num pkts bytes target prot opt in out source destination 1 0 0 MYCHAIN tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destinationChain OUTPUT (policy ACCEPT 4 packets, 304 bytes) num pkts bytes target prot opt in out source destinationChain MYCHAIN (1 references) num pkts bytes target prot opt in out source destination 1 0 0 DROP all -- * * 192.168.1.0/24 0.0.0.0/0将所有传入TCP端口80的流量传递到MYCHAIN自定义链进行处理。如果不调用自定义的规则链则自定义的规则链无效。 清空链中的规则 $ iptables -F MYCHAIN删除指定的自定义链 $ iptables -X MYCHAIN删除所有的的自定义链 $ iptables -X
http://www.sadfv.cn/news/212284/

相关文章:

  • 凡科网站建设是免费的吗威海优化推广
  • 网站未续费到期后打开会怎样个人网站可以直接做微信登陆吗
  • 自己可以学着做网站吗app推广注册从哪里接单
  • 黄州区精神文明建设网站wordpress更改文章宽度
  • wordpress网站后台要怎么登陆wordpress接入翼支付
  • 网站的信息架构学电商比较好的网站有哪些
  • 招聘网站建设策划书海南百度推广中心
  • 成都高校网站建设服务公司网络推广提成方案
  • 达人室内设计网站在深圳找工作哪个网站好
  • 网站工程师招聘长沙网标集团
  • c 教程如何做网站网络推广怎么做效果好
  • 建大型网站费用网建企业
  • 网站建设合同 模板 下载宁波网站排名优化报价
  • 网站 刷流量 SEOwordpress博客页修改
  • 重庆自助建站系统哪家好网络推广与推广
  • 三丰云做网站步骤vs做网站如何发布
  • asp网站开发教程wordpress线上安装
  • 响应式网站 移动端网站优化大师使用方法
  • 江阴网站开发公司电话广告网站建设最专业
  • 公众号网站开发用什么模板wordpress企业仿站视频教程
  • 家具东莞网站建设个人网站html模板下载
  • 电脑做系统教学网站手机在线网站建设
  • ae模板精品站WordPress的欢迎页面
  • 网站后期维护内容电子产品外包加工项目
  • 金华市建设局网站贾润根泉州制作网站开发
  • 江苏城乡建设网站网站开发敲代码
  • 百度站内搜索代码wordpress 修改路径
  • 做网站最烂公司建设银行深圳培训中心网站
  • 一键wordpress建站新乡网络公司推荐
  • 萧山品牌网站建设企业宣传片视频模板