Welcome to the Linux Foundation Forum!

Lab 2.1 Setting up second network

Hello everyone,
I'm trying to set up virtual machines for this course and I'm having some minor trouble. I'm using qemu (through virtual machine manager) so I converted the original file to .qemu and cloned it. By default, virtual network interface was installed so the two vms are in local network and connected to the internet (surprisingly I did nothing, it all happened automatically).
Now, if I understood well I am supposed to add a second network interface which will put two vms into local network without internet access. The only problem is that when I add another virtual network interface it is connected to the internet automatically and I don't know how to fix this. Can someone please help ?
Thanks in advance ! :)

Comments

  • lee42x
    lee42x Posts: 380

    Hello k0dard, Let me see if I can get you back on track.
    In "Virtual Machine Manager" select the " edit" tab then the "Connection Details" tab
    then "Virtual Networks" tab. From here you can add a new network. Please create a private network.
    Once created you can attach one nic from each machine to the new private network.

    Keep us posted :)
    Lee

  • k0dard
    k0dard Posts: 115

    Thanks Lee,
    It was easy with your help ! :smile: I have another question though, if you don't mind:

    While trying to find a solution by myself, and before knowing about Connection Details settings, I tried to change Network source under Virtual Network Interface settings (main -> Open -> Show virtual hardware details) to Host device wlo1: macvtap, Source mode: Bridge. Actually, at first I wrongly presumed I was supposed to do this to share my wlan1 adapter's internet with vm and that the other, virtual network 'defautl': NAT will not forward internet by default, and will be private.
    What this did is it created new routes in my routing table and added 2 new interfaces, so when I type route -n I get:

    192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
    169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 virbr1

    Where virbr0 is for virtual network 'default' and virbr1 is for the bridge.
    I realized this doesn't behave as I expected, so my first question is what is the bridge setting for ?

    Later, when I applied your solution, I was expecting that virbr1 will be removed, since the new virtual network is private. To my surprise, now I have another route:

    192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
    169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 virbr1
    10.0.0.0 0.0.0.0 255.254.0.0 U 0 0 0 virbr1

    So, not only the first virbr1 rule hasn't been removed even though I removed the bridge to Host device in the settings (bug?), but I got a new route. I'd really appreciate if I you could explain what's going on here, more precisely what is being routed with virbr1 if virtual connection doesn't have internet access ? And why do I still have routing enabled to 169.254.0.0 ?

    Thanks a lot in advance :)

    Other than that, two networks are working as expected, one (192) has internet access and the other (10) is private.

  • lee42x
    lee42x Posts: 380
    edited June 2020

    Hi k0dard,

    Each of the networks defined in Virt Manager will create a configuration for "libvirt" which in turn creates the virtual bridges. We then attach to the bridges. Each bridge will have configuration instructions like NAT,ROUTE, BRIDGE etc.. The default virbir0 is set to NAT from the client VM's to the outside world, the one we create keeps the traffic local.
    As for the 169.254/16 network, it is part of the "ZEROCONF" protocol set up by "avahi" in Linux. We do not use it for class, it is safe to ignore or delete it if you like.

    Lee

  • k0dard
    k0dard Posts: 115

    Thanks a lot for your help ! :smile:

Categories

Upcoming Training