0

This is probably something simple and has already been asked but I just don't know what I'm looking for. I lack the vocabulary. I have a server running with a Debian host and have KVM installed. I have a virtual netork that's configured with DHCP and instructed it to forward connections to one of the host's NICs using a NAT connection. However, this host device has more than one NIC, one that is connected to an external network, and one that in not being used. Is it possible to set up a bridged connection between my NAT virtual network and this other unused NIC? The idea would be to allow other physical devices to connect to this virtual network and get an IP from it which will allow this other physical device to communicate with the virtual machines running on the virtual network. Then any other connection requests to the outside world would be forwarded with NAT with the other NIC that's in use to connect to the internet. Where would I start and what would I be looking for to accomplish this? I have looked at some documentation however, can't seem to find what I'm looking for. If this question is unclear, please let me know and I'll try and reiterate.

1 Answer 1

2

Yes, you can do this. Add the second NIC to the internal bridge. As you are using debian, the commands might look something like this:

brctl show

Identify the bridge for your virtual network.

brctl addif <name of bridge> <name of interface>

This makes the change temporarily. To make the change permanent you should edit your config files. If you have a /etc/network/interfaces file, adding the line "bridge <name of bridge>" under the interface you'd like to be on the internal network will do the trick. If you have /etc/sysconfig/network-scripts/ folder, then you'll have a file named 'ifcfg-' and you'll need to put the changes in there. Documentation is available online for the formats for each of these files.

12
  • Thanks for the answer! I'll go ahead and configure it remotely and test it later when I'm able and see if that works.
    – BobserLuck
    Feb 1, 2019 at 0:27
  • I think that got me half way there. I was able to run vrctl addif ExampleBridge ExampleInterface and add the bridge but upon connecting a device to the interface, it couldn't recognize the network. It may be something I need to edit with virsh since the network was created with it.
    – BobserLuck
    Feb 1, 2019 at 18:32
  • 1
    When you say 'didn't recognize the network' do you mean that the virsh DHCP server was not found? That is a head scratcher. Can you put a packet sniffer on your external device and/or on your bridge and check if the bridge is working? You should see traffic from the other segment of the bridge even if you cannot get DHCP.
    – Andy
    Feb 1, 2019 at 19:13
  • Ah, it seems that the interface was down. Now I can connect to the DHCP hosted on the network and acquire an IP address and connect to the internet from my laptop through this server. I can't seem to communicate with the VMs on the network. I can ping one VM from another, I can ping the internet from all devices, but I can't ping from my laptop to a VM nor from a VM to my laptop. Not quite sure what's going on. Would it have to do with the Virtual Network using NAT? Do the IPs get translated before hitting the bridge? Why can I get an IP from the network but not communicate with the VMs?
    – BobserLuck
    Feb 4, 2019 at 5:53
  • IP ares not being translated at all; the bridge is functionally identical to a switch and has very little intelligence. NAT doesn't play into it either; you don't leave your virtual LAN to ping one machine to another. I suspect that firewall rules are more likely to blame, especially if one of your machines is Windows OS. Make sure your Windows machine is set to Private Network mode, and if that doesn't work, temporarily disable Windows Firewall to check if your problem is at all firewall related.
    – Andy
    Feb 4, 2019 at 5:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .