BLU Discuss list archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss] Limit the number of ip addresses which can connect to a port
- Subject: [Discuss] Limit the number of ip addresses which can connect to a port
- From: abreauj at gmail.com (John Abreau)
- Date: Tue, 31 Oct 2017 01:11:19 -0400
- In-reply-to: <CAJWk+TMC0434dz13VaDiFRogoeGRxpRqty2eUtnSp+0=HYyQmw@mail.gmail.com>
- References: <CAJWk+TMC0434dz13VaDiFRogoeGRxpRqty2eUtnSp+0=HYyQmw@mail.gmail.com>
The iptables "-s" option is for specifying the source address. If you want to limit access to a specific subnet: > iptables -I INPUT -p tcp --dport 8000 -s 192.168.10.0/24 -j ACCEPT If you want to limit access to a single address: > iptables -I INPUT -p tcp --dport 8000 -s 192.168.10.51 -j ACCEPT If you want to limit access to multiple non-contiguous addresses or subnets: > iptables -I INPUT -p tcp --dport 8000 -s 192.168.10.51,10.2.3.0/24,8.8.8.8 -j ACCEPT On Mon, Oct 30, 2017 at 6:08 PM, Tom Luo <mariolzx at gmail.com> wrote: > Hi, All, > > I am running a service in Ubuntu on a port. I try to limit the number of ip > addresses which can connect to the port. For example, if the limit is set > to 1, only connect from on ip address is allowed. > If there is a connection from another ip address, it will be declined. > > The only thing I can find so far is: > iptables -I INPUT -p tcp --dport 8000 -m connlimit --connlimit-upto 200 > --connlimit-mask 0 -j ACCEPT > > However, this only limits the number of connections instead of the number > of ip addresses. > Any one knows how to do it? > > > Thanks a lot! > > Tom > _______________________________________________ > Discuss mailing list > Discuss at blu.org > http://lists.blu.org/mailman/listinfo/discuss > -- John Abreau / Executive Director, Boston Linux & Unix Email: abreauj at gmail.com / WWW http://www.abreau.net / PGP-Key-ID 0x920063C6 PGP-Key-Fingerprint A5AD 6BE1 FEFE 8E4F 5C23 C2D0 E885 E17C 9200 63C6
- Follow-Ups:
- [Discuss] Limit the number of ip addresses which can connect to a port
- From: richard.pieri at gmail.com (Richard Pieri)
- [Discuss] Limit the number of ip addresses which can connect to a port
- References:
- [Discuss] Limit the number of ip addresses which can connect to a port
- From: mariolzx at gmail.com (Tom Luo)
- [Discuss] Limit the number of ip addresses which can connect to a port
- Prev by Date: [Discuss] Limit the number of ip addresses which can connect to a port
- Next by Date: [Discuss] Limit the number of ip addresses which can connect to a port
- Previous by thread: [Discuss] Limit the number of ip addresses which can connect to a port
- Next by thread: [Discuss] Limit the number of ip addresses which can connect to a port
- Index(es):