To use LAN or to use LAN2 connection

Discussions related to using VirtualBox on Windows hosts.
Post Reply
Ricke_T
Posts: 9
Joined: 31. Aug 2012, 17:27

To use LAN or to use LAN2 connection

Post by Ricke_T »

Hello Folks

HOST win7 pro
VB 4.3.30
Any guest

I am connected to work through a VPN connection. If I disconnect from the work VPN, all of my VBs have internet connection. My IPCONFIG is looking at my local gateway and I have an internet connection. That happens to be LAN1.

Now when I connect to the VPN, the VB DNS server then looks at the VPN domain and gateway LAN2. I really don't want use that connection in the VPN at all for my virtualboxs. What I would to do is tell VB DNS manager to user LAN1.

I would assume it go something like this VBOXMANGE "MyVB" -DNS LAN1. Is there a way to tell VB which active network to use?

Thanks
Ricke
Martin
Volunteer
Posts: 2562
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: To use LAN or to use LAN2 connection

Post by Martin »

No, that is a restriction of your VPN server configuration. For security reasons many companies don't allow any other network traffic going to/from the Internet while the VPN is active.
Ricke_T
Posts: 9
Joined: 31. Aug 2012, 17:27

Re: To use LAN or to use LAN2 connection

Post by Ricke_T »

Yup, the company does not allow internet traffic through their VPN for very good reasons. That is not the issue. Vituralbox picks up the VPN LAN connection as the internet connection to use. I want to tell virutalbox to use my local internet connection not the VPN source.
Martin
Volunteer
Posts: 2562
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: To use LAN or to use LAN2 connection

Post by Martin »

It is not Virtualbox picking up the VPN LAN connection, it is the VPN software grabbing every data packet, even when it is coming from Vbox.
Ricke_T
Posts: 9
Joined: 31. Aug 2012, 17:27

Re: To use LAN or to use LAN2 connection

Post by Ricke_T »

Well that's odd... I had this issue last time I upgraded my VBs and I issued this command

VBoxManage modifyvm "VM name" --natdnshostresolver1 on

and then the internet started working aka being accessed from my host not the VPN. Any thoughts on that would be appreciated.
BillG
Volunteer
Posts: 5106
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: To use LAN or to use LAN2 connection

Post by BillG »

I would control that from the network settings in the host OS. If the host has two NICs you can easily configure it so that the host has exclusive use of one of them and the vms use the other.

On the NIC used by the host, clear the checkbox for VirtualBox Bridged Network Driver. On the NIC used by the vms, clear all checkboxes except the VirtualBox Bridged Network Driver.
Bill
Ricke_T
Posts: 9
Joined: 31. Aug 2012, 17:27

Re: To use LAN or to use LAN2 connection

Post by Ricke_T »

I should be able to tell vboxmanage to use 192.168.1.1 gateway instead of others that are listed

DNS Servers . . . . . . . . . . . : 10.212.10.170
10.212.10.171
192.168.1.1

I would assume so anyways...
Ricke_T
Posts: 9
Joined: 31. Aug 2012, 17:27

Re: To use LAN or to use LAN2 connection

Post by Ricke_T »

I've been tinkering with this with no luck either....
How to tell Windows 7 to use a different default network card ?
In the presense of multiple network adapters, it is sometimes necessary to manually specify which one is the default used for internet routing, for example. To accomplish this, you have to manually add a "metric" to each interface. Windows will automatically use the interface with a lower metric. To check and change your network adapters' metric:

1. Open Command Prompt and type: route print - you will see a list of active routes, the last column displaying their "metric". Lower metric routes are preferred over higher ones.

2. Open the Network Adapter Properties (Control Panel > Network and Internet > Network Connections > right-click on adapter and choose Properties)
3. Open the properties of Internet Protocol Version 4 (TCP/IPv4).
4. Click on Advanced.
5. Untick "Automatic Metric" and set the interface metric to a number.
6. Hit OK until you close the Network Adapter properties.
7. Repeat steps 2-6 for your other network adapter(s) choosing different metrics. Remember lower metrics are preferred over higher ones.

Check the new metrics in Command Prompt by typing: route print

ref: http://www.speedguide.net/faq/how-to-te ... efault-350
Ricke_T
Posts: 9
Joined: 31. Aug 2012, 17:27

Re: To use LAN or to use LAN2 connection

Post by Ricke_T »

I've also been tinkering with the port forwarding File\preferences\network

This is probably really wrong but I gave it a try anyways...

ipv4
name: Internet
protocol: tcp
host: 192.168.1.1
port 80
guest ip: 10.0.2.1
guest port: 80
Ricke_T
Posts: 9
Joined: 31. Aug 2012, 17:27

Re: To use LAN or to use LAN2 connection

Post by Ricke_T »

HA!! I got it ...

The order of the adapters made the difference. I switched my home adapter to be first and viola!! Internet works as described.

Here's the ref: https://levynewsnetwork.wordpress.com/2 ... on-choice/
Ricke_T
Posts: 9
Joined: 31. Aug 2012, 17:27

Re: To use LAN or to use LAN2 connection

Post by Ricke_T »

Basically what was happening, is VB goes out and grabs the first data connection in the ipconfig list. Since I have switched the order precedence according to my last post this is the result from ipconfig now ...

Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . : Home
Link-local IPv6 Address . . . . . :
IPv4 Address. . . . . . . . . . . : 192.168.1.101
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1
Ethernet adapter Local Area Connection 2:
Connection-specific DNS Suffix . : workdomain.com
Link-local IPv6 Address . . . . . :
IPv4 Address. . . . . . . . . . . : 10.26.255.4
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
Ethernet adapter VirtualBox Host-Only Network:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . :
IPv4 Address. . . . . . . . . . . : 192.168.56.1
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :

Prior to the reordering of data connections, the LAN2 connection was listed first from the ipconfig call. I do believe from my observation that VB when starting up goes out and grabs the LAN that is listed first in the order of precedence. In my case, my work CISCO VPN (LAN2) would get listed first in the ipconfig call. VB would grab that for the internet connection which would fail in my instance because the internet connection is shut off through the VPN.

My request would be, In VirtualBoxManager\File\Preferences\Network Add a tab related to the which LAN you would like to exploit in your virtual machines(VM). In my case, I would have 2 external LANs available. LAN(My home network) and LAN2(VPN). A checkbox to select your preferred LAN connection.

Hope to see this enhancement in a release coming soon!!

Farewell
Ricke
Post Reply