Specific applications of some iptables

Source: Internet
Author: User

ICMP related applications

So that I can not ping the 127.0.0.1

Iptables-a input-s 127.0.0.1-p icmp-j DROP

192.168.0.0/24 network segment can not ping the machine

Iptables-a input-s 192.168.0.0/24-p icmp-j DROP

All machines are banned.

# iptables-a input-s 0/0-P icmp-j DROP

# ICMP (PING) Accept! Echo-request

/sbin/iptables-a input-p ICMP--icmp-type! Echo-request-j ACCEPT

Accept_redirects

# echo ' 0 ' >/proc/sys/net/ipv4/conf/all/accept_redirects

Or

# sysctl net.ipv4.conf.all.accept_redirects= "0"

Prohibit IP access to yourself

[Root@linux root]# iptables-a input-s 192.168.0.253-j DROP

Ban MSN

/sbin/iptables-i forward-d gateway.messenger.hotmail.com-j DROP

/sbin/iptables-i forward-p TCP--dport 1863-j DROP

Ban QQ

/sbin/iptables-a forward-p tcp-d tcpconn.tencent.com--dport 80-j DROP

/sbin/iptables-a forward-p tcp-d tcpconn.tencent.com--dport 443-j DROP

/sbin/iptables-a forward-p tcp-d tcpconn2.tencent.com-j DROP

/sbin/iptables-a forward-i eth0-p UDP--dport 8000-j DROP

Ban BT

/sbin/iptables-a forward-i eth0-p TCP--dport 6881:6890-j DROP

Www

# no >>www

/sbin/iptables-a forward-p TCP--dport 80-j DROP

# Open >>www

/sbin/iptables-a forward-p TCP--dport 80-j ACCEPT

Ftp

# Prohibit FTP

/sbin/iptables-a forward-i eth0-p TCP--dport 20-j DROP

/sbin/iptables-a forward-i eth0-p TCP--dport 21-j DROP

# Open FTP

/sbin/iptables-a forward-i eth0-p TCP--dport 20-j ACCEPT

/sbin/iptables-a forward-i eth0-p TCP--dport 21-j ACCEPT

Smtp,pop3

# no SMTP,POP3

/sbin/iptables-a forward-i eth0-p TCP--dport 25-j DROP

/sbin/iptables-a forward-i eth0-p TCP--dport 110-j DROP

# Open into the SMTP,POP3

/sbin/iptables-a forward-i eth0-p TCP--dport 25-j ACCEPT

/sbin/iptables-a forward-i eth0-p TCP--dport 110-j ACCEPT



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.