I'm experimenting with OpenWrt on VirtualBox. So here is what I have:

  • openwrt VM
    • Adapter 1 is bridged. Gets 192.168.1.x address from my actual router.
    • Adapter 2 is local network "openwrt-lan". Configured as static bridge.
  • Debian VM
    • Adapter 1 is local network "openwrt-lan". Configured with DHCP.

My /etc/config/network files is like this:

config interface 'loopback'
    option ifname 'lo'
    option proto 'static'
    option ipaddr ''
    option netmask ''

config interface 'wan'
    option proto 'dhcp'
    option ifname 'eth1'

config interface 'lan'
    option ifname 'eth0'
    option proto 'static'
    option ipaddr ''
    option netmask ''

Now Debian VM gets address successfully and can see as far as openwrt. Routing table are like this:

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         OpenWrt.lan         UG    0      0        0 eth0
link-local      *          U     1000   0        0 eth0     *        U     1      0        0 eth0


# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
search lan

However, it can't see beyond openwrt. tracert shows that the traffic stops at the openwrt router.

A strange thing also is that on the openwrt VM eth0 doesn't have an IP despite the above configuration. Not sure if it's related.

Any input appreciated.

  • Can the openwrt VM get to the internet? – heavyd Feb 19 '14 at 15:08
  • @heavyd Yes. ping and nslookup works fine with internet host. – lang2 Feb 19 '14 at 15:10

The reason why this is not working is that this is a hybrid setup, because it uses a DHCP which is inside VirtualBox, and is unrelated to OpenWrt.

In the wild (lol), your Debian VM would receive an IP from the OpenWrt router, and, together with it, it would also receive information necessary to setup a proper routing table. But in your simulation, the Debian VM has so far no direct interaction with the OpenWrt router: it does not receive an IP address from it, nor a default gateway.

You can remedy the situation by treating the Debian VM as if it had a static IP: so, after bringing the NICs up and assigning them an IP address, you also have to manually setup the routing table and the DNSs servers: on the Debian machine, issue

   sudo ip ro add default via dev eth0

if your OpenWrt router has IP address and the Debian NIC is called eth0, otherwise change accordingly. Then add the following two lines to the bottom of the file /etc/resolv.conf:


and it should now work.

  • The debian vm does get an address from openwrt – lang2 Feb 19 '14 at 23:13
  • @lang2 How about routing table and DNS servers? Are they set correctly? – MariusMatutiae Feb 20 '14 at 4:06
  • question updated with routing and dns info. – lang2 Feb 20 '14 at 13:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.