This post shows how to connect to USRP N2x0 from a Ubuntu guest OS inside Virtualbox running on a Windows host.

Host OS

Here we assume you have a secondary Ethernet card that is physically connected to the USRP N2x0.

First, in VirtualBox's configuration window, click the Network tab, and then Adpater 2. Leave Adapter 1 alone so that you still have Internet access inside the VM.

VirtualBox Network Configuration

In Attached to, choose Bridged Adapter so that the VM has direct access to the physical network adapter. Then in Name, choose the secondary NIC that is physically connected to the USRP.

Save the configuration and boot into the guest OS.

Guest OS

Inside the guest Ubuntu OS, make sure the network adaptor is visible.

$ ifconfig -a

You should see two Ethernet interfaces: one for the Adapter 1 which provides Internet access through NAT, and another for the Adapter 2 we just added. At this point, there should be no IP address assigned to the second interface. In my case, the two interfaces are enp0s3 (NAT) and enp0s8 (Bridged). Adapt the names accordingly for your setup in following instructions.

Next, assign an static IP address to enp0s8. The default IP address for USRPs are usually 192.168.10.2, so we set the IP address for enp0s8 to be in the same subnet.

$ sudo ifconfig enp0s8 192.168.10.1

Then, add a static route so that all packets in 192.168.10.0/24 subnet is routed via the enp0s8 interface.

$ sudo ip route add 192.168.10.0/24 dev enp0s8

Make sure that the newly added route is recognized by the kernel (the last line of the following output).

$ ip route
default via 10.0.2.2 dev enp0s3  proto static  metric 100
10.0.2.0/24 dev enp0s3  proto kernel  scope link  src 10.0.2.15  metric 100
192.168.10.0/24 dev enp0s8  proto kernel  scope link  src 192.168.10.1

Finally, bring up the interface and ping the USRP!

$ sudo ifconfig enp0s8 up
$ ping 192.168.10.2
$ uhd_find_devices

You should receive ping responses and uhd_find_devices should be able to find the USRP devices.