Routing traffic from Windows host machine to OpenWrt on Virtualbox

I have Openwrt up and running on Virtualbox on a Windows machine, connected to the modem by ethernet. This means that I do not have a physical router, only a virtual one on Virtualbox. Is there a step by step guide I could follow to route my internet traffic on that Windows machine through the virtual router?

You simply set the network card connected/attached to LAN as a Bridged Interface in VirtualBox (:spiral_notepad: LAN is usually the first interface defined in OpenWrt, WAN is second). The Windows machine should get an IP automatically, as usual.

If you don't wanna use or don't have a second PHY, you can use the Host-Only Adapter (it can be added to a br-lan, but that gets more complex).

It's really out of the scope of OpenWrt on how you connect to the PHYs - but I hope that give you 2 simple methods.

Adapter 1 was originally Host-only adapter. I changed it following your advice, hopping it would route my windows machine traffic through openwrt.

You didn't follow my advise it seems, then.

So you would bridge a new adapter and the host-only. This is done in OpenWrt.

:spiral_notepad: It may also help if you actually answer - how many PHYs you really have.

Understood.

:+1:

So it was already working, then?

(You failed to mention Windows already had LAN access and IP from the OpenWrt on a host-only adapter.)

Can you provide the results of:

  • tracert 8.8.8.8 - from the Windows machine
  • Traceroute results to 8.8.8.8 from the the LuCI web GUI

Thanks.

:spiral_notepad: To be clear - you setup Adapter 2 as bridged to the Ethernet/ISP, correct?

Screenshot_20230206-063822_Samsung Internet

host:

over a maximum of 30 hops:

1 13 ms 19 ms 14 ms 10.61.242.195
2 9 ms 8 ms 8 ms po-316-316-rur402.bellevue.wa.seattle.comcast.net [24.153.84.165]
3 9 ms 10 ms 9 ms 96.216.61.61
4 11 ms 10 ms 12 ms be-300-arsc1.seattle.wa.seattle.comcast.net [24.124.128.89]
5 12 ms 13 ms 11 ms 50.222.176.214
6 14 ms 12 ms 12 ms 142.251.50.41
7 11 ms 14 ms 13 ms 142.251.55.201
8 11 ms 10 ms 11 ms dns.google [8.8.8.8]

luci:
traceroute to 8.8.8.8 (8.8.8.8), 20 hops max, 46 byte packets
1 10.0.3.2 0.432 ms
2 *
3 *
4 *
5 *
6 *
7 *
8 *
9 *
10 *
11 *
12 *
13 *
14 *
15 *
16 *
17 *
18 *
19 *
20 *

1 Like

If the first boot of an x86 install only finds one eth adapter, it will not create a wan network interface. In that case you would need to create one manually and attach it to the second adapter. The name should be exactly 'wan' (lower case) -- that name is already in the default firewall--, the protocol DHCP Client, and the Device eth1 or whichever virtual port is bridged to the cable modem.

2 Likes

Here is an online screenshot from a VirtualBox forum - you should see an interface on Windows that you can select for Adapter 1 - it is named "VirtualBox Host-Only Adapter".

  • Second, I have to test bridging an ISP on a Windows host. In other OSes it's possible to use a and enabled PHY but not assign addresses, etc.

That may take a few days, as I don't simply have Windows machines running VirtualBox. Feel free to simply review the steps and instructions already given.

Here they are in linear form:

  • On a default install of OpenWrt with 2 adapters
    • Adapter 1 LAN - "VirtualBox Host-Only Adapter"
    • Adapter 2 WAN - bridged to Comcast

(At this point you should have internet connectivity thru OpenWrt, I would need the results of all traceroutes as requested previously to assist in troubleshooting. At minimum, you should be able to access the OpenWrt's web GUI at the LAN IP.)

Also, feel free to ask the VirtualBox forum in the meantime - if you prefer. It may be better to inquire with them for an advanced PHY setup. :wink: After it's setup, you can always inquire about VPN, QoS, etc.

OK, I have setup the device and had success:

I followed these steps:

Notes:

On the VirtualBox Host-Only Adapter:

  • In VirtualBox, I disabled DHCP server

Untitled

  • On Windows, I changed to the following:

On the Ethernet connected to Comcast:

  • In Windows - I disabled IPv4 (you may wish to disable IPv6 too)
    Untitled4

From Windows:

C:\Program Files\Oracle\VirtualBox>tracert 8.8.8.8

Tracing route to dns.google [8.8.8.8]
over a maximum of 30 hops:

  1    <1 ms    <1 ms    <1 ms  OpenWrt.lan [192.168.1.1]
  2    <1 ms    <1 ms    <1 ms  xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx]
  3     1 ms     1 ms     1 ms  xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx]
  4     2 ms     2 ms     2 ms  xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx]
  5     3 ms     2 ms     2 ms  xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx]
  6     3 ms     3 ms     3 ms  xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx]
  7     3 ms     3 ms     3 ms  xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx]
  8     9 ms     9 ms     9 ms  xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx]
  9     9 ms     9 ms     9 ms  xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx]
 10     8 ms     8 ms     8 ms  xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx]
 11     9 ms     9 ms     9 ms  xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx]
 12    11 ms    11 ms    11 ms  xxx.xxx.xxx.xxx
 13     9 ms     9 ms     9 ms  xxx.xxx.xxx.xxx
 14    12 ms    11 ms    11 ms  xxx.xxx.xxx.xxx
 15    12 ms    11 ms    11 ms  dns.google [8.8.8.8]

Trace complete.

From OprnWrt:

traceroute to 8.8.8.8 (8.8.8.8), 20 hops max, 46 byte packets
 1  xxx.xxx.xxx.xxx  0.661 ms
 2  *
 3  *
 4  *
 5  *
 6  *
 7  *
 8  *
 9  *
10  *
11  *
12  *
13  8.8.8.8  9.426 ms

Hope this helps. If you have issues or inquires, please include details.

WAN has no connection.

  • Verify adapter 2 settings in VirtualBox.
  • And Ethernet setting in Windows Network Configuration.
  • Responding with details helps
  • You seem to be screen shoting well with the phone :+1:

:warning: (this is advanced, it's assumed you know how to troubleshot this yourself)

Please understand that I can only post 1 img at a time as a new user.
You are asking for this ethernet adapter correct?

1 Like

I will try again in that order then.

2 Likes

I fear this is the problem:

Step 1:

  • You can try to
    screen466

ALLOW and reboot


Step 2:

If don't work:

(EXPERIMENTAL and theoretical why might work:)

  • Get real MAC of 9900 from Windows settings
  • Copy
  • Put that MAC here - using format here:

screen467

:warning: (Do not screenshot that real MAC)

1 Like

I chose "allow all" and followed the order. Nothing changed.
For mac address, i typed "getmac" in cmd and get 5 result. None of them begins with 9900 but there is one that is xx-xx-99-00-etc.


It is the N/A one.
Do i paste it in the adapter 2 mac address in virtual box?

1 Like

Hello, I've been following the thread as it occurred and just out of curiosity. This ISP modem of yours with only one port... what is the brand and model number?

Putting Virtualbox and OpenWrt on the back burner for a minute, with your Windows network adaptor re-adjusted to defaults.. and thinking in hindsight.

The Corechip SR9900 usb to ethernet adaptor connected as it is to the Modem and your PC, and everyone rebooted, you should have internet connection through the dongle (Corechip).

This is testing the Modem and Corehip relationship.

Can you access the Modem via its IP into it's management web interface and confirm the MAC of the connected Corechip?

1 Like

With that information, if you can not get this to work with @lleachii tut, then search for help on the forum of the software you're using as Virtualbox.

3 Likes

Tracing route to dns.google [8.8.8.8]
over a maximum of 30 hops:

1 <1 ms <1 ms <1 ms OpenWrt.lan [192.168.1.1]
2 21 ms 17 ms 16 ms 10.61.242.195
3 12 ms 9 ms 12 ms po-316-316-rur402.bellevue.wa.seattle.comcast.net [24.153.84.165]
4 13 ms 9 ms 12 ms po-400-xar02.bellevue.wa.seattle.comcast.net [96.216.61.61]
5 13 ms 10 ms 11 ms be-300-arsc1.seattle.wa.seattle.comcast.net [24.124.128.89]
6 14 ms 14 ms 13 ms 50.218.57.26
7 15 ms 12 ms 12 ms 142.251.50.41
8 12 ms 13 ms 12 ms 142.251.55.197
9 11 ms 13 ms 12 ms dns.google [8.8.8.8]

Trace complete.

traceroute to 8.8.8.8 (8.8.8.8), 20 hops max, 46 byte packets
1 10.61.242.195 20.325 ms
2 24.153.84.161 10.095 ms
3 96.216.61.61 9.014 ms
4 96.216.61.61 7.233 ms
5 50.222.176.214 10.078 ms
6 50.222.176.214 11.572 ms
7 8.8.8.8 11.955 ms

Thank you for everything, especially for patiently supporting me!!!

1 Like

No clue why you did this.

I literally warned in the post above:

  • Re-enabling IP and setting it to somehow share that interface does just that.
  • That turns on another DHCP server - which can cause a conflict
  • It would enable another network on that interface, causing a conflict

You never mentioned this during setup - and I asked if you had other adapters.

  • You don't describe what kind of connection, so it's difficult to assist
  • Most desktop/laptop WiFi chips wont behave as an Access Point anyways

No clue what this means. It seems like you're just mentioning other network connections after a completed setup. As I noted above, if you connect them to the VirtualBox Host-Only Adapter, they will connect with an IP and have Internet.

:spiral_notepad: Perhaps you should consult the VirtualBox forum for issues such as this. You have Internet thru the OpenWrt, so I'm not sure how much assistance we can provide.

1 Like
  • I don't know whybtheres a separate WiFi setup in OpenWrt but OK.

Since this is VirtualBox-related, you may wish to ask them. I'm only familiar with USB WiFi adapters.