1

I have a bare metal server with 2 NIC(eth0 and eth1). eth0 is connected to the internet and eth1 for LAN(DHCP must). Now I need multiple servers like that. So I have decided to go for VM. I have installed 5 VM under this bare metal, each of them is using eth0 for the internet and eth1 for LAN(DHCP).

Problem here, each VM(eth1) is giving DHCP/IP to all devices under physical eth1. I want to virtualize this portion. Each VM will have separate eth1 DHCP LAN network. How to achieve this?

1 Answers1

0

Depending on the setup (I cannot comment, but OP needs to add details like virtual machine system used (VMWare, QEMU KVM etc.) networkd interfaces or netplan yaml files for host and client) I assume that the OP wants each VM to have a different IP, on the same network.

To add separate subnets to each client VM requires a host bridge device, for the VM to create an interface against, with a suitable DHCP server ready to assign addresses.

Networkd interfaces approach:

# Do not set an IP - bind IP to bridge
auto eno2
iface eno2 inet manual

# Bridge interface
auto br26eno2
iface br26eno2 inet static
      address 172.26.0.10
      netmask 255.255.255.0
      bridge_ports eno2
      gateway 172.26.0.201
      # Options for VM's:
      bridge_fd 0
      bridge_stp off
      bridge_fd 0
      bridge_maxwait 0

Netplan (which has some funnies regarding bridges, so mostly for production we have disabled, and used networkd instead):

ethernets:
    eno2:
      dhcp4: yes
      dhcp6: no
      # Don't wait for it to come up during boot.
      optional: true

bridges:
    br8eno1:
      interfaces: [ eno2 ]
      dhcp4: no
      dhcp6: no

You then add the bridges to the VM host (libvirt uses a xml file, that you then load in), and create client interfaces.

sarlacii
  • 199
  • 7