Converting a surplus x86 into an OpenWrt router

Yes, I just read that in the article. I'm still not sure how to ssh yet. Is this something I can do working the Brix x86 router I'm building through a live usb or do I need to connect it to my existing network somehow first. I am new at this.

One issue is how does LEDE decide which interface is LAN and which is WAN on your system. Ideally what you do is plug your Brix's LAN interface into a switch, and plug a laptop into that switch, then tell the laptop get a DHCP address, which the Brix will hand out in the range 192.168.1.x then you simply go on your laptop and do:

ssh root@192.168.1.1

or you connect to luci using a web browser at:

http://192.168.1.1/

From there you can first set a password and then turn on wifi and make other modifications to settings.

Yes, you'll have to connect it to a wired network, unless your device has a serial port that is recognized as a console.

The default IP address for a "fresh flash" is 192.168.1.1/24, so you'll need to configure one of your "desktop" interfaces to have an IP address in that range, perhaps as an alias. Your choice of clients will depend on the OS your desktop is running. Linux/BSD variants generally come with ssh installed, as does macOS. Windows, as I understand it, generally needs to have an appropriate app installed.

1 Like

The complication though is that the Brix only has one built in LAN device, and maybe has a USB LAN device plugged in, and so I'm not sure where it thinks LAN is by default.

I think what I'd do to start is boot it with the USB ethernet connected, and then plug BOTH the ethernet devices from the Brix into the switch. Whichever one is LAN will respond to your DHCP request, and then once you're in to LuCi you can try to figure out which one is LAN and which is WAN by fooling around.

1 Like

I do have the USB lan device.

Ok, then definitely plug in the USB device, plug both ethernet interfaces into your switch, reboot the machine so it sees the USB one at boot time, and with a laptop/desktop also plugged into the switch, try to get a DHCP address for the laptop and then connect to http://192.168.1.1 and log in first time, set a password and try to figure out which device is the LAN one. You can do this by unplugging one ethernet cord and seeing if you can still get LuCi on the http://192.168.1.1 if you can, whatever is still plugged to the switch is "LAN" and if you can't whatever you unplugged is LAN.

1 Like

It's working! So far I have determined that the built in ethernet connection in the back of the Brix is eth0 and I can get to configuration with laptop. If I unplug from that and restart plugged into the USB device it doesn't work. So that means wan = usb, lan = eth0 right?
I'm still not using internet. I have Brix connected to unmanaged switch, laptop connected to switch. I'm sure there is a lot of setup needed as well as updates, etc before I can try replacing my existing router with the Brix router. I need to know it will work so my family doesn't revolt... Lol. Is there anything I can do to get Brix ready while it is setup this way before I put it in my home network replacing my other router?

2 Likes

I'll often try out a "new" router that uses DHCP on the "WAN" side by making sure its "LAN" addresses and its SSID(s) are different than the "live" router like this:

ISP Modem <---> WAN - live router - LAN <---> WAN - new router - LAN <---> test machine

There's still the chance that your ISP "locks" DHCP to a specific MAC for an annoying long period of time, but it at least helps in making sure that the new router is doing what you expect.

Of course, keeping your "old" router ready for a quick swap-in is a good idea too :wink:

LEDE/OpenWRT is reasonably secure out of the box, the things at a minimum i'd do are:

  1. Set a root password.
  2. Change the hostname of the router itself
  3. Change the SSID to what you want to use, and set a wifi password, enable wifi (assuming you're planning to use the brix itself as a wifi access point, which you might or might not be doing, and might not even be possible, it's fine to be "just" a wired router)
  4. Install and set up SQM with piece_of_cake

Once you've done those things you probably have a functional set up for testing, and of course there's always lots of additional stuff to consider, like second SSID for guests or IoT devices or tuning your SQM for use with games or the like but they can come later.

You can use @jeff's suggestion, which basically means telling your new router to use a different subnet than 192.168.1.0/24 if your existing router is also using that subnet. If your existing router uses a different subnet then you can already just plug your new brix into the existing router.

But, you can also just swap out your old router for the new one for a few minutes when no one is needing the internet and try it out... as long as your old router is still there to swap back into place. This may require you to re-start the ISP provided equipment to unlock the MAC address... or some other such jiggery-pokery.

1 Like

Drivers for USB devices are not included in standard builds. You will need to identify the driver that your device needs, then temporarily connect to the Internet through the LAN and install it.

The ifconfig -a command needs to show two eth devices before you can set up routing with both ports.

1 Like

Is this true for x86 builds? Also getting connected simultaneously to the router and the router to the internet seems... Tricky, possibly requiring a vlan capable managed switch. Best bet is probably connect laptop to internet, download all pkgs needed, then connect laptop to router and scp them over to install, then you can get USB WAN device going and download any other pkgs directly

Yes sir, your right. Adapter does not show up. I have br-lan, eth0 & lo. I did figure out ssh into Brix router with putty. You guys have been so helpful. I'll find out which drivers I need for the usb.

Cannot figure out what driver I need for the TP-LINK UE300 USB dongle. I'll try again in morning. I'm having a great time by the way.

From the source code, I would say that the driver is located in the kmod-usb-net-rtl8152 package, but your USB NIC is only supported in the OpenWrt snapshots, not in the stable LEDE 17.01 releases yet.

If you have to install snapshots you won't get LuCi out of the box. But if you get the USB dongle at least you will be able to have WAN and opkg install it.

To simplify the installation of LuCI or the USB network driver, you might want to temporarily set up internet access for the brix through its LAN interface, as suggested by @mk24. Here's a rough guide how to do that.
Give the brix a unique IP address from your existing LAN, and set the default gateway to the LAN IP address of your current router. For example (adjust as needed):

uci set network.lan.ipaddr='192.168.?.?'
uci set network.lan.netmask='255.255.?.?'
uci set network.lan.gateway='192.168.?.?'
uci set network.lan.dns='8.8.8.8'
uci set dhcp.lan.ignore='1'
reload_config
# your ssh session is expected to hang here, you can close it

Now connect the LAN side of your current router to your unmanaged switch, in addition to the brix and your PC. Update your PC's network config with ipconfig /renew, and check if the brix is reachable again under the new IP address you assigned to it.
Install packages, check if your USB dongle works and adjust the configuration. Once you are done setting up the router, and before you try it 'live', you should undo its temporary configuration, for example by rebooting.

Maybe you could recommend a dongle that will work with the stable version. I've been looking for an hour. I find it hard to locate documentation that is relevant to what I need.... Or I guess I could start all over with a snapshot.

If you take this route, I recommend also downloading the whole packages/ subdirectory next to the snapshot image file, using a tool such as rsync. This allows you to install more kernel modules later, since they are not compatible between snapshots.

1 Like

I am willing to try whatever I need to do.... All great suggestions. You guys would know better then me. But is there a usb-adapter that would work out of the box with a stable version of openwrt?

Out of the box it sounds like you always need to add the appropriate kmod package, but I'm sure there is a USB Ethernet adapter which works with the stable release... I just don't know which one it is.

EDIT: amazonbasics usb3 item supposedly in mainline Linux since 3.x kernel so would probably do the job.

A new stable release is on the way soonish, and should work with your existing adapter. Perhaps just try a snapshot, and grab the packages dir as mentioned.