K
K
kisoluck2015-11-30 19:53:08
linux
kisoluck, 2015-11-30 19:53:08

How to make 2 network interfaces work on a Linux virtual machine under Qemu-KVM?

There is a server with one network interface and one dedicated IP address.
Several Debian 8 virtual machines under Qemu-KVM are configured. Raised default(NAT) network via virbr0 192.168.122.0/24, host address 192.168.122.1. It is necessary to raise another network in such a way that one of the networks is used to access the Internet, and the other imitates a local network that combines virtual machines and a host.
Created anynetwork subnet via virbr1 192.168.44.0/24 similar to the one described in default.xml. Added to each virtualka on the virtual adapter through this network.
Approximately this network configuration:

<network>
        <name>default</name>
        <bridge name="virbr0" />
        <forward/>
        <ip address="192.168.122.1" netmask="255.255.255.0">
          <dhcp>
            <range start="192.168.122.2" end="192.168.122.254" />
          </dhcp>
        </ip>
</network>

<network>
        <name>anynetwork</name>
        <bridge name="virbr1" />
        <ip address="192.168.44.1" netmask="255.255.255.0">
          <dhcp>
            <range start="192.168.44.2" end="192.168.44.254" />
          </dhcp>
        </ip>
</network>

virbr0 (192.168.122.1) and virbr1 (192.168.44.1) are up on the host. But on the virtual machine, the interface only rises from any one subnet. brctl was not used manually, /etc/network/interfaces was not correct, since the default network works without it.
The problems are as follows:
1. anynetwork does not want to be added to startup via virsh, although the network is up and running.
2. On virtual machines, only one of the interfaces rises (dnsmasq distributes IP from only one subnet, randomly).

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Cheremisin, 2015-11-30
@leahch

Raise the second bridge, pick up the second virtual machine interfaces to it. There will be an internal subnet. Everything should work with both bridge-utils and openvswitsh. With the latter only today something similar was tricky :-)
And it would be nice to see the configurations of your networks
And the configuration of the bridges would be nice to peep ...
Shl. I, however, have not tried to run a couple of dnsmasq, but you can always raise a normal DHCP for virtual machines.
Well, at least everything should work with static addresses, check with them first.

D
dyasny, 2016-10-14
@dyasny

DOMXML virtuals would be nice to see first

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question