1. # 在 Host 中,创建 macvlan 网卡
  2. # ipv4.method auto:为了说明问题,我们没有使用冗长的网络配置
  3. # ipv4.route-metric 0:为了使该 macvlan 网卡成为优先级最高的路由(这样我们就不用停止原先的网络配置)
  4. nmcli connection add \
  5. connection.type "macvlan" macvlan.mode "bridge" macvlan.parent "enp2s0f0" \
  6. connection.interface-name "kvm-guest2host" \
  7. connection.id "kvm-guest2host" \
  8. ipv4.method auto \
  9. ipv4.route-metric 0
  10. nmcli connection up "kvm-guest2host"
  11. # 在 Guest 中,要保证 Guest 也是使用 enp2s0f0 网卡派生的 macvtap 设备,并使用 bridge 模式
  12. # 通常情况,不用修改,因为我们一般都使用这种模式。
  13. -----------------------------------

参考文献

https://blog.51cto.com/u_11101184/3137103