- # 在 Host 中,创建 macvlan 网卡
- # ipv4.method auto:为了说明问题,我们没有使用冗长的网络配置
- # ipv4.route-metric 0:为了使该 macvlan 网卡成为优先级最高的路由(这样我们就不用停止原先的网络配置)
- nmcli connection add \
-     connection.type "macvlan" macvlan.mode "bridge" macvlan.parent "enp2s0f0" \
-     connection.interface-name "kvm-guest2host" \
-     connection.id "kvm-guest2host" \
-     ipv4.method auto \
-     ipv4.route-metric 0
- nmcli connection up "kvm-guest2host"
- # 在 Guest 中,要保证 Guest 也是使用 enp2s0f0 网卡派生的 macvtap 设备,并使用 bridge 模式
- # 通常情况,不用修改,因为我们一般都使用这种模式。
- -----------------------------------
参考文档
「KVM」- 实现 Host 与 Guest 访问 @20210314_11091184的技术博客_51CTO博客