3

For this PostgreSQL configuration example:

https://repmgr.org/docs/4.4/quickstart-authentication.html

    local   replication   repmgr                              trust
    host    replication   repmgr      127.0.0.1/32            trust
    host    replication   repmgr      192.168.1.0/24          trust

    local   repmgr        repmgr                              trust
    host    repmgr        repmgr      127.0.0.1/32            trust
    host    repmgr        repmgr      192.168.1.0/24          trust

I have two questions.

Question 1

This is how a netmask looks for IPv4: 192.168.1.0/24.

How to do with an IPv6 IP address like 230b:c010:103:5858:a6a3:3:0:1?

Question 2

If use JDBC to connect to a PostgreSQL server, I can use a connection URL containing 192.168.1.11:5432. How to do it with IPv6? Is it like 230b:c010:103:5858:a6a3:3:0:1:5432?

1 Answer 1

4

Answer 1:

Like the documentation says:

An IPv6 address range might look like ::1/128 for a single host (in this case the IPv6 loopback address) or fe80::7a31:c1ff:0000:0000/96 for a small network. 0.0.0.0/0 represents all IPv4 addresses, and ::0/0 represents all IPv6 addresses. To specify a single host, use a mask length of 32 for IPv4 or 128 for IPv6. In a network address, do not omit trailing zeroes.

Answer 2:

Like the documentation says:

  • host

The host name of the server. Defaults to localhost. To specify an IPv6 address your must enclose the host parameter with square brackets, for example:

jdbc:postgresql://[::1]:5740/accounting
1
  • Very good answer! Thank you!
    – rawmain
    Dec 18, 2019 at 8:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.