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 ( 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.
By that you mean i go to network setting for openwrt vm on virtualbox and set Adapter 1 to "bridge adapter" like this?
I immediately lost access to luci and cannot ssh to openwrt at 192.168.56.2 anymore.
I cannot guess:
- You have to explain how you're physically connected
- I also mentioned host-only
Not enough information
How did you have access before? (I understood that was the issue you wanted to resolve)
Why do you wish to change it?
If you had access, then it was setup correctly.
- Did you bridge LAN in OpenWrtto the other new interface - as I noted?
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.
It may also help if you actually answer - how many PHYs you really have.
1 - the windows machine. I don't have a dedicated router.
I'm really trying to follow but honestly I am new and some of what you say really doesn't make sense to me.
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 126.96.36.199- from the Windows machine
- Traceroute results to 188.8.131.52 from the the LuCI web GUI
To be clear - you setup Adapter 2 as bridged to the Ethernet/ISP, correct?
Currently it is NAT
Disregard. This was before you provided accurate information.
- Do not touch Adapter 1
- Fix Adapter 2 to connect to Internet
We're on Step 2.
- Does it work???
- Traceroute results??
(I don't understand why you told me it's NAT.)
If you mean you set VirtualBox's Adapter 2 "Attached To" setting as NAT instead of Bridged Adapter, fix this.
Then it's OK, correct?
What are you trying to fix, then?
Please provide both traceroute/tracert results for NAT.
(It's difficult when you don't provide all requested information in a single post.)
With adapter 2 as bridged, luci's traceroute returns "traceroute: can't connect to remote host (184.108.40.206): Network unreachable"
I can't upload 2 imgs as new user
If NAT is working - then it should be OK.
(Please follow posts.)
You don't have to take pictures. You can copy/paste. In any case, you still haven't provided the needed information.
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 [220.127.116.11]
3 9 ms 10 ms 9 ms 18.104.22.168
4 11 ms 10 ms 12 ms be-300-arsc1.seattle.wa.seattle.comcast.net [22.214.171.124]
5 12 ms 13 ms 11 ms 126.96.36.199
6 14 ms 12 ms 12 ms 188.8.131.52
7 11 ms 14 ms 13 ms 184.108.40.206
8 11 ms 10 ms 11 ms dns.google [220.127.116.11]
traceroute to 18.104.22.168 (22.214.171.124), 20 hops max, 46 byte packets
1 10.0.3.2 0.432 ms
Somehow I think your LAN and WAN interfaces are reversed on VirtualBox.
- In OpenWrt with default settings
- Adapter 1 should be LAN - connected to a host-only adapter. Windows should get it's IP from the OpenWrt
- Adapter 2 should be WAN - Bridged to the ISP thru your real PHY
This works in default OpenWrt.
If you loose connection, make sure both Adapter 1 and Adapter 2 are reset; and you get the correct IP from OpenWrt's LAN on the Windows machine. It is expected you will briefly loose connectivity while fixing this setting.
Is this what you want?
Even after restarting the openwrt vm with that setting and going to luci again, my traceroute is still "Network unreachable"
I also believe we need to clarify, are you by any chance thinking that I am asking how to get openwrt on virtualbox to connect to the Internet? If that's the case then it is not what I am asking. I follow the wiki's guide and have it working already. What I want to ask is how I can pass traffic on the host machine through openwrt on vm first (to apply vpn, QoS, etc.), instead of host machine going directly to internet regardless of openwrt.
I was thinking that indeed, my sincere apologies. Perhaps then, you should clarify the inquiry in your first post (because at least to me, that's exactly what you seem to be asking).
This requires connecting the OpenWrt router on VirtualBox to the Internet.
- What does this mean?
- How do you intend to go "through Openwrt" instead of the host machine going directly to the Internet - but also "regardless" of OpenWrt?
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.