1

I have a Linux Mint 19.0 host machine running two VMs - one is an Ubuntu Server (console only) and the other is Linux Mint 19.3 with a GUI. I plan to run Kubernetes in the Server instance and control it using kubectl in the GUI. To get there, I first want to build a network path between the two VMs, so I can ping each from the other.

Amongst several resources, I've been using this guide to understand how to do this. The essence of that piece is that one can use an "Internal Network" VirtualBox network type (as a secondary network on top of the default one) to connect two or more VMs, and that the only thing one needs to watch out for is that the network is the same for all VMs that need to join the network.

However, I tried that, and it did not work for me. I was expecting a new (virtual) network device to pop up in both VMs. Using ifconfig, nothing showed in the Server, and although the GUI VM showed the adapter, it repeatedly failed to connect.

I found another doc resource that I need a "Bridged Adapter". I swapped both VMs to this, and here one needs to select an on-host adapter, so I have left it set on the only host adapter for both VMs. This gets me closer - the network is autodetected in the GUI VM and connects successfully. However there is no similar luck in my Server VM - ifconfig gives me nothing new.

I have ensured that Guest Additions is installed on both VMs.

Finally, I found some advice to manually configure a static IP, so I tried this in the Server VM: ,

# /etc/network/interfaces

iface enp0s8 inet static
    address 192.168.43.188
    netmask 255.255.255.0
    network 192.168.1.0
    broadcast 192.168.43.255
    gateway 192.168.43.1
    dns-nameservers 192.168.43.1

However I don't have much confidence that this is not a legacy file, and the change has made no difference. I am probably at the stage of flailing around trying random things, which is not very productive. What can I try next to configure this? I feel that this task should be very straightforward.

Observation

So the problem is just in the console VM - I think the full GUI VM is OK. I noticed one strange thing, which is that if I do a ifconfig in the server VM, I get configurations for both enp0s3 and lo. However, if I do ifquery --list, I get a device only for lo.

That suggests to me that the if commands are not being used (and indeed I had to install ifconfig manually). I will try to see if there are any other commands that could be used to bring network devices up or down.

Update

As per comment advice I have tried creating a VirtualBox network device, thus:

  • Name: vboxnet0
  • Adapter tab: "Configure Adapter Automatically" (ticked)
  • DHCP Server tab: "Enable Server" (ticked)

I click "Apply" and get a dialogue box that says NS_ERROR_NOT_IMPLEMENTED.

I will try experimenting with other network types.

6
  • (Aside: although I want to use this for technical/programming reasons, I felt that Super User was the best place to ask about the setup of a network, since it is not a programming activity, and would not be on-topic at Stack Overflow).
    – halfer
    Commented Jun 15, 2020 at 16:44
  • If you need Internet access from the VM then you need a bridged adapter. That adapter will not be reachable without port forwarding from your host. For VM-2-VM connections you should set up a NATted network with DHCP server in VirtualBox and add a second adapter on your VMs connected to that network. Depending on your OS you might need to configure it additionally - see here. That should give you a good start....
    – Zina
    Commented Jun 15, 2020 at 17:24
  • Thanks @Zina. Yes, I would want internet access for each VM - the default network (NAT) adapter for each one seems to provide that already. I don't mind if VM-2-VM is achieved through the same adapter, though my approach thus far has been to add a second one. Thank you for the steer to try adding a second NAT device plus a VB DHCP server - I will give that a go.
    – halfer
    Commented Jun 15, 2020 at 18:30
  • regarding your update, tick "Configure Adapter Manually", give the Network for example a /24 subnet e.g. 192.168.56.1/24, and the DHCP you could set: Server IP 192.168.56.100/24, and lower IP 192.168.56.101 Upper IP 192.168.56.254 and with /24 I mean 255.255.255.0
    – Zina
    Commented Jun 15, 2020 at 19:27
  • Thanks @Zina, I will try that too!
    – halfer
    Commented Jun 15, 2020 at 19:40

1 Answer 1

1

A helpful set of comments from @Zina has helped me dig into the issue.

First of all I confirmed that two network adapters were available, even though they were not up:

sudo cat /proc/net/dev

Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
enp0s3:    2360       4    0    0    0     0          0         0     2170      14    0    0    0     0       0          0
enp0s8:       0       7    0    0    0     0          0         0        0       0    0    0    0     0       0          0
    lo:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0

I then added this simple /etc/network/interfaces to bring everything up using DHCP:

auto lo

auto enp0s3
iface enp0s3 inet dhcp

auto enp0s8
iface enp0s8 inet dhcp

Now we are getting somewhere with ifconfig:

enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.2.15  netmask 255.255.255.0  broadcast 10.0.2.255
        inet6 fe80::a00:27ff:fe00:6ca9  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:00:6c:a9  txqueuelen 1000  (Ethernet)
        RX packets 4  bytes 2360 (2.3 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 16  bytes 2310 (2.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.43.105  netmask 255.255.255.0  broadcast 192.168.43.255
        inet6 fe80::a00:27ff:fe9e:4ec0  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:9e:4e:c0  txqueuelen 1000  (Ethernet)
        RX packets 14  bytes 1427 (1.4 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 13  bytes 1550 (1.5 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

I can then do a ifconfig in both VMs to find the IP of each, so that one can be pinged from the other.

I am not sure why the first network adapter is brought up automatically with an empty interfaces file, but the second one is not. Moreover, my GUI VM only references the loopback adapter in the interfaces file, but seems to bring up both network devices automatically.

2
  • and the automatic bring up is also mentioned in the link, first answer - edit section...
    – Zina
    Commented Jun 15, 2020 at 22:09
  • @Zina: ha, now that you point it out, yes - I think you are right. I think I used a jumble of pre-existing knowledge plus bits from that, but in hindsight that is rather similar. Normally I would suggest closing my question as a duplicate, but I wonder if it would be better for me to beef up my answer with the VirtualBox network devices that paved the way for the interfaces changes.
    – halfer
    Commented Jun 15, 2020 at 23:02

You must log in to answer this question.

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