LINUX.ORG.RU
решено ФорумAdmin

Cannot assign requested address.

 , ,


0

2

После ребута openvpn юнит не стартует.
Не может прицепиться к ipv6 адресу, хотя вручную после загрузки системы запускается без проблем.
Я так понимаю, юнит ovpn-а запускается до того, как на интерфейсе появятся ipv6 адреса.
Можно ли как-то это исправить? Всякие After, Before, Requires, с привязкой к network.target, network-online.target, network.service не помогли.

root@nixos_root_server> systemctl status openvpn.service                                                                                                                                                                                                                       ~
● openvpn.service - OpenVPN tunnel
   Loaded: loaded (/nix/store/prpmdsyics288fbmhh6l616dgm485953-unit-openvpn.service/openvpn.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2017-12-30 17:07:07 UTC; 1min 36s ago
     Docs: man:openvpn(8)
           https://community.openvpn.net/openvpn/wiki/Openvpn24ManPage
           https://community.openvpn.net/openvpn/wiki/HOWTO
  Process: 702 ExecStart=/nix/store/zyp85cz95k93zr27sw463qav6spmls6i-openvpn-2.4.4/bin/openvpn --config /nix/store/cs43jgww8lrzn74465ddkxznjc23qxqv-openvpn_server.conf (code=exited, status=1/FAILURE)
 Main PID: 702 (code=exited, status=1/FAILURE)
   Status: "Pre-connection initialization successful"

Dec 30 17:07:07 nixos_root_server systemd[1]: Starting OpenVPN tunnel...
Dec 30 17:07:07 nixos_root_server openvpn[702]: Sat Dec 30 17:07:07 2017 do_ifconfig, tt->did_ifconfig_ipv6_setup=1
Dec 30 17:07:07 nixos_root_server openvpn[702]: Sat Dec 30 17:07:07 2017 TCP/UDP: Socket bind failed on local address [AF_INET6]2a01:4f8:xx:xx::xx:1194: Cannot assign requested address (errno=99)
Dec 30 17:07:07 nixos_root_server systemd[1]: Started OpenVPN tunnel.
Dec 30 17:07:07 nixos_root_server systemd[1]: openvpn.service: Main process exited, code=exited, status=1/FAILURE
Dec 30 17:07:07 nixos_root_server systemd[1]: openvpn.service: Unit entered failed state.
Dec 30 17:07:07 nixos_root_server systemd[1]: openvpn.service: Failed with result 'exit-code'.

Часть выхлопа journalctl --system

Dec 30 17:20:12 nixos_root_server systemd[1]: Starting Network...
Dec 30 17:20:12 nixos_root_server systemd[1]: Reached target Network is Online.
Dec 30 17:20:12 nixos_root_server systemd[1]: Started Permit User Sessions.
Dec 30 17:20:12 nixos_root_server systemd[1]: Started Getty on tty1.
Dec 30 17:20:12 nixos_root_server systemd[1]: Reached target Login Prompts.
Dec 30 17:20:12 nixos_root_server systemd[1]: Started Name Service Cache Daemon.
Dec 30 17:20:13 nixos_root_server kernel: IPv6: ADDRCONF(NETDEV_UP): eno1: link is not ready
Dec 30 17:20:13 nixos_root_server systemd[1]: Started Network.
Dec 30 17:20:13 nixos_root_server systemd[1]: Starting WireGuard Server...
Dec 30 17:20:13 nixos_root_server systemd[1]: Starting OpenVPN tunnel...
Dec 30 17:20:13 nixos_root_server kernel: wireguard: loading out-of-tree module taints kernel.
Dec 30 17:20:13 nixos_root_server kernel: wireguard: WireGuard 0.0.20171101 loaded. See www.wireguard.com for information.
Dec 30 17:20:13 nixos_root_server kernel: wireguard: Copyright (C) 2015-2017 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
Dec 30 17:20:13 nixos_root_server systemd[1]: Started OpenVPN tunnel.
Dec 30 17:20:13 nixos_root_server openvpn[839]: Sat Dec 30 17:20:13 2017 do_ifconfig, tt->did_ifconfig_ipv6_setup=1
Dec 30 17:20:13 nixos_root_server openvpn[839]: Sat Dec 30 17:20:13 2017 TCP/UDP: Socket bind failed on local address [AF_INET6]2a01:4f8:xx:xx::xx:1194: Cannot assign requested address (errno=99)
Dec 30 17:20:13 nixos_root_server systemd[1]: Started WireGuard Server.
Dec 30 17:20:13 nixos_root_server systemd[1]: Reached target Multi-User System.
Dec 30 17:20:13 nixos_root_server systemd[1]: Startup finished in 1.529s (kernel) + 1.557s (userspace) = 19.659s.
Dec 30 17:20:13 nixos_root_server systemd[1]: openvpn.service: Main process exited, code=exited, status=1/FAILURE
Dec 30 17:20:13 nixos_root_server systemd[1]: openvpn.service: Unit entered failed state.
Dec 30 17:20:13 nixos_root_server systemd[1]: openvpn.service: Failed with result 'exit-code'.
Dec 30 17:20:18 nixos_root_server kernel: e1000e: eno1 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx
Dec 30 17:20:18 nixos_root_server kernel: IPv6: ADDRCONF(NETDEV_CHANGE): eno1: link becomes ready
Dec 30 17:20:35 nixos_root_server sshd[872]: Accepted publickey for root from 2a01:4f8:xx:xx::10 port 57148 ssh2: XXXXXXX
Dec 30 17:20:35 nixos_root_server sshd[872]: pam_unix(sshd:session): session opened for user root by (uid=0)
Dec 30 17:20:35 nixos_root_server systemd[1]: Created slice User Slice of root.
Dec 30 17:20:35 nixos_root_server systemd[1]: Starting User Manager for UID 0...
Dec 30 17:20:35 nixos_root_server systemd-logind[731]: New session 1 of user root.
Dec 30 17:20:35 nixos_root_server systemd[874]: pam_unix(systemd-user:session): session opened for user root by (uid=0)
Dec 30 17:20:35 nixos_root_server systemd[1]: Started Session 1 of user root.
Dec 30 17:20:35 nixos_root_server systemd[874]: Reached target Sockets.
Dec 30 17:20:35 nixos_root_server systemd[874]: Reached target Timers.
Dec 30 17:20:35 nixos_root_server systemd[874]: Reached target Paths.
Dec 30 17:20:35 nixos_root_server systemd[874]: Reached target Basic System.
Dec 30 17:20:35 nixos_root_server systemd[874]: Reached target Default.
Dec 30 17:20:35 nixos_root_server systemd[874]: Startup finished in 11ms.
Dec 30 17:20:35 nixos_root_server systemd[1]: Started User Manager for UID 0.
Dec 30 17:20:42 nixos_root_server systemd[1]: Started dnscrypt-proxy daemon.

OpenVPN Unit

root@nixos_root_server> systemctl cat openvpn.service                                                                                                                                                                                                                          ~
# /nix/store/gln77p06ww8brsl3rap9j14q8w83bd0w-unit-openvpn.service/openvpn.service
[Unit]
After=network.service
Description=OpenVPN tunnel
Documentation=man:openvpn(8) https://community.openvpn.net/openvpn/wiki/Openvpn24ManPage https://community.openvpn.net/openvpn/wiki/HOWTO

[Service]
Environment="LOCALE_ARCHIVE=/nix/store/xhmzzbq06fbzhvjamnb1192iwqb4wl0i-glibc-locales-2.25-49/lib/locale/locale-archive"
Environment="PATH=/nix/store/r90xqqmd36fv3s53bf92s3vxhdnbwfn7-coreutils-8.28/bin:/nix/store/02xjvflg03d9wlzdw1ig54rgwa32jwxq-findutils-4.6.0/bin:/nix/store/wia9b594w2ghzhpcjdi9mnlf8j24nm3i-gnugrep-3.1/bin:/nix/store/j4rqdjgf0im2dv7gycg80hplnjrnawxx-gnused-4.4/bin:/nix/stor
Environment="TZDIR=/nix/store/1sa5cpnrbdab2463bzbi3xfl3hck3aqk-tzdata-2017c/share/zoneinfo"

DeviceAllow=/dev/null rw
DeviceAllow=/dev/net/tun rw
ExecStart=/nix/store/zyp85cz95k93zr27sw463qav6spmls6i-openvpn-2.4.4/bin/openvpn --config /nix/store/cs43jgww8lrzn74465ddkxznjc23qxqv-openvpn_server.conf
Type=notify

Network.service

root@nixos_root_server> systemctl cat network.service                                                                                                                                                                                                                          ~
# /nix/store/7rvawbh376csb39fd3mzjmx5dppriif5-unit-network.service/network.service
[Unit]
After=network.target
Description=Network

[Service]
Environment="LOCALE_ARCHIVE=/nix/store/xhmzzbq06fbzhvjamnb1192iwqb4wl0i-glibc-locales-2.25-49/lib/locale/locale-archive"
Environment="PATH=/nix/store/r90xqqmd36fv3s53bf92s3vxhdnbwfn7-coreutils-8.28/bin:/nix/store/02xjvflg03d9wlzdw1ig54rgwa32jwxq-findutils-4.6.0/bin:/nix/store/wia9b594w2ghzhpcjdi9mnlf8j24nm3i-gnugrep-3.1/bin:/nix/store/j4rqdjgf0im2dv7gycg80hplnjrnawxx-gnused-4.4/bin:/nix/stor
Environment="TZDIR=/nix/store/1sa5cpnrbdab2463bzbi3xfl3hck3aqk-tzdata-2017c/share/zoneinfo"



ExecStart=/nix/store/0yw15iqi9gbay355fswn4nsdkaxg56v8-iproute2-4.13.0/bin/ip link set eno1 down
ExecStart=/nix/store/0yw15iqi9gbay355fswn4nsdkaxg56v8-iproute2-4.13.0/bin/ip -4 address add 85.xx.xx.2/27 broadcast 85.xx.xx.31 dev eno1
ExecStart=/nix/store/0yw15iqi9gbay355fswn4nsdkaxg56v8-iproute2-4.13.0/bin/ip -6 address add 2a01:4f8:xx:xx::2/64 dev eno1
ExecStart=/nix/store/0yw15iqi9gbay355fswn4nsdkaxg56v8-iproute2-4.13.0/bin/ip -6 address add 2a01:4f8:xx:xx::50/128 dev eno1
ExecStart=/nix/store/0yw15iqi9gbay355fswn4nsdkaxg56v8-iproute2-4.13.0/bin/ip link set eno1 up
ExecStart=/nix/store/0yw15iqi9gbay355fswn4nsdkaxg56v8-iproute2-4.13.0/bin/ip -4 route add default via 85.xx.xx.1 dev eno1
ExecStart=/nix/store/0yw15iqi9gbay355fswn4nsdkaxg56v8-iproute2-4.13.0/bin/ip -6 route add default via fe80::1 dev eno1
ExecStop=/nix/store/0yw15iqi9gbay355fswn4nsdkaxg56v8-iproute2-4.13.0/bin/ip link set eno1 down
RemainAfterExit=true
Type=oneshot


Ответ на: комментарий от anc

Костыль, не спорю. Но что-то других вариантов тут не прозвучало...

Sorcus ()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.