* (unknown)
[not found] <S1752389AbYJDKwq/20081004105246Z+121@vger.kernel.org>
@ 2008-10-04 11:20 ` Sebastian Seemann
2008-10-05 5:14 ` Grant Taylor
0 siblings, 1 reply; 11+ messages in thread
From: Sebastian Seemann @ 2008-10-04 11:20 UTC (permalink / raw)
To: netfilter
Hi,
I would like to DROP all connections from IPs originating in a specified country. Of course, the geoip extension is a perfect fit for that. My question is what happens if I do this:
iptables -P INPUT DROP
iptables -A INPUT -m geoip ! --src-cc [country] -j ACCEPT
What happens if an IP is not found in the geoip-database, so it has no country-code at all? Is it accepted or not?
I would suppose it is accepted and, since I wanna be sure, would be thankful for a workaround simpler than adding every country in the world but the forbidden one.
Best Regards,
Sebastian
--
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger
^ permalink raw reply [flat|nested] 11+ messages in thread* Re:
2008-10-04 11:20 ` (unknown) Sebastian Seemann
@ 2008-10-05 5:14 ` Grant Taylor
2008-10-05 5:53 ` Re: Grant Coady
0 siblings, 1 reply; 11+ messages in thread
From: Grant Taylor @ 2008-10-05 5:14 UTC (permalink / raw)
To: Mail List - Netfilter
On 10/4/2008 6:20 AM, Sebastian Seemann wrote:
> What happens if an IP is not found in the geoip-database, so it has
> no country-code at all? Is it accepted or not?
I don't know for sure what the GeoIP match extension will do if the IP
is not in the database. I would expect the match to fail. However with
inverse logic included I'd guess that the failure would turn in to a
success. But with out testing, this is only a guess.
> I would suppose it is accepted and, since I wanna be sure, would be
> thankful for a workaround simpler than adding every country in the
> world but the forbidden one.
I would be tempted to re-write your rule like this
iptables -A INPUT ! -m geoip --src-cc [country] -j ACCEPT
The difference being that you are moving the negative logic out of an
unpredictable failure situation (GeoIP not knowing where the IP is from)
to a controlled situation (IPTables inverting the result of a match
extension).
Further, the GeoIP match extension should only return a successful match
/if/ the source IP is in said source country. Rather GeoIP will not
match if the IP is included in the database but not associated with said
country. Likewise GeoIP should not success on an unknown IP because it
could not make a match.
With GeoIP behaving more predictably you can have IPTables test for
GeoIP *NOT* matching.
Grant. . . .
^ permalink raw reply [flat|nested] 11+ messages in thread* Re:
2008-10-05 5:14 ` Grant Taylor
@ 2008-10-05 5:53 ` Grant Coady
2008-10-05 8:45 ` Re: Sebastian Seemann
0 siblings, 1 reply; 11+ messages in thread
From: Grant Coady @ 2008-10-05 5:53 UTC (permalink / raw)
To: Grant Taylor; +Cc: Mail List - Netfilter
On Sun, 05 Oct 2008 00:14:30 -0500, Grant Taylor <gtaylor@riverviewtech.net> wrote:
>On 10/4/2008 6:20 AM, Sebastian Seemann wrote:
>> What happens if an IP is not found in the geoip-database, so it has
>> no country-code at all? Is it accepted or not?
>
>I don't know for sure what the GeoIP match extension will do if the IP
>is not in the database. I would expect the match to fail. However with
>inverse logic included I'd guess that the failure would turn in to a
>success. But with out testing, this is only a guess.
>
>> I would suppose it is accepted and, since I wanna be sure, would be
>> thankful for a workaround simpler than adding every country in the
>> world but the forbidden one.
>
>I would be tempted to re-write your rule like this
>
> iptables -A INPUT ! -m geoip --src-cc [country] -j ACCEPT
>
>The difference being that you are moving the negative logic out of an
>unpredictable failure situation (GeoIP not knowing where the IP is from)
>to a controlled situation (IPTables inverting the result of a match
>extension).
>
>Further, the GeoIP match extension should only return a successful match
>/if/ the source IP is in said source country. Rather GeoIP will not
>match if the IP is included in the database but not associated with said
>country. Likewise GeoIP should not success on an unknown IP because it
>could not make a match.
Looking at the source, geoip is very careful to make sure the IP is
within a particular IP block to return match, so it should
return no match for missing IP. The maxmind database is sparse, as
not all IPs appear within it.
>
>With GeoIP behaving more predictably you can have IPTables test for
>GeoIP *NOT* matching.
Sounds good.
Grant.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Re:
2008-10-05 5:53 ` Re: Grant Coady
@ 2008-10-05 8:45 ` Sebastian Seemann
2008-10-07 9:26 ` Re: Sebastian Seemann
0 siblings, 1 reply; 11+ messages in thread
From: Sebastian Seemann @ 2008-10-05 8:45 UTC (permalink / raw)
To: netfilter
> On Sun, 05 Oct 2008 00:14:30 -0500, Grant Taylor
> <gtaylor@riverviewtech.net> wrote:
>
> >I don't know for sure what the GeoIP match extension will do if the IP
> >is not in the database. I would expect the match to fail. However with
> >inverse logic included I'd guess that the failure would turn in to a
> >success. But with out testing, this is only a guess.
> >
> >I would be tempted to re-write your rule like this
> >
> > iptables -A INPUT ! -m geoip --src-cc [country] -j ACCEPT
> >The difference being that you are moving the negative logic out of an
> >unpredictable failure situation (GeoIP not knowing where the IP is from)
> >to a controlled situation (IPTables inverting the result of a match
> >extension).
Ah, I see. So simple but so great. Thank you.
> >Further, the GeoIP match extension should only return a successful match
> >/if/ the source IP is in said source country. Rather GeoIP will not
> >match if the IP is included in the database but not associated with said
> >country. Likewise GeoIP should not success on an unknown IP because it
> >could not make a match.
Good to know. That is exactly what I was wondering about.
> Looking at the source, geoip is very careful to make sure the IP is
> within a particular IP block to return match, so it should
> return no match for missing IP. The maxmind database is sparse, as
> not all IPs appear within it.
Maxmind write on their homepage the free database, while containing subnets, is right in 99.3 % of the cases, excluding AOL-users, which always are reported as US. I think this, if it is true, is sufficient for me, as long as unknown users are avoided.
Thanks guys.
Regards,
Sebastian
--
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Re:
2008-10-05 8:45 ` Re: Sebastian Seemann
@ 2008-10-07 9:26 ` Sebastian Seemann
0 siblings, 0 replies; 11+ messages in thread
From: Sebastian Seemann @ 2008-10-07 9:26 UTC (permalink / raw)
To: netfilter
-------- Original-Nachricht -------- > Datum: Sun, 05 Oct 2008 10:45:18 +0200 > Von: "Sebastian Seemann" <MisterSeaman@gmx.de> > An: netfilter@vger.kernel.org > Betreff: Re: Re: > > On Sun, 05 Oct 2008 00:14:30 -0500, Grant Taylor
> > >I would be tempted to re-write your rule like this
> > >
> > > iptables -A INPUT ! -m geoip --src-cc [country] -j ACCEPT
>
> > >The difference being that you are moving the negative logic out of an
> > >unpredictable failure situation (GeoIP not knowing where the IP is
> from)
> > >to a controlled situation (IPTables inverting the result of a match
> > >extension).
> Ah, I see. So simple but so great. Thank you.
In fact, sadly this doesn't seem to work in general. iptables reports
"unexpected ! flag before match". This was with iptables 1.4.0. Any
other ideas?
Regards,
Sebastian
--
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
--
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/wasistshortview.php?mc=sv_ext_mf@gmx
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE:
@ 2015-10-24 5:02 JO Bower
0 siblings, 0 replies; 11+ messages in thread
From: JO Bower @ 2015-10-24 5:02 UTC (permalink / raw)
To: Recipients
Your email address has brought you an unexpected luck, which was selected in The Euro Millions Lottery and subsequently won you the sum of €1,000,000.00 Euros. Contact Monica Torres Email: monicatorresesp@gmail.com to claim your prize.
^ permalink raw reply [flat|nested] 11+ messages in thread
* How to make bi-directional NAT'ting?
@ 2011-08-23 8:26 "Яцко Эллад Геннадьевич (ngs)"
2011-08-23 10:50 ` Tyler J. Wagner
0 siblings, 1 reply; 11+ messages in thread
From: "Яцко Эллад Геннадьевич (ngs)" @ 2011-08-23 8:26 UTC (permalink / raw)
To: netfilter
Hello!
I have some specific problem with Cisco CP7961G IP phone.
It sends packets to external Softswitch using one UDP port
which differs from 5060 (voipControlPort in its .XML), but
it waits answers on 5060!
And I can't do anything with it! I have tried Firmware from
8.0.x up to 8.5.x - all the same!
One thing I think is make corresponding translation on IPTables.
SNAT in direct path (from 79161 to Softswitch) and DNAT
in backward direction (from outside Softswitch to 7961).
BUT IT DOESN'T WORK! :-)
$IPTABLES -t nat -A PREROUTING -p udp -s 80.251.x.x
-d 80.251.y.y --dport 5060 -j DNAT
--to-destination 172.16.128.200:5060
$IPTABLES -t nat -A POSTROUTING -o eth0 -p udp -s 172.16.128.0/24
--sport 1024:65535 -d 80.251.x.x --dport 5060 -j SNAT --to-source
80.251.y.y:5060
What do I do wrong?
Kind regards,
Ellad Yatsko
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: How to make bi-directional NAT'ting?
2011-08-23 8:26 How to make bi-directional NAT'ting? "Яцко Эллад Геннадьевич (ngs)"
@ 2011-08-23 10:50 ` Tyler J. Wagner
[not found] ` <4E538A10.3030508@runoguy.ru>
0 siblings, 1 reply; 11+ messages in thread
From: Tyler J. Wagner @ 2011-08-23 10:50 UTC (permalink / raw)
To: "Яцко Эллад Геннадьевич (ngs)"
Cc: netfilter
On 2011-08-23 09:26, "яцко Ёллад √еннадьевич (ngs)" wrote:
> Hello!
>
> I have some specific problem with Cisco CP7961G IP phone.
> It sends packets to external Softswitch using one UDP port
> which differs from 5060 (voipControlPort in its .XML), but
> it waits answers on 5060!
> And I can't do anything with it! I have tried Firmware from
> 8.0.x up to 8.5.x - all the same!
>
> One thing I think is make corresponding translation on IPTables.
> SNAT in direct path (from 79161 to Softswitch) and DNAT
> in backward direction (from outside Softswitch to 7961).
>
> BUT IT DOESN'T WORK! :-)
>
> $IPTABLES -t nat -A PREROUTING -p udp -s 80.251.x.x
> -d 80.251.y.y --dport 5060 -j DNAT --to-destination
> 172.16.128.200:5060
> $IPTABLES -t nat -A POSTROUTING -o eth0 -p udp -s 172.16.128.0/24 --sport
> 1024:65535 -d 80.251.x.x --dport 5060 -j SNAT --to-source 80.251.y.y:5060
SIP is difficult to correct with NAT. It includes connection data at layer
7. So the Softswitch may be ignoring packet headers and replying to that.
I don't think NAT is your solution here. Something else is wrong in the SIP
setup of this device.
Regards,
Tyler
--
"[...] the effectiveness of pat-downs does not matter very much, because
the obvious goal of the TSA is to make the pat-down embarrassing enough
for the average passenger that the vast majority of people will choose
high-tech humiliation over the low-tech ball check."
-- Jeffrey Goldberg, "For the First Time, the TSA Meets Resistance"
The Atlantic, 2010-10-29
^ permalink raw reply [flat|nested] 11+ messages in thread
* (unknown)
@ 2008-03-07 8:06 Alberto Díez
2008-03-07 9:43 ` Rob Sterenborg
0 siblings, 1 reply; 11+ messages in thread
From: Alberto Díez @ 2008-03-07 8:06 UTC (permalink / raw)
To: netfilter
hi!
I am trying to make use of a large number of rules
with iptables.
I have seen there are some optimizations referenced
like nf-HiPAC (www.hipac.org) , iptables with
classifiers (www.geocities.com/hamidreza_jm) which
appearently can deal with thousands of rules (thats
what i need).
I want per flow (orig addr,dst addr, orig port, dst
port, proto) filtering thats why i don´t think i can
use ipsets (or can i?)
I also would like to have the nice iptables features
like mangle table and counters ..
I dont really understand what the conntrack does, or
if it can somehow helpme (where is the nice
documentation about this??)
What is the netfilter preferred way to have a large
set of rules and still do packet filtering? are
HiPAC, iptables with classifiers or any other
solution
actual?
is there a howto,manual,some kind of
documentation, all that I find about this are quite
old (3 years?) material in the mailing list ... Is
this problem already solved? what was the solution
taken?
well if you could answer any of this questions i
would
be very thankful
Alberto Diez
______________________________________________
Enviado desde Correo Yahoo!
Disfruta de una bandeja de entrada más inteligente. http://es.docs.yahoo.com/mail/overview/index.html
^ permalink raw reply [flat|nested] 11+ messages in thread* (unknown),
@ 2008-01-03 21:57 Joe Ruddy
2008-01-03 22:22 ` Martijn Lievaart
0 siblings, 1 reply; 11+ messages in thread
From: Joe Ruddy @ 2008-01-03 21:57 UTC (permalink / raw)
To: netfilter
Hello,
We are moving to a Co-Location center and will need to forward all traffic
for all our IP to our new IP addresses.
As an example our block is 12.24.15.0/24
Our new block will be 54.64.18.0/24
If we have a webserver at 12.24.15.24 I would like all requests to
12.24.15.24 to be forwarded to 54.64.18.24 where the new machine will be
located.
If we have a mailserver at 12.24.15.19 I would like all requests to
12.24.15.19 to be forwarded to 54.64.18.19 where the new machine will be
located.
I add one rule ..."iptables -t nat -A PREROUTING -d 12.24.15.24 -j DNAT --to
54.64.18.24"
If I try to ssh or go to the website hosted there I get nothing. I can see
that the requests arrive at 54.64.18.24 by looking at the logs.
Any ideas?
Thanks
Joe
Joe Ruddy
Director of Technology
Novapointe LLC
909-930-3062 x2738
jruddy@novapointe.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re:
2008-01-03 21:57 (unknown), Joe Ruddy
@ 2008-01-03 22:22 ` Martijn Lievaart
0 siblings, 0 replies; 11+ messages in thread
From: Martijn Lievaart @ 2008-01-03 22:22 UTC (permalink / raw)
To: Joe Ruddy; +Cc: netfilter
Joe Ruddy wrote:
> Hello,
>
> We are moving to a Co-Location center and will need to forward all traffic
> for all our IP to our new IP addresses.
>
> As an example our block is 12.24.15.0/24
>
> Our new block will be 54.64.18.0/24
>
> If we have a webserver at 12.24.15.24 I would like all requests to
> 12.24.15.24 to be forwarded to 54.64.18.24 where the new machine will be
> located.
> If we have a mailserver at 12.24.15.19 I would like all requests to
> 12.24.15.19 to be forwarded to 54.64.18.19 where the new machine will be
> located.
>
> I add one rule ..."iptables -t nat -A PREROUTING -d 12.24.15.24 -j DNAT --to
> 54.64.18.24"
>
> If I try to ssh or go to the website hosted there I get nothing. I can see
> that the requests arrive at 54.64.18.24 by looking at the logs.
>
>
It does not work because the return traffic is not seen by the old
firewall so it's not properly de-dnatted. Nat only works if the firewall
sees all the traffic, not only one side of it.
Here's one way to get around it.
- Set up a tunnel between the firewall at the old location and the
firewall at the new location.
- Give the colo a second subnet on the same physical network, say
192.168.15.0/24
- On the old firewall:
- add a route for 192.168.15.0/24 into the tunnel
- Dnat all requests on the old firewall for 12.24.15.x to 192.168.15.x
- On the new firewall:
- Use source routing to route all trafic FROM 192.168.15.0/24 into the
tunnel.
A simpler way would be to use rinetd to reroute all requests to the new
servers, but this looses the original source address. If you don't mind
your logs becomming virtually useless, this is much simpler.
A final trick would be to use something that can do stateless nat out to
the same interface that the packet was received on. I don't know of any
device that can do this, but I don't know very much about this. Then you
use stateless nat on the old and the new location, on the old location
you dnat to the final destination and on the new location you snat the
return trafic back to the original destination. This does depend on your
new provider not doing any filtering.
May I use this to advocate the use of DNS? When moving over, you set the
TTLs to 0 some time beforehand. When you move over, you update the DNS
records and the transition is instant. Don't forget to reset the TTL to
some sane value after you have convinced yourself everything works.
If all of the above is Chinese to you, I suggest you forget the whole
idea and deal with the problem differently, mainly by telling all
clients the new IP.
HTH,
M4
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2015-10-24 5:02 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <S1752389AbYJDKwq/20081004105246Z+121@vger.kernel.org>
2008-10-04 11:20 ` (unknown) Sebastian Seemann
2008-10-05 5:14 ` Grant Taylor
2008-10-05 5:53 ` Re: Grant Coady
2008-10-05 8:45 ` Re: Sebastian Seemann
2008-10-07 9:26 ` Re: Sebastian Seemann
2015-10-24 5:02 JO Bower
-- strict thread matches above, loose matches on Subject: below --
2011-08-23 8:26 How to make bi-directional NAT'ting? "Яцко Эллад Геннадьевич (ngs)"
2011-08-23 10:50 ` Tyler J. Wagner
[not found] ` <4E538A10.3030508@runoguy.ru>
2011-08-23 11:35 ` Tyler J. Wagner
2011-08-24 7:35 ` Re: Jan Engelhardt
2011-08-24 8:19 ` Re: Tyler J. Wagner
2008-03-07 8:06 (unknown) Alberto Díez
2008-03-07 9:43 ` Rob Sterenborg
2008-01-03 21:57 (unknown), Joe Ruddy
2008-01-03 22:22 ` Martijn Lievaart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox