All pastes #423164 Raw Edit

Untitled

public text v1 · immutable
·published 2007-04-03 23:06 UTC
rendered paste body
Specifying Source and Destination IP Addresses

Source (`-s', `--source' or `--src') and destination (`-d', `--destination' or `--dst') IP addresses can be specified in four ways. The most common way is to use the full name, such as `localhost' or `www.linuxhq.com'. The second way is to specify the IP address such as `127.0.0.1'.

The third and fourth ways allow specification of a group of IP addresses, such as `199.95.207.0/24' or `199.95.207.0/255.255.255.0'. These both specify any IP address from 199.95.207.0 to 199.95.207.255 inclusive; the digits after the `/' tell which parts of the IP address are significant. `/32' or `/255.255.255.255' is the default (match all of the IP address). To specify any IP address at all `/0' can be used, like so:

            [ NOTE: `-s 0/0' is redundant here. ]
            # iptables -A INPUT -s 0/0 -j DROP
            #

This is rarely used, as the effect above is the same as not specifying the `-s' option at all.