首页 > 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. 2017年10月11日17:09 | #1

    Clomid 100 Mg Tablets To Buy viagra prescription Buy Albuterol Inhaler Canada Generic Staxyn

  2. 2017年10月12日08:26 | #2

    Levitra Drug Reviews Prescription Free Viagra Australia viagra prescription Prix Viagra Pharmacie Suisse Crotamiton Over The Counter

  3. 2017年10月15日13:38 | #3

    Least Expensive Viagra Prescription generic cialis Online Viagra Forum

  4. 2017年10月19日18:30 | #4

    Truly when someone doesn’t understand afterward its up to other
    users that they will help, so here it happens.

  5. 2017年10月20日05:57 | #5

    Thank you for another informative website.
    The place else could I get that type of info written in such
    a perfect way? I’ve a challenge that I’m just now operating on, and I have been on the look out for such information.

  6. 2017年10月20日06:27 | #6

    Excellent blog here! Also your site loads up very fast! What
    host are you using? Can I get your affiliate link to your host?
    I wish my site loaded up as quickly as yours lol

  7. 2017年10月20日12:26 | #7

    Hi to every one, it’s in fact a pleasant for me to pay a visit this web page, it consists of
    important Information.

  8. 2017年10月20日21:00 | #8

    I have been browsing online more than three hours today, yet I
    never found any interesting article like yours.
    It’s pretty worth enough for me. In my view, if all website owners and bloggers made good content as
    you did, the web will be much more useful than ever before.

  9. 2017年10月21日01:58 | #9

    I have read so many articles concerning the blogger lovers but
    this paragraph is truly a pleasant post, keep it up.

  10. 2017年10月21日06:58 | #10

    Howdy! Quick question that’s totally off topic. Do you know how to make your site mobile
    friendly? My blog looks weird when browsing from my iphone.
    I’m trying to find a theme or plugin that might be able to fix this problem.
    If you have any suggestions, please share. Thank you!

  11. 2017年10月22日11:21 | #11

    Hi, of course this piece of writing is truly nice and I have learned lot of things
    from it concerning blogging. thanks.

  12. 2017年10月22日21:39 | #12

    Accutane Online Pharmacy Uk Levitra 10mg Belgique Macrobid Express Delivery Shop buy levitra generic online Cialis Dosage 20mg

  13. 2017年10月23日22:07 | #13

    If you would like to take a great deal from this piece of writing then you have to apply these
    strategies to your won weblog.

  14. 2017年10月24日02:41 | #14

    Why visitors still use to read news papers when in this technological globe the whole thing is available on web?

  15. 2017年10月25日05:40 | #15

    For latest news you have to visit internet and on internet I found this website
    as a finest site for latest updates.

  16. 2017年10月25日06:05 | #16

    Why visitors still use to read news papers when in this technological globe everything is presented on web?

  17. 2017年10月25日11:38 | #17

    I’m not sure why but this weblog is loading incredibly
    slow for me. Is anyone else having this problem or is it a problem on my end?

    I’ll check back later and see if the problem still exists.

  18. 2017年10月26日02:33 | #18

    whoah this blog is magnificent i love reading your
    posts. Keep up the great work! You recognize,
    lots of people are searching round for this information, you could
    aid them greatly.

  19. 2017年10月26日06:51 | #19

    Somebody necessarily lend a hand to make seriously posts I’d state.

    That is the very first time I frequented your
    website page and thus far? I surprised with the analysis you made to create this actual put up incredible.
    Excellent activity!

  20. 2017年10月26日15:29 | #20

    I think the admin of this website is genuinely working
    hard in favor of his site, since here every stuff is quality
    based data.

  21. 2017年10月27日19:48 | #21

    Hello everyone, it’s my first go to see at this web page, and post is actually fruitful in support of me, keep up posting these articles or reviews.

  22. 2017年10月28日00:13 | #22

    Tadalis Sx Soft Like Online Doxycycline Buy Metronidazole 500 Mg Online viagra Comprar Priligy Barcelona

  23. 2017年10月28日05:09 | #23

    Brand Viagra Canada buy accutane in canada Buy Moduretic levitra in canada discount code Lasix Dosage Buy Lasix Cheap Legitimate Exilar 20 No Prescription

  24. 2017年10月28日22:20 | #24

    You have made some decent points there. I checked on the net for additional
    information about the issue and found most individuals will go along with your views on this website.

  25. 2017年10月29日04:59 | #25

    Thanks for sharing your thoughts. I truly
    appreciate your efforts and I am waiting for your further post thank you once
    again.

  26. 2017年10月31日07:17 | #26

    Priligy Usa Sale Propecia Dosage Reversible viagra Amoxicillin Herpes On Line Stendra In Internet Secure Cod Accepted Overseas

  27. 2017年11月1日05:32 | #27

    Hi there it’s me, I am also visiting this web site on a regular
    basis, this website is truly good and the visitors are
    really sharing good thoughts.

  28. 2017年11月1日08:11 | #28

    Your way of explaining the whole thing in this post is genuinely pleasant, every one be
    capable of without difficulty know it, Thanks a lot.

  29. 2017年11月3日12:05 | #29

    We’re a gaggle of volunteers and opening a new scheme in our community.

    Your website offered us with valuable info to work on. You’ve performed an impressive job and our entire group can be grateful to you.

  30. 2017年11月4日17:40 | #30

    Excellent web site you have got here.. It’s hard to find high-quality writing like yours nowadays.
    I seriously appreciate people like you! Take care!!

  31. 2017年11月5日05:31 | #31

    Its like you learn my thoughts! You appear to know so much approximately this, such as you wrote the guide in it or
    something. I think that you simply can do with some percent to pressure the message home a bit, but other than that, this is fantastic blog.
    A fantastic read. I’ll certainly be back.

  32. 2017年11月6日05:52 | #32

    I have read so many articles or reviews on the topic of the blogger lovers however this
    paragraph is really a fastidious piece of writing, keep it
    up.

  33. 2017年11月7日20:55 | #33

    Isotretinoin 10mg overseas low price Site De Vente De Cialis levitra shipped from us Amazon Propecia Cephalexin Dosing Instructions

  34. 2017年11月8日08:42 | #34

    Generally I don’t read article on blogs, however I would like to say that
    this write-up very pressured me to check out and do so!
    Your writing taste has been amazed me. Thank you, quite nice post.

  35. 2017年11月9日03:19 | #35

    I am actually thankful to the holder of this web page
    who has shared this fantastic post at here.

  36. 2017年11月10日07:54 | #36

    Hey there! I just would like to offer you a big thumbs up for the great info
    you have right here on this post. I am returning to your
    site for more soon.

  37. 2017年11月11日06:30 | #37

    Its like you read my mind! You seem to know so much about this, like you wrote the
    book in it or something. I think that you could do with a few pics to drive the
    message home a bit, but instead of that, this is excellent blog.
    A fantastic read. I will definitely be back.

  38. 2017年11月12日10:21 | #38

    Hi, i read your blog from time to time and i own a similar one
    and i was just curious if you get a lot of spam
    feedback? If so how do you protect against it, any plugin or anything you can recommend?

    I get so much lately it’s driving me mad so any support is
    very much appreciated.

  39. 2017年11月12日19:36 | #39

    I’m truly enjoying the design and layout of your website.
    It’s a very easy on the eyes which makes it much more enjoyable
    for me to come here and visit more often.
    Did you hire out a designer to create your theme?
    Exceptional work!

  40. 2017年11月13日01:50 | #40

    Generic Priligy Dapoxetine 60mg Where Can I Buy Fedex Provera Cheap Acheter Cialis Une Fois Par Jour generic viagra Propecia Storage

  41. 2017年11月13日11:01 | #41

    Us Parmacy No Script Needed Predison No Scrip viagra cialis Effet Levitra Kamagra Acostumbramiento Propecia Comprar Viagra

  42. 2017年11月15日22:42 | #42

    Quality articles or reviews is the important to be
    a focus for the people to pay a quick visit
    the web site, that’s what this web page is providing.

  43. 2017年11月17日20:35 | #43

    you are really a just right webmaster. The website loading pace is amazing.
    It seems that you’re doing any distinctive trick.

    Moreover, The contents are masterwork. you have performed a magnificent process in this subject!

  44. 2017年11月20日08:53 | #44

    Excellent blog here! Also your site a lot up very fast!
    What host are you using? Can I get your affiliate link for your host?

    I want my web site loaded up as fast as yours lol

  45. 2017年11月21日14:48 | #45

    Levitra Wechselwirkung Antibiotika Alesse levitra soft tabs Baclofene Molecule

  46. 2017年11月28日16:48 | #46

    hi!,I really like your writing so so much! percentage we
    keep up a correspondence more about your post on AOL?

    I require an expert on this area to resolve my problem. May be that’s you!

    Taking a look ahead to see you.

  47. 2017年11月29日08:31 | #47

    When some one searches for his essential thing, thus he/she needs to be available that in detail, thus that
    thing is maintained over here.

  48. 2017年11月29日21:37 | #48

    Yes! Finally someone writes about video production studio rental.

评论分页
订阅评论
0+5= (必填)