![OpenVPN: dhclient 실패](https://rvso.com/image/1539566/OpenVPN%3A%20dhclient%20%EC%8B%A4%ED%8C%A8.png)
openvpn 클라이언트를 시작한 다음 실행하여 dhclient tap0
IP 주소를 얻으면 모든 것이 잘 작동합니다.
스크립트( up
옵션)에서 openvpn이 동일한 명령을 호출하는 경우:
#!/bin/sh
/sbin/dhclient tap0 || exit 1
exit 0
실패합니다:
dhclient[30524]: Sending on LPF/tap0/aa:aa:aa:12:23:e9
dhclient[30524]: Can't bind to dhcp address: Permission denied
dhclient[30524]: Please make sure there is no other dhcp server
dhclient[30524]: running and that there's no entry for dhcp or
dhclient[30524]: bootp in /etc/inetd.conf. Also make sure you
dhclient[30524]: are not running HP JetAdmin software, which
openvpn[30517]: WARNING: Failed running command (--up/--down): external program exited with error status: 1
openvpn[30517]: Exiting due to fatal error
dhclient[30524]: includes a bootp server.
dhclient[30524]:
dhclient[30524]: If you think you have received this message due to a bug rather
dhclient[30524]: than a configuration issue please read the section on submitting
dhclient[30524]: bugs on either our web page at www.isc.org or in the README file
dhclient[30524]: before submitting a bug. These pages explain the proper
dhclient[30524]: process and the information we find helpful for debugging..
dhclient[30524]:
dhclient[30524]: exiting.
systemd[1]: openvpn-client.service: Main process exited, code=exited, status=1/FAILURE
모든 것이 루트로 실행되므로 권한 문제가 있어서는 안 됩니다.
답변1
스크립트에 "sudo"를 입력하고 openvpn이 실행되는 사용자에 대한 비밀번호 없이 sudoers에서 dhclient를 허용하십시오.
또한 conf에 'script-security 2'를 지정했습니까?
--script-security level [method]
This directive offers policy-level control over OpenVPN’s usage
of external programs and scripts. Lower level values are more
restrictive, higher values are more permissive. Settings for
level:
0 -- Strictly no calling of external programs.
1 -- (Default) Only call built-in executables such as ifconfig,
ip, route, or netsh.
2 -- Allow calling of built-in executables and user-defined
scripts.
3 -- Allow passwords to be passed to scripts via environmental
variables (potentially unsafe).`