V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
PowerDi
V2EX  ›  问与答

PVE 的虚拟网卡是如何设计的

  •  
  •   PowerDi · 2023-02-20 10:01:00 +08:00 · 1028 次点击
    这是一个创建于 424 天前的主题,其中的信息可能已经有所发展或是发生改变。

    惯性思维: VM 中,虚拟机的网络可以选择桥接模式,可以通过宿主机的网卡自动分配一个与宿主机网络同网段的 IP 地址,此时相当于一个网卡下面有两个独立的设备,一个宿主机一个虚拟机,路由器中也能看到。 在 PVE 中: 1 )我用的是无线网卡,配置自动生成的 vmbr0 才能连通 PVE 管理页面

    auto wlp3s0
    iface wlp3s0 inet static
            wpa-ssid "...."
            wpa-psk  ...       
            address 192.168.0.124/24
            gateway 192.168.0.1
    
    auto vmbr0
    iface vmbr0 inet static
            address  203.12.1.3/24
            bridge-ports none
            bridge-stp off
            bridge-fd 0
    

    如果我改成

    auto wlp3s0
    iface wlp3s0 inet dhcp
            wpa-ssid "..."
            wpa-psk  ...       
    
    auto vmbr0
    iface vmbr0 inet static
    		address 192.168.0.124/24
            gateway 192.168.0.1
            bridge-ports wlp3s0
            bridge-stp off
            bridge-fd 0
    

    这样就联不通 PVE 了。vmbr0 和管理页面是啥关系?

    2 )其实最终的目的是为了虚拟机选择 vmbr0 网口时,能生成一个基于路由器网段的 IP ,这样我就能用路由器的端口转发到这台虚拟机上了

    2 条回复    2023-02-20 10:20:29 +08:00
    ho121
        1
    ho121  
       2023-02-20 10:16:39 +08:00
    不太懂 PVE ,不过 libvirt 桥接到 wlan 是不支持的

    Important Note: Unfortunately, wireless interfaces cannot be attached to a Linux host bridge, so if your connection to the external network is via a wireless interface ("wlanX"), you will not be able to use this mode of networking for your guests.

    https://wiki.libvirt.org/page/Networking
    kaedeair
        2
    kaedeair  
       2023-02-20 10:20:29 +08:00
    vmbr0 是 pve 的管理页面接口,和路由器的 br-lan 差不多
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1223 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 23:55 · PVG 07:55 · LAX 16:55 · JFK 19:55
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.