# IPv4 /IPv6 preferred of local resolver and modify



## epopen (Mar 24, 2020)

Hi All.

I built some jail() in my system, and connect each other / from base system.
So I added pair of IP address - hostname into /etc/hosts as below

```
...
fd00::ffff:10.0.0.3   ssh.example.com
10.0.0.3              ftp.example.com
...
```

Tried by `ftp ftp.example.com` and got result as below.

```
Trying 10.0.0.3:21 ...
Connected to ftp.example.com.
```

IPv6 connection only if IPv4 address invalid (10.9.9.9 instead) as below.

```
Trying 10.9.9.9:21 ...
ftp: Can't connect to `10.9.9.9:21': Permission denied
Trying fd00::ffff:a00:203:21 ...
```

Resolver always use IPv4 address, even line swap in  /etc/hosts.
Can I modify to preferred IPv6 address?

Note :

Ports (MySQL client) same behavior.
ip6addrctl() had been configure /etc/rc.conf.d/ip6addrctl as below

```
ip6addrctl_enable="YES"
ipv6_activate_all_interfaces="YES"              # The configuration let "ipv6_prefer"
```

Thanks all very much


----------

