From: | "NTPT" <ntpt(at)centrum(dot)cz> |
---|---|
To: | "Pgsql-General" <pgsql-general(at)postgresql(dot)org> |
Subject: | IP adrss and networks in Postgresql |
Date: | 2004-02-10 09:47:49 |
Message-ID: | 001801c3efba$f23019e0$d300a8c0@webpropag.cz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I need to do some "IP address based guessing" what should happen inside my application.Ie if given ip adress is from network 'foo' do something, if given IP adrss is from network 'bar', do something else.
So I need to set up table with network definitions like this :
create table network_rules (network inet, rules text )
let's assume that I fill it with the definition of network or hosts.For example like this
10.0.0.1/24
192.168.0.1/24
192.168.0.128/25
192.168.0.200/32 (single host)
Now i have given *some* ip adress and I need to create a SELECT that return all networks with given ip adress belongs to , ordered by netmask, most accurate (ie more bits in netmask set ) first.
Is it possible with postgres and inet datatype ? I have no idea how to do that. Please help.
From | Date | Subject | |
---|---|---|---|
Next Message | Claudio Cicali | 2004-02-10 09:59:24 | Re: I want to use postresql for this app, but... |
Previous Message | Jean-Michel POURE | 2004-02-10 09:36:37 | Re: I want to use postresql for this app, but... |