Thread: binding tcp connections to certain addresses

binding tcp connections to certain addresses

From
will trillich
Date:
i'm trying to get postgresql to listen on 127.0.0.1:5432,
192.168.1.1:5432 but not on xx.yy.zz.qq:5432 --

from the admin guide i see:

    VIRTUAL_HOST (string)
        Specifies the TCP/IP hostname or address on which the
        postmaster is to listen for connections from client
        applications. Defaults to listening on all configured
        addresses (including localhost).

so i've tried

    # /etc/postgresql/postgresql.conf
[snip]
    port = 5432
    virtual_host = 127.0.0.1
    virtual_host = 192.168.1.1

so then i restart the server--

    root@debian-potato# /etc/init.d/postgresql restart
    Restarting PostgreSQL postmaster.
    Stopped /usr/lib/postgresql/bin/postmaster (pid 18685 18688 18689 18692 18751 18774 18776 18777 18778).
    -su: /etc/postgresql/postmaster.init: No such file or directory
    Starting PostgreSQL postmaster.
    /usr/lib/postgresql/bin/pg_ctl start -D /var/lib/postgres/data -l /var/log/postgres.log
    postmaster successfully started

and the /var/log/postgres.log file shows

    FATAL 1:  postgresql.conf:42: syntax error, token=".0"

so i try using quotes:

    # /etc/postgresql/postgresql.conf
[snip]
    port = 5432
    virtual_host = "127.0.0.1"
    virtual_host = "192.168.1.1"

which also doesn't work -- log shows:

    FATAL 1:  postgresql.conf:41: syntax error, token="""

so how do i specify which interfaces/addresses postgres should
listen to, and which it shouldn't? (i probably mis-read the
documentation... nudges welcome.)

--
They don't remember whether or not they weren't doing anything
I didn't want them to do.
    -- Karen, on why she feeds the cats when they misbehave

will@serensoft.com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!