
Tenemos una máquina virtual ESXi que ejecuta Debian 10 y tenemos un problema con el inicio demasiado pronto de Postfix. Esto está causando problemas con resolv.conf que no se completa antes del chroot postfix. Me he asegurado de que ambos
- /lib/systemd/system/postfix.servicio
- /lib/systemd/sistema/[correo electrónico protegido]
Los archivos tienen la línea.
After=network-online.target nss-lookup.target
Sin embargo, tenemos varias NIC instaladas en esta VM, con el archivo /etc/network/interfaces que contiene
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug ens192
iface ens192 inet static
address 10.1.0.29/21
dns-nameservers 10.1.0.20 10.1.0.23
# The secondary network interface
allow-hotplug ens224
iface ens224 inet static
address 192.168.1.8/24
gateway 192.168.1.240
cuando corro
grep -E "(Postfix Mail Transport Agent|e1000|Link is Up|link is not ready|link becomes ready|resolv.conf differ|target)" /var/log/syslog
Veo que network-online.target solo espera a que una de las NIC esté en línea.
Jan 12 18:46:54 assp0 kernel: [ 1.738897] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
Jan 12 18:46:54 assp0 kernel: [ 1.738897] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
Jan 12 18:46:54 assp0 kernel: [ 1.739922] e1000e 0000:0b:00.0: Interrupt Throttling Rate (ints/sec) set to dynamic conservative mode
Jan 12 18:46:54 assp0 kernel: [ 1.795419] e1000e 0000:0b:00.0 0000:0b:00.0 (uninitialized): registered PHC clock
Jan 12 18:46:54 assp0 kernel: [ 1.859484] e1000e 0000:0b:00.0 eth0: (PCI Express:2.5GT/s:Width x1)
Jan 12 18:46:54 assp0 kernel: [ 1.859486] e1000e 0000:0b:00.0 eth0: Intel(R) PRO/1000 Network Connection
Jan 12 18:46:54 assp0 kernel: [ 1.859558] e1000e 0000:0b:00.0 eth0: MAC: 3, PHY: 8, PBA No: 000000-000
Jan 12 18:46:54 assp0 kernel: [ 1.860245] e1000e 0000:13:00.0: Interrupt Throttling Rate (ints/sec) set to dynamic conservative mode
Jan 12 18:46:54 assp0 kernel: [ 1.915403] e1000e 0000:13:00.0 0000:13:00.0 (uninitialized): registered PHC clock
Jan 12 18:46:54 assp0 kernel: [ 1.979239] e1000e 0000:13:00.0 eth1: (PCI Express:2.5GT/s:Width x1)
Jan 12 18:46:54 assp0 kernel: [ 1.979240] e1000e 0000:13:00.0 eth1: Intel(R) PRO/1000 Network Connection
Jan 12 18:46:54 assp0 kernel: [ 1.979290] e1000e 0000:13:00.0 eth1: MAC: 3, PHY: 8, PBA No: 000000-000
Jan 12 18:46:54 assp0 kernel: [ 1.981312] e1000e 0000:0b:00.0 ens192: renamed from eth0
Jan 12 18:46:54 assp0 kernel: [ 1.994070] e1000e 0000:13:00.0 ens224: renamed from eth1
Jan 12 18:46:54 assp0 kernel: [ 4.577652] IPv6: ADDRCONF(NETDEV_UP): ens224: link is not ready
Jan 12 18:46:54 assp0 kernel: [ 4.583595] e1000e: ens224 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
Jan 12 18:46:54 assp0 systemd[1]: Reached target Swap.
Jan 12 18:46:54 assp0 systemd[1]: Reached target System Initialization.
Jan 12 18:46:54 assp0 systemd[1]: Reached target Sockets.
Jan 12 18:46:54 assp0 systemd[1]: Reached target Basic System.
Jan 12 18:46:54 assp0 systemd[1]: Reached target Timers.
Jan 12 18:46:54 assp0 systemd[1]: Reached target Network.
Jan 12 18:46:54 assp0 systemd[1]: Reached target Network is Online.
Jan 12 18:46:54 assp0 systemd[1]: Starting Postfix Mail Transport Agent (instance -)...
Jan 12 18:46:54 assp0 systemd[1]: Reached target Login Prompts.
Jan 12 18:46:54 assp0 kernel: [ 4.671007] IPv6: ADDRCONF(NETDEV_UP): ens192: link is not ready
Jan 12 18:46:54 assp0 kernel: [ 4.671206] IPv6: ADDRCONF(NETDEV_CHANGE): ens224: link becomes ready
Jan 12 18:46:54 assp0 kernel: [ 4.675749] e1000e: ens192 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
Jan 12 18:46:54 assp0 kernel: [ 4.676553] IPv6: ADDRCONF(NETDEV_CHANGE): ens192: link becomes ready
Jan 12 18:46:55 assp0 postfix/postfix-script[750]: warning: /var/spool/postfix/etc/resolv.conf and /etc/resolv.conf differ
Pensé que había algo que se podía escribir en la configuración de red para indicar que se requería conexión antes de que el sistema operativo considerara que la red estaba activa, pero parece que no puedo encontrar esa información.
Antes de juntar algo que funcione lo suficiente para nosotros, me gustaría saber cómo hacer que network-online.target espere a todas las NIC, o preferiblemente a las que yo especifique.- Editar -el problema del que hablé fue agregar un retraso a la secuencia de arranque.
Editar: Encontré un enlace a lo que estaba pensando, pero está en CentOS y es elIPV4_FAILURE_FATAL=síLínea agregada a uno de los archivos ifcfg. ¿Debian tiene algo similar y cree que eso afectaría la activación de los objetivos systemd?
Editar: habilitar los servicios systemd networkd parece que podría ser útil al leer sobresystemd-networkd-wait-online.servicio. Antes de pasar a utilizar la configuración de Network Manager (networkd), ¿lo estoy leyendo correctamente y resolvería este problema?
Respuesta1
Systemd asume automáticamente que la red está en línea siempre que el objetivo (supongo que depende de network.service o NetworkManager.service en RHEL) informe que se inició. Tuvimos un problema con dnsmasq informando que se había iniciado, pero en realidad necesitaba un poco más de tiempo antes de realizar montajes NFS. Como solución alternativa, puede:
- Cree un servicio que se ejecutará después de su servicio de red y antes de su postfix.
- Establezca un retraso en su servicio de red (tal vez una estrofa PostExec)
- Cree un "retraso previo al inicio" a través de la entrada "ExecStartPre=" en su servicio Postfix
Aquí hay un ejemplo del servicio network.service en CentOS7:
# /run/systemd/generator.late/network.service
# Automatically generated by systemd-sysv-generator
[Unit]
Documentation=man:systemd-sysv-generator(8)
SourcePath=/etc/rc.d/init.d/network
Description=LSB: Bring up/down networking
Before=multi-user.target
Before=multi-user.target
Before=multi-user.target
Before=graphical.target
Before=network-online.target
Before=network.target
Before=vxpbx_exchanged.service
Para 2) puedes crear algo como esto:
#cat /etc/systemd/system/network.service.d/01-delay.conf
[Service]
ExecStartPost=/bin/sleep 5
Para 3) puedes crear algo como:
#cat /etc/systemd/system/postfix.service.d/01-delay.conf
[Service]
ExecStartPre=/bin/sleep 5
Por supuesto, esas son sólo soluciones alternativas y esto debe solucionarse mediante un error.