How to get guest with two interfaces (host-only and NAT Network) working reliably?

Discussions about using Linux guests in VirtualBox.
Locked
UnrankedSmasher
Posts: 7
Joined: 17. Apr 2018, 16:32

How to get guest with two interfaces (host-only and NAT Network) working reliably?

Post by UnrankedSmasher »

I have an ubuntu server 18.04 under VirtualBox with 2 network adapters: NAT Network (enp0s3) and a Host-only Adapter (enp0s8). I use the NAT to access the internet and the Host-only Adapter to SSH in from my local machine. Seems like a pretty vanilla config to me but using the netplan config below gives me unexpected results.

Code: Select all

network:
    ethernets:
        enp0s3:
            addresses: [10.0.0.200/24,]
            dhcp4: no
            dhcp6: no
            gateway4: 10.0.0.1
            nameservers:
                addresses: [8.8.8.8, 8.8.4.4]
        enp0s8:
            addresses: [192.168.1.2/24,]
            dhcp4: no
            dhcp6: no
            #gateway4: 192.168.1.1
            nameservers:
                addresses: [8.8.8.8, 8.8.4.4]
    version: 2
With that configuration I have internet on enp0s3 but I can't ssh into the machine or ping 192.168.1.2. If, after I ping google.com from inside the guest I then uncomment "gateway4: 192.168.1.1" and instead comment out "gateway4: 10.0.0.1" and apply the netplan then I get to ssh into the machine AND keep getting internet access on enp0s3 (my workaround so far has been to leave it at that and repeat it every time I restart the vm) BUT, if I restart the vm with that same netplan config I lose internet access but keep being able to ssh into the machine.

The netplan config seems to be lacking something but this is the config I have gotten from multiple tutorials online. What could be causing this discrepant behavior? Below is the NAT network the vm belongs to.

Code: Select all

$ VBoxManage natnetwork list
NAT Networks:

Name:        natnet1
Network:     10.0.0.0/24
Gateway:     10.0.0.1
IPv6:        No
Enabled:     Yes
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: How to get guest with two interfaces (host-only and NAT Network) working reliably?

Post by socratis »

I don't know what netplan is or isn't, nor do I plan on finding out any time soon... ;)

What I do know is that (and to answer your original question) all of my guests, including several flavors of Fedora, have 4 adapters; HostOnly, Internal, NATservice and Bridged. And all of them are working without any issues.

Well, not all; Win95 gets a nervous break-down when shown 4 NICs, and some Linux-based distros (mainly Debian) refuse to work on anything but the 1st card and need to be told to enumerate all the NICs to get it right. One of the worst offenders is Kali...

But Fedora works right out of the box.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
UnrankedSmasher
Posts: 7
Joined: 17. Apr 2018, 16:32

Re: How to get guest with two interfaces (host-only and NAT Network) working reliably?

Post by UnrankedSmasher »

socratis wrote:What I do know is that (and to answer your original question) all of my guests, including several flavors of Fedora, have 4 adapters; HostOnly, Internal, NATservice and Bridged. And all of them are working without any issues.
How is this an answer to my question?
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: How to get guest with two interfaces (host-only and NAT Network) working reliably?

Post by socratis »

UnrankedSmasher wrote:How is this an answer to my question?
Hmm... let's see...

QUESTION: How to get guest with two interfaces (host-only and NAT Network) working reliably?

ANSWER: I have four NICs on each of my VMs. They work just great on every single guest that I've tried, including several Fedora ones.

I'm not sure how your question is not answered...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
UnrankedSmasher
Posts: 7
Joined: 17. Apr 2018, 16:32

Re: How to get guest with two interfaces (host-only and NAT Network) working reliably?

Post by UnrankedSmasher »

So you have a nice working setup, good for you! But describing your setup is not an answer to my post and not even an answer to the title of my post either so you lose on both counts. NEXT!
Last edited by socratis on 2. Apr 2019, 23:47, edited 1 time in total.
Reason: Removed unnecessary verbatim quote of the whole previous message.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: How to get guest with two interfaces (host-only and NAT Network) working reliably?

Post by socratis »

UnrankedSmasher wrote:So you have a nice working setup
What I described is the default setup in VirtualBox, and it works, right out of the box! What you're asking for is a custom setup with 'netplan'. And I'm telling you that the default VirtualBox setup works. So, start looking what's wrong with 'netplan', not what's wrong with VirtualBox.
UnrankedSmasher wrote:But describing your setup is not an answer to my post and not even an answer to the title of my post
The Q (in the Q/A post of mine), is actually a straight quote of your post's title, so, I'm not sure what in the seven kingdoms you're talking about...


BTW, drop the attitude. We're not going to have a happy ending...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
UnrankedSmasher
Posts: 7
Joined: 17. Apr 2018, 16:32

Re: How to get guest with two interfaces (host-only and NAT Network) working reliably?

Post by UnrankedSmasher »

socratis wrote:What I described is the default setup in VirtualBox, and it works, right out of the box! What you're asking for is a custom setup with 'netplan'. And I'm telling you that the default VirtualBox setup works. So, start looking what's wrong with 'netplan', not what's wrong with VirtualBox.
No one said there was something wrong with vbox but besides that, netplan is how ubuntu server network interfaces are configured by default.
socratis wrote:The Q (in the Q/A post of mine), is actually a straight quote of your post's title, so, I'm not sure what in the seven kingdoms you're talking about...
That's why I referenced both. I'll spell it out for you: You realized that your post wasn't an actual anwer but instead of accepting it you tried to weasel your way out of it by pretending that it was a direct answer to my posts title, which it wasn't either (and that's why I highlighted it). Get it now? You are a moderator, you should be good at this.
socratis wrote:BTW, drop the attitude. We're not going to have a happy ending...
Are you using a pickup line on me? Sad lol.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: How to get guest with two interfaces (host-only and NAT Network) working reliably?

Post by socratis »

From the Forum Posting Guide » This is a community service:
[color=#00AA00]Forum Moderators[/color] wrote:This is a service for and largely provided by the VirtualBox community. It is a free service. Our community supporters give their time here freely to help the community, so please help them to help you. Be polite in your requests and remember to give feedback when practical. A nice “thank-you that solved my problem” closes the topic and lets others searching the forums know that your problem was solved, yet only a minority of posters adopt this common courtesy.

Whilst we accept that some robust debate may be appropriate, we will not accept unnecessarily aggressive or rude behaviour. So please, no matter what your personal frustration, try to keep your comments constructive. If you cross this line then the moderators will delete your posts.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
UnrankedSmasher
Posts: 7
Joined: 17. Apr 2018, 16:32

Re: How to get guest with two interfaces (host-only and NAT Network) working reliably?

Post by UnrankedSmasher »

That's weak lol
Last edited by socratis on 3. Apr 2019, 02:56, edited 1 time in total.
Reason: Removed unnecessary verbatim quote of the whole previous message.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: How to get guest with two interfaces (host-only and NAT Network) working reliably?

Post by socratis »

I warned you about your attitude. We're volunteers trying to help other users, not to take abuse.

Why don't you take two weeks off to think about that...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Locked