Here is a long guide on how I got my ModDuo (and also connected my ModDwarf in later comments) directly connected via USB cable to my OpenWrt router’s USB port with its USB ethernet bridged to the rest of my home LAN network with custom static ip. Make sure you know what your are doing. At the end of it, I’m able to access my mod from its new static ip address from any computer in my LAN, and my mod can access and is accessible to the outside internet.
Step zero is make sure you don’t have anything important to do with your router or ModDuo because you can easily risk bricking them. So make sure you know how to do a factory reset on both incase you misconfigure some interface and loose the ability to ssh. At this point install OpenWrt on your router if it isn’t already installed. Also I would recommend upgrading to the latest version of OpenWrt and upgrading all existing installed packages.
1. Install appropriate USB Ethernet driver in OpenWrt
Unfortunately, the initial configuration of OpenWrt does not automatically detect the ModDuo as a USB device. It doesn’t even have the ability to lsusb so show plugged in usb devices. So first need to install “usbutils” package. Packages can be installed by logging into your router’s LuCI web interface and mousing over “System” and clicking “Software” or by ssh’ing into it…see OpenWrt’s docs on how to install packages, but the command to install usbutils for me was:
opkg install usbutils
Now when I type lsusb -t
without the ModDuo plugged in, I see a list of the usb hubs in my Netgear WNDR3800 router
root@OpenWrt:~# lsusb -t
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ohci-platform/2p, 12M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-platform/2p, 480M
At this point, plug in your ModDuo via USB into your OpenWrt router’s usb port. I ran lsusb -t
again to see what changes in that list so I know how the ModDuo is identified:
root@OpenWrt:~# lsusb -t
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ohci-platform/2p, 12M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-platform/2p, 480M
|__ Port 1: Dev 3, If 0, Class=Communications, Driver=, 480M
|__ Port 1: Dev 3, If 1, Class=CDC Data, Driver=, 480M
The ModDuo presents those last two usb devices when plugged in. It turns out that second one of those (of Class “CDC Data”) is the ModDuo’s USB ethernet device.
Unfortunately typing ip addr
didn’t reveal any existing USB ethernet interface. That is because there wasn’t an appropriate usb driver installed. First I installed kmod-usb-core “Kernel support for USB” and 'kmod-usb2" but that still didn’t work. After a bit of searching the packages and trying several (kmod-usb-ehci kmod-usb-net kmod-usb-ohci kmod-usb-uhci) I installed kmod-usb-net-cdc-ether “Kernel support for USB CDC Ethernet devices”, which seems to be the essential driver, because then when I typed ip addr
a new interface appeared called usb0, which was the ModDuo. The short command to install that is:
opkg install kmod-usb-net-cdc-ether
2. Configure a bridged interface in OpenWrt connecting the ModDuo’s USB to the rest of your LAN
My starting point in OpenWrt was I already had created a bridged interface called “br-lan” which connected my router’s wireless interfaces with its wired ethernet interface. (I can’t recommend on the exact way to setup your bridged interface, so the exact setup will be different depending on your lan). So if you don’t have a bridged interface in OpenWrt then create one (or if you already have a bridged interface that connects your wireless to ethernet, edit it) in LuCI by mousing over the “Network” tab and clicking “Interfaces”, and either clicking “Add new interface” (or clicking edit on your existing bridged interface). For me, I set my OpenWrt with a static ip address 192.168.1.9 because my ISP router uses the 192.168.1.xxx subnet, and put my ISP’s router’s local ip address 192.168.1.254 as the gateway, so my general settings tab looks like:
In the “Physical Settings” tab I have the “Bridge interfaces” box checked, and added my ModDuo’s USB device (which for me appears as usb0) to it by clicking “Interface” drop-down menu and checking the box next to usb0 (along with the regular wired ethernet and wireless interfaces I wanted to bridge). The exact setup of the bridge might differ based on how your router is setup, but for me I set it up like:
3. Change ModDuo’s static ip to be in the same subnet
At this point they are all one interface that is virtually bridged together, but the ModDuo’s factory setting for its static ip address of 192.168.51.1 was not reachable because it it outside my 192.168.1.xxx subnet. I suppose it could be possible to setup dhcp on the mod so that it gets automatically assigned an ip address by whatever dhcp server you use, though I didn’t want to bother doing that as I prefer static ip addresses anyway so I can remember their address.
Before changing it, first make sure your dhcp server only uses a subset of ip addresses in the local net, so that there is a range of static ip’s available to pick from to give your Mod a permanent static ip. (I personally keep a low range like from 192.168.1.1 to 192.168.1.20 to be for static ip’s only, and leave higher range for dhcp).
Then decide on a number in that static range to use for your mod…I decided on 192.168.1.2 to be my Mod’s static ip.
Now take a deep breath because it is possible to screw up setting the static ip and loosing ssh access to your mod…so again please make sure you are careful and know what you are doing and know how factory reset your mod if you screw up.
First unplug the mod’s usb from your router and plug it into your computer.
Then ssh into it with its factory default static ip:
ssh root@192.168.51.1
Then make the filesystem writable:
mount / -o remount,rw
Then setup your custom static ip address like this guide but using your desired static ip as replacement. So because I wanted to change from 192.168.51.1 to 192.168.1.2 I ran:
sed -i "s|192.168.51.1|192.168.1.2|" /etc/dnsmasq.conf /etc/network/interfaces /etc/ssh/sshd_config
sync && mount / -o remount,ro && sync && reboot
(At this point you might have lost the ability to easily ssh when the mod is directly connected into your computer, which is why you need to be careful and which is why I got the OpenWrt USB ethernet driver and bridge setup first)
Unplug your mod from your computer and now plug it back into your OpenWrt router’s USB port. If everything was done correctly, then hopefully you should be able to access the mod (both via web and ssh) at it’s new static ip address, from any computer on your LAN.
4. Expose ModDuo to outside internet
On last trick I did was give my mod duo access to the outside internet by updating /etc/network/interfaces
to include the gateway for my ISP’s router. So first ssh into my mod via the new ip static ip address
ssh root@192.168.1.2
And vi /etc/network/interfaces
to append a tabbed line at the end with gateway $YourGatewayIP
which since my gateway is 192.168.1.254 that file now looks like:
auto lo
iface lo inet loopback
allow-hotplug usb0
iface usb0 inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.254
And after I rebooted my mod, I’m now able to ping google or any other ip address in the internet.
At this point if you really wanted to access your ModDuo from outside your home LAN you could edit your ISP’s router’s port forwarding setup to route incomming packets with whatever particular ports you wanted to your ModDuo. For instance, if you wanted to to view the web interface from outside your home LAN you would forward port 80 to to your mod’s static ip, or maybe you want to access via netJack, so maybe you would forward port 19000 (though I haven’t tried this). I intend to figure out how to get JackTrip working in my ModDuo now, so I can jam with it directly on the internet.