Auf Jail Host nfsd starten

arcona

Well-Known Member
Hallo,
in der jail manpage steht, das der Host kein NFS-Server sein darf, weil er nicht an eine bestimmte ip gebunden werden darf. Diese Dienste müssten neu kompiliert werden, insbesondere nfsd:
In addition, a number of services must be recompiled in order to run them
in the host environment. This includes most applications providing ser-
vices using rpc(3), such as rpcbind(8), nfsd(8), and mountd(8). In gen-
eral, applications for which it is not possible to specify which IP
address to bind should not be run in the host environment unless they
should also service requests sent to jail IP addresses. Attempting to
serve NFS from the host environment may also cause confusion, and cannot
be easily reconfigured to use only specific IPs, as some NFS services are
hosted directly from the kernel. Any third-party network software run-
ning in the host environment should also be checked and configured so
that it does not bind all IP addresses, which would result in those ser-
vices' also appearing to be offered by the jail environments.
Allerdings sagt die man nfsd
-h bindip
Specifies which IP address or hostname to bind to on the local
host. This option is recommended when a host has multiple inter-
faces. Multiple -h options may be specified.
man rpcbind:
-h bindip
Specify specific IP addresses to bind to for TCP and UDP
requests. This option may be specified multiple times and is
typically necessary when running on a multi-homed host. If no -h
option is specified, rpcbind will bind to INADDR_ANY, which could
lead to problems on a multi-homed host due to rpcbind returning a
UDP packet from a different IP address than it was sent to. Note
that when specifying IP addresses with -h, rpcbind will automati-
cally add 127.0.0.1 and if IPv6 is enabled, ::1 to the list.
mountd:
-h bindip
Specify specific IP addresses to bind to for TCP and UDP
requests. This option may be specified multiple times. If no -h
option is specified, mountd will bind to INADDR_ANY. Note that
when specifying IP addresses with -h, mountd will automatically
add 127.0.0.1 and if IPv6 is enabled, ::1 to the list.
Was stimmt denn nun?
Habe ich einen Dienst übersehen?
Betreibt Ihr einen NFS-Server auf einem Jail-Host?

Grüße.
arcona
 
Hat denn hier noch niemand versucht einen NFS-Server auf einem Jail-Host zu betreiben? Ist es wirklich nicht möglich die ZFS-Dienste an eine IP zu binden?

Leider ist es ja auch keine Alternative einen nfsd in einer Jail zu starten, da fühlt er sich nicht wirklich wohl.

Grüße.
arcona
 
Hi,


also ich verwende dafür den UNFSD. (Userspace NFS Daemon) in den Jails
Läuft richtig gut.

Aber für NFS, wirst Du erstmal VIMAGE Kernel bauen müssen und der Jail einen Stack geben müssen.
Dann sollte der NFS auch in einer Jail Rocken. (Noch nicht getestet)
 
UNFSD kannte ich noch gar nicht. Danke, das werde ich mir mal anschauen.

Ich habe bereits einen VIMAGE Kernel gebaut und einige Jails zum Testen mit dem neuen virtuellen Netzwerk Stack eingerichtet. Da kann ich natürlich einen NFSD innerhalb starten. Das wäre vielleicht ein kleiner Workaround.

Ich würde aber trotzdem gerne einen NFS Server auf dem Host laufen lassen. Schade, dass man nfsd, mountd und die anderen Verdächtigen nicht wirklich sauber an nur eine IP binden kann.

Mich wundert ein wenig, dass ein nfsd auf einem Jail-Host ein so seltener Anwendungswunsch ist und dass sich nicht mehr User ein solches Setup wünschen würden.

Grüße.
arcona
 
Moin,

wenn ich jetzt mal ZFS aussen vor lasse: Ich habe einen Rechner, auf dem 6 Jails laufen. Zusätzlich läuft auf dem Host selbst NFS. Damit habe ich noch nie Probleme gehabt. Allerdings mounte ich von den Jails aus nichts. Alles was ich dort brauche habe ich per nullfs-mount in die Jail gemountet.

HTH
 
unfsd in einer Jail betreiben:

cd /usr/ports/net/unfs3 && make install clean

/etc/rc.conf
Code:
unfsd_enable="YES"
unfsd_flags="-l ${JAILIP}"
unfsd_exports="/etc/exports"

/usr/local/etc/rc.d/unfsd
Code:
# PROVIDE: unfsd
# REQUIRE: rpcbind

. /etc/rc.subr

name="unfsd"
rcvar=`set_rcvar`
command="/usr/local/sbin/${name}"

load_rc_config $name
command_args="${unfsd_flags}"
exports="${unfsd_exports}"
pidfile=/var/run/${name}.pid
start_precmd="unfsd_precmd"
stop_cmd="unfsd_stop_cmd"
start_cmd="unfsd_start_cmd"
sig_stop="USR1"

unfsd_precmd()
{
    if ! checkyesno rpcbind_enable  && \
        ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
    then
        force_depend rpcbind || return 1
    fi

    return 0
}

unfsd_start_cmd()
{
    $command -e $exports -i $pidfile $command_args
}

unfsd_stop_cmd()
{
    if [ -f "$pidfile" ] ; then
        kill `cat ${pidfile}`
    fi
}

run_rc_command "$1"
 
Zuletzt bearbeitet:
Zurück
Oben