SOLVED Jail is getting wrong/odd DNS resolver settings

Killom

Dabbler
Joined
Jan 13, 2020
Messages
16
How do I set the DNS servers name/IP correctly for an jail?

I'd like to have an static-IPv4-only jail, but somehow it keeps messing up my config in this way, that there will be IPv6 addresses showing up in jails resolv.conf

Code:
# Generated by resolvconf
nameserver fd00::dead:beef
nameserver 2a02::dead:beef

*redacted

Manual editing is useless, due to resolv.conf being constantly overwritten on restarts.

Here is the config:
Code:
{
    "allow_chflags": 0,
    "allow_mlock": 0,
    "allow_mount": 1,
    "allow_mount_devfs": 1,
    "allow_mount_procfs": 1,
    "allow_mount_tmpfs": 1,
    "allow_quotas": 0,
    "allow_raw_sockets": 0,
    "allow_set_hostname": 1,
    "allow_socket_af": 0,
    "allow_sysvipc": 0,
    "allow_tun": 1,
    "allow_vmm": 0,
    "assign_localhost": 0,
    "basejail": 1,
    "boot": 0,
    "bpf": 0,
    "comment": "none",
    "defaultrouter": "192.168.16.1",
    "defaultrouter6": "none",
    "devfs_ruleset": "0",
    "dhcp": 0,
    "exec_fib": "0",
    "exec_jail_user": "root",
    "exec_poststart": "/usr/bin/true",
    "exec_poststop": "/usr/bin/true",
    "exec_prestart": "/usr/bin/true",
    "exec_prestop": "/usr/bin/true",
    "exec_start": "/bin/sh /etc/rc",
    "exec_stop": "/bin/sh /etc/rc.shutdown",
    "exec_system_user": "root",
    "host_domainname": "none",
    "host_hostname": "Test",
    "host_hostuuid": "Test",
    "host_time": 1,
    "hostid": "58a00bd3-33f1-11ea-b57e-0014fd1988e6",
    "interfaces": "vnet0:bridge0",
    "ip4": "inherit",
    "ip4_addr": "vnet0|192.168.16.3/24",
    "ip4_saddrsel": 0,
    "ip6": "disable",
    "ip6_saddrsel": 0,
    "ip_hostname": 0,
    "jail_zfs": 0,
    "jail_zfs_dataset": "iocage/jails/Test/data",
    "jail_zfs_mountpoint": "none",
    "last_started": "2023-02-22 12:06:05",
    "mac_prefix": "0214fd",
    "mount_devfs": 1,
    "mount_fdescfs": 1,
    "nat": 0,
    "nat_forwards": "none",
    "notes": "none",
    "priority": "99",
    "release": "13.1-RELEASE-p6",
    "resolver": "/etc/resolv.conf",
    "rtsold": 0,
    "securelevel": "0",
    "sysvmsg": "new",
    "sysvsem": "new",
    "sysvshm": "new",
    "template": 0,
    "vnet": 1,
    "vnet0_mac": "0214fd8f22b9 0214fd8f22ba",
    "vnet_default_interface": "auto",
    "vnet_interfaces": "none"
}
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
iocage set resolver='nameserver 1.2.3.4' <jailname>
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
The syntax is a bit peculiar, essentially it's the content of a resolv.conf file. So you can write something like
Code:
iocage set resolver='nameserver 1.2.3.4;nameserver 5.6.7.8;search my.domain.com' <jailname>


Common mistake is to use just the IP address and not the complete namserver ... phrase.
 
Top