Skip to contentSkip to conversation

query regarding hashlimit using ipset src,dst tuple

DISCUSSION Bo Yang 1 participant 1 message Oct 16, 2006 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Bo Yang

author
#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Manish Jain :

Quoted 10 lines

Hi,

I have a requirement as follows -

Say there are 2 source IPs - src1 and src2, and 2 destination IP - dst1, dst2.
I need to limit src1->dst1 as well as src2-dst2 communication but want unlimited src2->dst1 communication.
I have a ipset KNOWN, which contains src1, src2, dst1, dst2

Quoted 6 lines

Now i write a rule as follows -
iptables -A INPUT_CHAIN --match hashlimit --hashlimit 1000/s --hashlimit-mode srcipdstip --hashlimit-name foo -m set --set KNOWN src,dst -j ACCEPT

But this will limit the src2->dst1 communication as well, which I dont

want.

Quoted 2 lines

1. Is there a way to add ip1,ip2 as a tuple in a ipset the way we can

do for

Quoted 1 line

ip1%port?

Yes , look the ipset manual to find the binding .

Quoted 1 line

2. Is there a mode which can help me do this, using a single iptable

rule as

Quoted 1 line

above?

Following maybe :
ipset -N from ipmap --network 192.168.0.0/24
ipset -A from src1
ipset -A from src2

ipset -N to ipmap --network 192.168.0.0/24
ipset -A to dst1
ipset -A to dst2

ipset -B from default -b to

iptables -A INPUT_CHAIN --match hashlimit --hashlimit 1000/s
- --hashlimit-mode srcipdstip --hashlimit-name foo -m set --set KNOWN src,dst -j ACCEPT

Quoted 1 line

3. Is there a way to specify multiple ipsets in 1 iptable rule?

I think one set with its bindings can do everything for you ~ -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFMyha7tZp58UCwyMRAhWDAJ9o8DdSFxcMDUbK8djcqtTF3Va7MACgsbU1 e5JKNYI/P62IGXKtVD3i7wY=
=mDXZ
-----END PGP SIGNATURE-----