KVM之网桥创建(ubuntu 环境)

前端之家收集整理的这篇文章主要介绍了KVM之网桥创建(ubuntu 环境)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

KVM之网桥创建(ubuntu 环境)

1、创建网桥的目的是为了让KVM虚拟机连接到这个网桥,从而使虚拟机可以和物理网络通信
2、当然,安装完kvm后,会自动建立一个网桥virbr0,这个网桥应该是nat模式

一、DHCP网桥创建
vim /etc/network/interfaces

这是interfaces配置文件内容

  1. #Thisfiledescribesthenetworkinterfacesavailableonyoursystem
  2. #andhowtoactivatethem.Formoreinformation,seeinterfaces(5).
  3.  
  4. #Theloopbacknetworkinterface
  5. autolo
  6. ifaceloinetloopback
  7.  
  8. #Theprimarynetworkinterface
  9. autoeth0
  10. ifaceeth0inetdhcp物理网卡也为DHCP
  11.  
  12. autobr100
  13. ifacebr100inetdhcp配置br100网桥为DHCP
  14. bridge_portseth0配置br100建立在物理网卡eth0
  15. bridge_stpoff
  16. bridge_fd


创建完成后,重启网络

静态网桥
vim /etc/network/interfaces

  1. #Thisfiledescribesthenetworkinterfacesavailableonyoursystem
  2. #andhowtoactivatethem.Formoreinformation,seeinterfaces(5).
  3.  
  4. #Theloopbacknetworkinterface
  5. autolo
  6. ifaceloinetloopback
  7.  
  8. #Theprimarynetworkinterface
  9. autoeth0
  10. ifaceeth0inetstatic
  11. address192.168.89.3
  12. gateway192.168.89.2
  13. netmask255.255.255.0
  14. network192.168.89.0
  15. broadcast192.168.89.255
  16.  
  17. autobr100
  18. ifacebr100inetstatic
  19. bridge_portseth0
  20. bridge_stpoff
  21. bridge_fd0
  22. bridge_maxwait0
  23. address192.168.89.3
  24. network192.168.89.0
  25. netmask255.255.255.0
  26. broadcast192.168.89.255
  27. gateway192.168.89.2

创建完成后,重启网络

猜你在找的Ubuntu相关文章