Internet Connection causes pings to fail

This is for discussing general topics about how to use VirtualBox.
CBCH
Posts: 7
Joined: 3. Jun 2021, 04:09

Internet Connection causes pings to fail

Post by CBCH »

Hi guys, this is my first time posting on this awesome forum, but it is unfortunately a question that has been bugging me for days.

I have an Ubuntu 20.04.1 machine which consists of 2 adapters.

Code: Select all

enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.96  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::c87c:ea4b:8946:7b9a  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:bd:8b:9f  txqueuelen 1000  (Ethernet)
        RX packets 989  bytes 924978 (924.9 KB)
        RX errors 0  dropped 37  overruns 0  frame 0
        TX packets 373  bytes 49368 (49.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.0.69  netmask 255.255.255.0  broadcast 10.0.0.255
        inet6 fe80::90e5:3014:8b6a:a8ee  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:d9:20:98  txqueuelen 1000  (Ethernet)
        RX packets 38  bytes 3604 (3.6 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 103  bytes 9660 (9.6 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
I also have a Kali 2021.1-amd64 machine which is using the Internal Network adapter (external).

Code: Select all

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 1.1.1.2  netmask 255.255.255.252  broadcast 1.1.1.3
        inet6 fe80::a00:27ff:fea6:1f86  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:a6:1f:86  txqueuelen 1000  (Ethernet)
        RX packets 3  bytes 256 (256.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 19  bytes 1542 (1.5 KiB)
        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 8  bytes 400 (400.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 8  bytes 400 (400.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
Between these two machines, I am using PFSENSE-HP 2.6.0 as my router.

The issue is that when I use the Bridged adapter on my Ubuntu machine, my Kali can't ping the IPv4 address of the Internal Network (DMZ) adapter anymore. However, I can access the website on 10.0.0.69 via my browser on Kali. In addition, I am able to ping the Ubuntu machine from a shell on my PFSENSE-HP router. To ensure that this isn't a firewall issue, I allowed all ICMP requests to flow from the External zone to the DMZ zone vice versa on the router. I also used iptables to make sure ICMP echo requests are not getting blocked on both the Ubuntu and Kali machines. What makes this even weirder is that, I can ping my Kali from my Ubuntu machine but not the other way round. The moment I remove the bridged adapter, the pings are able to work again. However, I really need the bridged adapter for gaining an internet connection on my Ubuntu machine. I just want to be able to get Internet connection but also be able to ping the network at the same time.

Any help would be appreciated! I'm literally going to get white hairs from this.

PS. The following are my adapter settings on my Ubuntu machine. (Please let me know if I'm not giving enough details in this post) Thanks in advance!
Attachments
1. Bridged adapter
1. Bridged adapter
3-6-vbox-1.PNG (12.32 KiB) Viewed 7865 times
2. Internal Network adapter (DMZ)
2. Internal Network adapter (DMZ)
3-6-vbox-2.PNG (11.88 KiB) Viewed 7865 times
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Internet Connection causes pings to fail

Post by scottgus1 »

Good information, Thanks! Some info on the pfSense router VM may help. I am assuming it's a VM: if it's not we need a more clear map of your network setup.

However, if some form of communication goes through a Virtualbox network, then the network is working and troubles are coming from configuration glitches in the VM's OS's or the host, not from Virtualbox.

Virtualbox only provides network 'hardware', not the services that run over the hardware. So if you can ping or access a web page over a network, then the network is working. The OS has something misconfigured if you can't ping but can still access the web page when the other adapter is set to Bridged. (What is it set to when you can ping?)

See Virtualbox Networks: In Pictures for the kinds of network Virtualbox provides and what they do.
CBCH
Posts: 7
Joined: 3. Jun 2021, 04:09

Re: Internet Connection causes pings to fail

Post by CBCH »

Hi @scottgus1, thanks for the reply.

My PFSense router is a VM as well and I configured it to allow all ICMP requests between the External zone and DMZ, thus, this shouldn't be an issue. I can access the website from my kali in the External zone via 10.0.0.69. However, I cannot ping it somehow, which to me, doesn't make sense. The moment I just remove the bridged adapter, everything starts working again. In addition, I have also tried NAT, but it doesn't give internet connection somehow, which is the reason why I resorted to using the bridged adapter.

My network setup is something like this:
Attachments
PS: The PFSense router also provides firewall, hence the firewall symbol. However, as I previously stated, I already configured a rule to allow all ICMP requests to pass through.
PS: The PFSense router also provides firewall, hence the firewall symbol. However, as I previously stated, I already configured a rule to allow all ICMP requests to pass through.
networkinfrastructure.png (58.27 KiB) Viewed 7825 times
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Internet Connection causes pings to fail

Post by scottgus1 »

Thanks for the info. I gather that the Kali VM is in the "internet" network. The Ubuntu VM is apparently cross-connected between the "inside trusted" network and the "DMZ" network. How this cross-connection may help or harm is unknown to me.

Please post the .vbox files for each VM you have connected in your test arrangement: Right-click each VM in the main Virtualbox window's VM list, choose Show in Explorer/Finder/File Manager. Zip the VM's .vbox file (not the .vbox-prev file), and post the zip file, using the forum's Upload Attachment tab. All the .vbox files can go inside one zip file. (Configure your host OS to show all extensions if the folder that opens does not show a .vbox file.)
CBCH
Posts: 7
Joined: 3. Jun 2021, 04:09

Re: Internet Connection causes pings to fail

Post by CBCH »

The following are the VMs' .vbox files. Thanks a lot for your help in advance!
Attachments
vbox.zip
(8.8 KiB) Downloaded 8 times
fth0
Volunteer
Posts: 5661
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Internet Connection causes pings to fail

Post by fth0 »

Thanks for the .vbox files, they solved some misunderstandings (for me at least). To sum up the relevant parts:

There is an Internal Network named "external" between the Kali VM (1.1.1.2/30) and the pfSense VM (1.1.1.1/30). Then there is an Internal Network named "dmz" between the Kali VM (10.0.0.1/24) and the Ubuntu VM (10.0.0.69/24). Last but not least, the Ubuntu VM has a Bridged Network which gets an IP address from your host network (192.168.1.96/24 in your initial posting, 192.168.0.66/26 at some time in the past, note the different netmasks).

An HTTP(S) connection from 1.1.1.2 to 10.0.0.69 and a ping from 10.0.0.69 to 1.1.1.2 do work, but a ping from 1.1.1.2 to 10.0.0.69 does not work. I'd use Wireshark on all three VMs to see where the ICMP echo request or the ICMP echo reply gets stuck. You can also create Wireshark captures in VirtualBox (search the VirtualBox User Manual for "nictrace").

Regarding bridging over the Intel Wireless-AC 9260, there could be problems. But in one of my own setups, I'm using an Intel Wireless-AC 9560 without problems, so I also don't expect any problems with the Intel Wireless-AC 9260 either.
Last edited by fth0 on 7. Jun 2021, 13:21, edited 1 time in total.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Internet Connection causes pings to fail

Post by scottgus1 »

I also see the "External" Internal network between Kali and pfSense, which continues through Internal "dmz" to the Ubuntu Web Server. Since "External" is supposed to represent the internet, this should be connected to pfSense's WAN port (which can't be determined from the .vbox file).

The Ubuntu "Web Server" is Bridged to the host's Wi-Fi. It is also connected to the pfSense through the following separate but parallel Internal networks:

dmz
internal-finance
internal-hr
internal-clevel
internal-itdept

I cannot tell which of these Internal networks have their "cables" connected, as the .vbox file's cable="true" does not apparently always mean 'cable is connected' (at least I have not figured out the pattern). All of the pfSense network's cables are "true", none of the Web Server's network cables (including Internal "dmz") are "true", yet access to the web server is possible from Kali (whose "dmz" cable is also not "true" :shock: )

The problem appears to appear when the Bridged adapter is inserted. Does this:
CBCH wrote:The moment I just remove the bridged adapter,
mean disabling the whole adapter, which requires a shutdown of the VM, or just disconnecting the network cable?

I am also suspicious of these other parallel networks. Are they connected as well? If so, might one of them be IP'd into a 192.168.1.### network which confuses the network stack?

In any case, this is probably an OS configuration issue, not a problem with Virtualbox's networks. Virtualbox does not to my knowledge have any way to limit ping vs Bridged access or other such scenarios.
fth0
Volunteer
Posts: 5661
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Internet Connection causes pings to fail

Post by fth0 »

scottgus1 wrote:I cannot tell which of these Internal networks have their "cables" connected, as the .vbox file's cable="true" does not apparently always mean 'cable is connected' (at least I have not figured out the pattern). All of the pfSense network's cables are "true", none of the Web Server's network cables (including Internal "dmz") are "true", yet access to the web server is possible from Kali (whose "dmz" cable is also not "true" :shock: )
@scottgus1: I can help you with that: :)

Since VirtualBox 5.2.x, only non-default values are written to the .vbox file, and because the default value for the cable attribute is true for all network adapters (including all potentially not-enabled ones), its absence means that the Ubuntu VM has all 6 cables connected.

PS: If this doesn't explain everything you encountered in the past: If older VirtualBox versions (< 5.2) were involved, or going back and forth between versions, it can get more complicated than that.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Internet Connection causes pings to fail

Post by scottgus1 »

fth0 wrote:only non-default values are written to the .vbox file
OK, thanks, fth0, that makes sense. So if "cable = false/true" is not in the XML for a network card, it would mean that the cable is in its default state of being connected and has never been disconnected since the beginning of the VM (unless a manual edit was done). A "cable = true" means the cable has been disconnected and reconnected at least once.

If I have gathered correctly, then these 5 parallel networks between Ubuntu and pfSense are all completely connected. That's a lot of parallel channels for networking to go south.
fth0
Volunteer
Posts: 5661
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Internet Connection causes pings to fail

Post by fth0 »

scottgus1 wrote:So if "cable = false/true" is not in the XML for a network card, it would mean that the cable is in its default state of being connected and has never been disconnected since the beginning of the VM (unless a manual edit was done). A "cable = true" means the cable has been disconnected and reconnected at least once.
No. But I realized now that it's my fault, because my description was not accurate enough. I'll try again:

Since VirtualBox 5.2 and settings version 1.16, only non-default values are written to the .vbox file. Note that when VirtualBox 5.2+ creates a .vbox file, it uses the oldest settings version that can describe the VM configuration, which often is 1.15. In consequence, .vbox files with settings version 1.15 can contain cable="true", and .vbox files with settings version 1.16 can contain cable="false".

You can verify that yourself as follows: In the VirtualBox Manager of a current VirtualBox version (e.g. 6.1.x), create a new VM configuration named "Test" by simply clicking through the wizard, resulting in a Windows 7 VM with a NAT network adapter and the virtual cable connected. Open the Test.vbox file and note the settings version 1.15 and cable="true". Inside the VirtualBox Manager, toggle the cable attribute and note that cable="true" disappears and re-appears. Now add an NVMe storage controller to the VM configuration, which will enforce settings version 1.16. Afterwards, toggle the cable attribute again and note that cable="false" (dis-)appears.

In the issue of this thread, the Ubuntu VM uses settings version 1.16, and the pfSense VM uses settings version 1.15. In consequence, the virtual cables are all connected. And I still count 6 network adapters (from 0 to 5). ;)
CBCH
Posts: 7
Joined: 3. Jun 2021, 04:09

Re: Internet Connection causes pings to fail

Post by CBCH »

Hi guys, really sorry about the late reply, was busy yesterday.

Regarding the use of Intel Wireless-AC 9560, if it fixes the issue, how do I use it? Since it is not in my list of dropdown and I don't really see any online guides regarding this either. Using other adapters is fine too, as long as I receive an Internet Connection on my machine. (PS: NAT doesn't work somehow)

Just disconnecting the bridged adapter (in my case enp0s3) fixes the issue, I don't have to reboot the machine or anything and the ping will go through.

I have also done a traceroute and the ICMP echo request stops at 1.1.1.1/30, which is the gateway for the external domain in my network. This makes me think whether it is my PFSENSE router blocking something, but then again, I have enabled all ICMP requests to and fro WAN (external) to LAN (DMZ).
CBCH
Posts: 7
Joined: 3. Jun 2021, 04:09

Re: Internet Connection causes pings to fail

Post by CBCH »

I just had a discussion with my teacher, and he mentioned that if I really intend to include internet connection should connect my PFSense router to the internet by adding another route to the Internet. The 1.1.1.1/30 here is just to simulate the External network.
CBCH
Posts: 7
Joined: 3. Jun 2021, 04:09

Re: Internet Connection causes pings to fail

Post by CBCH »

Ok guys, I have finally fixed the issue, just adding another NAT adapter to my PFSense router did the job. Still though, thanks so much for all your help.
fth0
Volunteer
Posts: 5661
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Internet Connection causes pings to fail

Post by fth0 »

CBCH wrote:Regarding the use of Intel Wireless-AC 9560, if it fixes the issue
No, it probably doesn't fix anything. My previous statement regarding the two Intel Wireless adapters was open to interpretation, and I've just amended it accordingly. What I meant to say was that although there are potential problems when bridging over wireless adapters, I don't expect them here because of the similarity of the two Intel Wireless adapters.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Internet Connection causes pings to fail

Post by scottgus1 »

Thanks, fth0, for the further comments. Version number counts, too, hmmmm... (headache begins) :lol:
CBCH wrote:I have finally fixed the issue, just adding another NAT adapter to my PFSense router
If you're doing this instead of adding the Bridged adapter, then it may be a good work-around, but it doesn't explain why adding the Bridged adapter killed ping. And the question of those several fully-connected and parallel networks between two VMs is still open. These might have contributed to the Bridged/ping confrontation, or may cause trouble later.
Post Reply