首页 > iptabes, linux > ubuntu iptables 脚本

ubuntu iptables 脚本

2010年1月28日 eric 发表评论 阅读评论

            谈下我的 iptables 规则.

#!/bin/bash
case “$1″ in
start)
echo -n “Staring to write your Iptbales:…”
/sbin/iptables -F
/sbin/iptables -X
/sbin/iptables -Z

/sbin/iptables -P INPUT DROP
/sbin/iptables -P OUTPUT ACCEPT
/sbin/iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o eth0 -p icmp -j ACCEPT
iptables -A INPUT -i eth0 -p icmp –icmp-type echo-reply -j ACCEPT
iptables -t filter -A INPUT -p icmp -s 111.111.111.111 -j ACCEPT
iptables -A INPUT -i eth0 -p icmp -j REJECT –reject-with icmp-host-unreachable
/sbin/iptables -A INPUT -p tcp -m tcp –dport 80 -j ACCEPT
/sbin/iptables -A INPUT -p tcp -i eth0 -s 111.111.111.111/32 –destination-port 555 -j ACCEPT
/sbin/iptables -A INPUT -p all -m state –state ESTABLISHED,RELATED -j ACCEPT
/sbin/iptables -A INPUT -p all -m state –state INVALID,NEW -j DROP
echo “Ok”

;;
*)
echo “Usage: $0 {start}”
esac

exit 0

上面的规则 icmp 只允许 111.111.111.111 的ping 其他人ping 服务器,返回伪造的icmp-host-unreachable 信息

开放 80 端口供任何人访问,开放 555端口 只允许 111.111.111.111 访问

我把 SSH 端口设置为 555 因为有很多无聊的人都在每天扫描着  22 端口很烦~~

iptables 的规则要有顺序,如果顺序杂乱虽然可以使用,但是也会引起一些瓶径“导致服务器访问速度下降!!

转载请注明:文章转载自:Eric's linux and nginx! (http://www.nginxs.com)
本文地址:http://www.nginxs.com/linux/51.html

分类: iptabes, linux 标签: , , ,
  1. 2018年5月16日06:51 | #1

    polyphenols foods foods with polyphenols list dr gundry recipes [url=https://polyphenolsfoods.us.com]foods with polyphenols[/url]

  2. 2018年6月3日05:55 | #2

    Levitra Paypal Keflex For Urinary Bladder Infection Potenzmittel Viagra Etc viagra vs cialis Amoxicillin And Leave And Body

  3. 2018年6月12日00:44 | #3

    Woah! I’m really loving the template/theme of this site.
    It’s simple, yet effective. A lot of times it’s difficult
    to get that “perfect balance” between superb usability
    and visual appeal. I must say you’ve done a superb job with this.
    In addition, the blog loads extremely quick for me on Internet explorer.
    Outstanding Blog!

  4. 2018年6月12日21:52 | #4

    My coder is trying to convince me to move to .net from PHP.
    I have always disliked the idea because of the costs.
    But he’s tryiong none the less. I’ve been using Movable-type on numerous websites for about a year and
    am worried about switching to another platform. I have heard good things about blogengine.net.
    Is there a way I can transfer all my wordpress posts into it?
    Any kind of help would be greatly appreciated!

  5. 2018年7月14日12:37 | #5

    Noisy garage doors are a standard drawback.

  6. 2018年7月14日20:30 | #6

    Dry the cleaned area. Chem-Dry Carpet Cleaning.

  7. 2018年7月15日02:52 | #7

    Noisy storage doorways are a common problem.

  8. 2018年7月16日04:21 | #8

    We’re your local storage door restore knowledgeable.

  9. 2018年7月30日08:40 | #9

    Accountants give orders; bookkeepers comply with them.

  10. 2018年8月6日11:02 | #10

    wh0cd2492901 cost of daily cialis

  11. 2018年8月6日11:03 | #11

    wh0cd2492901 cheapest cialis 20mg

  12. 2018年8月8日09:35 | #12

    wh0cd2492901 drug levaquin

  13. 2018年8月8日09:35 | #13
  14. 2018年8月12日08:00 | #14

    wh0cd2492901 strattera cost

  15. 2018年8月13日15:34 | #15

    wh0cd2492901 antibiotic ampicillin

  16. 2018年8月16日05:54 | #16

    wh0cd2492901 kamagra

评论分页
订阅评论
1+9= (必填)