Virtual Networking Overview
PiVirt delivers versatile software-defined networking capabilities, enabling seamless layer-2 connectivity, isolated VLAN networks, multi-host VXLAN overlays, and line-rate hardware passthrough.
Bridge Networking
Section titled “Bridge Networking”Basic Bridge
Section titled “Basic Bridge”network: bridges: - name: "virbr0" type: "bridge" interface: "eth0"VLAN-Aware Bridge
Section titled “VLAN-Aware Bridge”network: bridges: - name: "vlan-bridge" type: "bridge" interface: "eth0" vlan_aware: true vlans: - id: 10 name: "management" - id: 20 name: "storage"VLAN Configuration
Section titled “VLAN Configuration”Create VLAN
Section titled “Create VLAN”pvcli network vlan create \ --name vlan10 \ --bridge virbr0 \ --vlan-id 10Attach VM to VLAN
Section titled “Attach VM to VLAN”spec: nics: - name: eth0 network: virbr0 vlan: 10VXLAN Overlay
Section titled “VXLAN Overlay”Create VXLAN Network
Section titled “Create VXLAN Network”pvcli network create \ --name vxlan-net \ --type vxlan \ --vni 1000 \ --local-ip 10.0.1.10 \ --remote-ips 10.0.1.11,10.0.1.12VXLAN Configuration
Section titled “VXLAN Configuration”network: vxlans: - name: "vxlan100" vni: 100 local_ip: "10.0.1.10" remote_ips: - "10.0.1.11" - "10.0.1.12" port: 4789SR-IOV Passthrough
Section titled “SR-IOV Passthrough”Configure SR-IOV
Section titled “Configure SR-IOV”network: sriov: - name: "sriov-net" pf: "eth2" vfs: 8Attach VM to SR-IOV
Section titled “Attach VM to SR-IOV”spec: nics: - name: eth0 network: sriov-net model: vfio-pciNetwork Policies
Section titled “Network Policies”Create Network Policy
Section titled “Create Network Policy”apiVersion: pivirt.pilab.hu/v1kind: NetworkPolicymetadata: name: web-isolation namespace: productionspec: podSelector: matchLabels: app: web ingress: - from: - namespaceSelector: matchLabels: name: monitoring ports: - protocol: TCP port: 80IP Address Management
Section titled “IP Address Management”spec: nics: - name: eth0 network: virbr0 ipam: mode: dhcpStatic IP
Section titled “Static IP”spec: nics: - name: eth0 network: virbr0 ipam: mode: static address: "10.0.1.100/24" gateway: "10.0.1.1"Best Practices
Section titled “Best Practices”1. Use virtio Network Model
Section titled “1. Use virtio Network Model”spec: nics: - name: eth0 model: virtio # Best performance2. Enable Multi-Queue
Section titled “2. Enable Multi-Queue”spec: nics: - name: eth0 queues: 2 # Match vCPU count3. Set Bandwidth Limits
Section titled “3. Set Bandwidth Limits”spec: nics: - name: eth0 bandwidth: ingress: rate: "100Mbps" egress: rate: "50Mbps"Troubleshooting
Section titled “Troubleshooting”Network Not Working
Section titled “Network Not Working”# Check bridgebrctl show virbr0
# Check iptablesnft list ruleset | grep virbr0
# Check VM interfacepvcli vm get web-01 -o json | jq '.spec.nics'VXLAN Issues
Section titled “VXLAN Issues”# Check VXLAN interfaceip link show vxlan100
# Check UDP connectivitync -zv 10.0.1.11 4789SR-IOV Issues
Section titled “SR-IOV Issues”# Check IOMMUdmesg | grep -i iommu
# Check VF availabilityls /sys/class/net/eth2/device/virtfn*