CentOS7: Precisa reiniciar a interface do SoftEther VPN para ter meu IP estático

0

eu inicio meu cliente VPN (softEther) com o SystemD uma inicialização do SO e tenho problemas para atribuir um IP estático à interface local da interface de rede do cliente vpn.

Existe a minha configuração do SystemD:

    [Unit]
    Description=SoftEther VPN Client
    After=network.target auditd.service
    ConditionPathExists=!/usr/local/vpnclient/vpnclient/do_not_run

    [Service]
    Type=forking
    EnvironmentFile=-/usr/local/vpnclient/vpnclient
    ExecStart=/usr/local/vpnclient/vpnclient start
    ExecStop=/usr/local/vpnclient/vpnclient stop
    KillMode=process
    Restart=on-failure

    # Hardening
    PrivateTmp=yes
    ProtectHome=yes
    ProtectSystem=full
    ReadOnlyDirectories=/
    ReadWriteDirectories=-/usr/local/vpnclient/vpnclient
    CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SYS_NICE CAP_SYS_ADMIN CAP_SETUID

    [Install]
    WantedBy=multi-user.target

Quando inicio o serviço, a interface local aparece, mas sem o IP estático que eu configuro.

    vpn_softether: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
    inet6 fe80::2ac:e9ff:fe7e:289e prefixlen 64 scopeid 0x20<link>
    ether 00:ac:e9:7e:28:9e txqueuelen 1000 (Ethernet)
    RX packets 12 bytes 864 (864.0 B)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 20 bytes 1632 (1.5 KiB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Existe o meu / etc / sysconfig / scripts de rede / ifcfg-vpn_softether:

DEVICE="vpn_softether"
HWADDR="00:ac:e9:7e:28:9e"
ONBOOT="yes"
BOOTPROTO=static
NM_CONTROLLED="no"
IPADDR="10.38.0.50"
NETMASK="255.255.255.0"

Eu preciso executar um:

    ifdown vpn_softether && ifup vpn_softether

para poder ter meu IP estático na interface:

    vpn_softether: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
    inet 10.38.0.50 netmask 255.255.255.0 broadcast 10.38.0.255
    inet6 fe80::2ac:e9ff:fe7e:289e prefixlen 64 scopeid 0x20<link>
    ether 00:ac:e9:7e:28:9e txqueuelen 1000 (Ethernet)
    RX packets 33 bytes 2506 (2.4 KiB)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 69 bytes 12308 (12.0 KiB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Eu apreciarei algumas dicas:)

    
por piellick 17.11.2017 / 11:56

2 respostas

0

Adicionar:

/usr/local/vpnclient/vpnclient start
ifdown vpn_softether && ifup vpn_softethe

para um script e, em seguida, faça referência a esse script criado na linha ExecStart no seu arquivo de serviço systemd

    
por 17.11.2017 / 13:37
0

Obrigado Raman!

Poderia ajudar alguém, há os truques.

Serviço de systemD modificado:

    [Unit]
    Description=SoftEther VPN Client
    After=network.target auditd.service
    ConditionPathExists=!/usr/local/vpnclient/vpnclient/do_not_run

    [Service]
    Type=forking
    EnvironmentFile=-/usr/local/vpnclient/vpnclient
    ExecStart=/usr/local/vpnclient/restart_vpn_eth.sh
    ExecStop=/usr/local/vpnclient/vpnclient stop
    KillMode=process
    Restart=on-failure

    # Hardening
    PrivateTmp=yes
    ProtectHome=yes
    ProtectSystem=full
    ReadOnlyDirectories=/
    ReadWriteDirectories=-/usr/local/vpnclient/vpnclient
    CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SYS_NICE CAP_SYS_ADMIN CAP_SETUID

    [Install]
    WantedBy=multi-user.target

e o script:

    #!/bin/sh

    /usr/local/vpnclient/vpnclient start
    sleep 5
    ifdown vpn_cent
    sleep 5
    ifup vpn_cent
    
por 17.11.2017 / 13:39