다음 수동 예제를 따라해 보았습니다 man systemd.network
.
# /etc/systemd/network/27-xfrm.netdev
[NetDev]
Name=xfrm0
Kind=xfrm
[Xfrm]
InterfaceId=7
# /etc/systemd/network/27-eth0.network
[Match]
Name=ens5
[Network]
Xfrm=xfrm0
그런 다음 systemctl daemon-reload
+ systemctl restart systemd-networkd
. 괜찮아요. systemctl status systemd-networkd
또한 다음에 대한 참조도 표시되지 않습니다 xfrm
.
Apr 16 23:52:07 ip-10-100-1-205 systemd[1]: Starting Network Configuration...
Apr 16 23:52:07 ip-10-100-1-205 systemd-networkd[960]: ens5: Link UP
Apr 16 23:52:07 ip-10-100-1-205 systemd-networkd[960]: ens5: Gained carrier
Apr 16 23:52:07 ip-10-100-1-205 systemd-networkd[960]: lo: Link UP
Apr 16 23:52:07 ip-10-100-1-205 systemd-networkd[960]: lo: Gained carrier
Apr 16 23:52:07 ip-10-100-1-205 systemd-networkd[960]: ens5: Gained IPv6LL
Apr 16 23:52:07 ip-10-100-1-205 systemd-networkd[960]: Enumeration completed
Apr 16 23:52:07 ip-10-100-1-205 systemd[1]: Started Network Configuration.
Apr 16 23:52:07 ip-10-100-1-205 systemd-networkd[960]: ens5: DHCPv4 address 10.100.1.205/24 via 10.100.1.1
systemd v249를 사용하는 AWS의 우분투 22.04입니다.
또한 다른 모듈을 추가해 보았습니다 .network
.
[Match]
Name=xfrm*
[Link]
ActivationPolicy=up
RequiredForOnline=no
성공하지 못했습니다.
내가 무엇을 놓치고 있나요?
UPD:
# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc mq state UP group default qlen 1000
link/ether 06:ea:6f:cf:a8:51 brd ff:ff:ff:ff:ff:ff
inet 10.100.1.205/24 metric 100 brd 10.100.1.255 scope global dynamic ens5
valid_lft 2529sec preferred_lft 2529sec
inet6 fe80::4ea:6fff:fecf:a851/64 scope link
valid_lft forever preferred_lft forever
(xfrm 인터페이스를 수동으로 추가하여 ens5
MTU가 1500으로 떨어졌습니다. 그렇지 않으면 동일한 시스템입니다.)
# networkctl status ens5
● 2: ens5
Link File: /usr/lib/systemd/network/99-default.link
Network File: /run/systemd/network/10-netplan-ens5.network
Type: ether
State: routable (configured)
Online state: online
Alternative Names: enp0s5
Path: pci-0000:00:05.0
Driver: ena
Vendor: Amazon.com, Inc.
Model: Elastic Network Adapter (ENA)
HW Address: 06:ea:6f:cf:a8:51
MTU: 1500 (min: 128, max: 9216)
QDisc: mq
IPv6 Address Generation Mode: eui64
Queue Length (Tx/Rx): 2/2
Address: 10.100.1.100
10.100.1.205
fe80::4ea:6fff:fecf:a851
Gateway: 10.100.1.1
Activation Policy: up
Required For Online: yes
DHCP6 Client DUID: DUID-EN/Vendor:0000ab11874fdc08796f22200000
Apr 17 02:55:13 ip-10-100-1-205 systemd-networkd[322]: ens5: Link UP
Apr 17 02:55:13 ip-10-100-1-205 systemd-networkd[322]: ens5: Gained carrier
Apr 17 02:55:13 ip-10-100-1-205 systemd-networkd[322]: ens5: Link DOWN
Apr 17 02:55:13 ip-10-100-1-205 systemd-networkd[322]: ens5: Lost carrier
Apr 17 02:55:13 ip-10-100-1-205 systemd-networkd[322]: ens5: Link UP
Apr 17 02:55:14 ip-10-100-1-205 systemd-networkd[322]: ens5: Gained carrier
Apr 17 02:55:15 ip-10-100-1-205 systemd-networkd[322]: ens5: Gained IPv6LL
답변1
각 네트워크 인터페이스는 다음으로 구성됩니다.첫 번째인터페이스와 일치하는 .network 파일. 귀하의 ens5는 이미 일치 10-netplan-ens5.network
하므로 27-eth0.network
무시됩니다.
systemd 버전이 충분히 현대적이라면 .netplan에서 제공하는 파일을 통해 사용자 정의 설정을 추가할 수 있습니다 /etc/systemd/network/10-netplan-ens5.network.d/*.conf
.
하드웨어 IPsec 오프로드가 필요하지 않은 경우 netdev를 독립형으로 설정하면 Independent=yes
.network 파일( )에서 호출하지 않고도 생성할 수 있습니다.
답변2
다른 사람의 답변을 업데이트하는 것이 잘못되었다고 생각하여 최종 솔루션을 더 명확하게 만들기 위해 답변을 게시했습니다.
만들다 /etc/systemd/network/10-netplan-ens5.network.d/xfrm0.conf
:
[Network]
Xfrm=xfrm0
이는 xfrm0
물리적 기반 가상 인터페이스를 생성합니다 ens5
.
만들다/etc/systemd/network/27-xfrm.network
[Match]
Name=xfrm*
[Link]
ActivationPolicy=up
RequiredForOnline=no
그러면 모든 xfrm*
인터페이스가 작동됩니다 UP
.