호스트의 기본 IP 주소에 의존하는 서비스가 있는데 해당 주소가 호스트에 구성되어 있지 않으면 서비스가 시작되지 않습니다. systemd-networkd
해당 인터페이스에 대한 링크가 작동 중단된 경우에도 정적으로 구성된 인터페이스를 작동시키고 특정 시간에 링크가 손실된 경우에도 계속 해당 상태를 유지하는 방법이 있습니까 ?
나는 for netplan
presents 를 발견했습니다 ignore-carrier: true
. 나도 똑같은 게 필요해systemd-networkd
답변1
systemd.network 매뉴얼을 읽으면서 다음 두 매개변수를 찾았습니다.
ConfigureWithoutCarrier=
Takes a boolean. Allows networkd to configure a specific link even if it has no carrier. Defaults to false. If IgnoreCarrierLoss= is not explicitly set, it will default to this value.
ActivationPolicy=
Specifies the policy for systemd-networkd managing the link administrative state. Specifically, this controls how systemd-networkd changes the network device's "IFF_UP" flag, which is sometimes controlled by system administrators by running e.g., ip
link set dev eth0 up or ip link set dev eth0 down, and can also be changed with networkctl up eth0 or networkctl down eth0.
Takes one of "up", "always-up", "manual", "always-down", "down", or "bound". When "manual", systemd-networkd will not change the link's admin state automatically; the system administrator must bring the interface up or down manually, as desired. When
"up" (the default) or "always-up", or "down" or "always-down", systemd-networkd will set the link up or down, respectively, when the interface is (re)configured. When "always-up" or "always-down", systemd-networkd will set the link up or down,
respectively, any time systemd-networkd detects a change in the administrative state. When BindCarrier= is also set, this is automatically set to "bound" and any other value is ignored.
When the policy is set to "down" or "manual", the default value of RequiredForOnline= is "no". When the policy is set to "always-down", the value of RequiredForOnline= forced to "no".
The administrative state is not the same as the carrier state, so using "always-up" does not mean the link will never lose carrier. The link carrier depends on both the administrative state as well as the network device's physical connection. However,
to avoid reconfiguration failures, when using "always-up", IgnoreCarrierLoss= is forced to true.
설정 ConfigureWithoutCarrier=true
하고 ActivationPolicy=always-up
성공했습니다