After attempts at buying a GPS-equipped cellular router for a vehicular communications project fell through, I spent the weekend trying to find an alternative based on a standard Ethernet router. The process uncovered lots of new and poorly documented tasks so I hope my notes will save someone else a whole heap of time and frustration.
There are lots of OpenWRT 'Software' do the bandwidth per IP job. Google search those: eqos (tested working), luci-app-nft-qos (tested working, active development, per MAC supported), qosv4(a tomato firmware shaping per IP merge, works on older version of WRT) All those come with nice web GUI so don't need to bother setup of script / config files etc. OpenWRT Mac OSX SDK & Toolchain. No Comment in General by merturk 2016. OpenWRT (trunk version for x86) and Carambola2 (v2.8) SDK and Toolchain development binaries.
My first target was the Asus WL-500GL, after reading of success with oleg's firmware and gpsd. Unfortunately, combing all the local electronic retailers in my city (Newcastle, Australia) for Asus routers turned up only strange looks and zero routers. In desperation I found that the Linksys WRT54GL was a possibility, having good support for OpenWrt and at least one available serial port. However, to my dismay I found hundreds of WRT54G2, which despite the similar name, lack critical features that the unavailable WRT54GL sports.
Of the routers that were actually available, the only remaining glint of hope I found was in the D-Link DIR-615. The OpenWrt docs claim support for the C1 model, but the closest I could find was C2. Options were running dry fast, so I took the plunge on the C2 model.
Setup was straightforward. The router bag was sealed with large sticker and plenty of warnings that the software from the CD must be installed before connecting the router. I ignored them. I don't have a Windows machine handy and the CD only contains a compressed installer image. With the router up and running, it was time to create the build environment.
I'm running Mac OS X 10.6.3 (Snow Leopard) with the Developer Tools installed. I'll indicate commands for the host terminal with the prefix '$' and commands for the router terminal with the prefix '%'.
I used MacPorts to get some dependencies:
coreutils installs fileutils and findutils installs the GNU version of find, necessary when creating the build images.
The build system requires a case-sensitive filesystem, so I used Disk Utility to create a 4GB (yes, >3GB to compile sources!) Mac OS Extended (Case-sensitive) disk image, then used terminal to navigate to it.
I checked out the OpenWrt trunk source. I actually spent the first 6 hours working with the 8.09 branch (as suggested by the compatible hardware list) but found many problems, including lack of DIR-615 profiles, file too big problems and linker errors 'Nonrepresentable section on output'. So I switched to trunk and everything started to work. For what it is worth, I pulled trunk on the 4th April, 2 days after Backfire 10.03-rc3 was posted.
If make prereq succeeds, it may run menuconfig automatically. In any case, once I was in menuconfig I had to be very careful not to press an arrow key! It appears the arrow keys aren't escaped properly, and generally cause menuconfig to quit. Instead, I navigated using the accelerators, enter, esc, plus, minus, 'y', 'n' and spacebar.
I used menuconfig to:
* Change Target System to Atheros AR71xx
* Change Profile to D-Link DIR-615 C1
* Change Target System to Atheros AR71xx
* Change Profile to D-Link DIR-615 C1
To save the config I pressed Esc from the main menu and then Enter to select 'Yes'. Then I built the configuration:
This took around 30 minutes on a 2.8GHz Intel Core 2 Duo. Once it was complete, my bin/ar71xx directory contained the following (preceded by file size):
3866648 openwrt-ar71xx-dir-615-c1-squashfs-factory.bin
2555908 openwrt-ar71xx-dir-615-c1-squashfs-sysupgrade.bin
2752512 openwrt-ar71xx-root.jffs2-128k
2621440 openwrt-ar71xx-root.jffs2-64k
1703936 openwrt-ar71xx-root.squashfs
1646596 openwrt-ar71xx-root.squashfs-4k
2005637 openwrt-ar71xx-rootfs.tgz
1183055 openwrt-ar71xx-uImage-gzip.bin
852722 openwrt-ar71xx-uImage-lzma.bin
2619896 openwrt-ar71xx-vmlinux.bin
2686288 openwrt-ar71xx-vmlinux.elf
1245184 openwrt-ar71xx-vmlinux.gz
917504 openwrt-ar71xx-vmlinux.lzma
2555908 openwrt-ar71xx-dir-615-c1-squashfs-sysupgrade.bin
2752512 openwrt-ar71xx-root.jffs2-128k
2621440 openwrt-ar71xx-root.jffs2-64k
1703936 openwrt-ar71xx-root.squashfs
1646596 openwrt-ar71xx-root.squashfs-4k
2005637 openwrt-ar71xx-rootfs.tgz
1183055 openwrt-ar71xx-uImage-gzip.bin
852722 openwrt-ar71xx-uImage-lzma.bin
2619896 openwrt-ar71xx-vmlinux.bin
2686288 openwrt-ar71xx-vmlinux.elf
1245184 openwrt-ar71xx-vmlinux.gz
917504 openwrt-ar71xx-vmlinux.lzma
External links disclaimer blogs.systweak.com website may contain links to external websites that are not provided or maintained by or may not be in any way affiliated with Systweak Blogs Please note that the Systweak Blogs does not guarantee the accuracy, relevance, timeliness, or completeness of any information on these external websites.Keep in mind that we may receive commissions when you click our links and make purchases. However, this does not impact our reviews and comparisons. Systweak Blogs reserves the right to make additions, deletions, or modification to the contents on the Service at any time without prior notice. Utility programs for mac. Systweak Blogs does not warrant that the website is free of viruses or other harmful components.
And I was ready for the first flashing. This is where things get nervous. It turns out the DIR-615 has a ~200KB boot space reserved for the boot loader and the flash image takes up the remaining 3.8MB. That should make it pretty hard to brick the router, and I didn't have any problems, but you never know.
After mucking around with the router's 'emergency upgrade flash' mode (accessed by holding the reset button for 30 seconds until power light flashes amber) for a couple of hours, trying all manner of hardware IDs, I gave up and used the D-Link web interface instead. Under Tools there should be a 'Upgrade Firmware' link. I used this, uploaded 'openwrt-ar71xx-dir-615-c1-squashfs-factory.bin' and away it went!
In just 14 hours I had OpenWrt running on the DIR-615!
To restore access to the router I set my network settings to manual IP 192.168.1.100, then logged in:
I changed the lan option ipaddr to 192.168.0.1 so it didn't clash with my existing network.
Remember to change manual IP to 192.168.0.100 to suit new subnet.
And we're in! The router automatically picked up a WAN address from my ADSL modem and everything worked as expected. I even tried commenting out 'open disabled 1' in /etc/config/wireless and found that wireless worked without a hitch.
With the default OpenWrt kernel installed I was able to run opkg to install gpsd which worked well. In order to test the system however, I really needed some more software. At first I investigated modifying the gpsd package to include gpsfake, but after discovering that it requires python which is a large package itself, I decided to include my own software instead.
I found the easiest way to include my own software was to create a basic package and stick it in trunk/package:
Most of the packages actually download their source from the Internet, but a neat trick in the package Makefile allows the source to be included locally. My Makefile looks like this:
The src directory then, contains a simple c source file and a very small Makefile. Both can be developed in the native host environment before including in OpenWrt.
While I was adding software to the kernel image, it made sense to add gpsd as well.
Adding the uclibc++ dependency now saves a lot of wasted time later!
menuconfig automatically picks up the new packages:
This time I entered Network and hit 'y' for gpsd and gpssim. I also entered Libraries and noted that uclibc++ had been added as a required build. Esc and Enter to exit and save menuconfig.
This time the openwrt-ar71xx-dir-615-c1-squashfs-factory.bin image was created with the extra packages included. Now how to flash the new image, since we've lost the D-Link web interface? At first I tried many permutations of mtd after deciphering /proc/mtd and dmesg, but couldn't get past this:
So I tried tftp instead:
At this point I power cycled the router and immediately began issuing this command over and over again:
Eventually the 'sendto: No route to hose' message doesn't come back, and the following appears instead:
The router then automatically reboots and loads the new firmware. It also resets itself to 192.168.1.1, so to get it back I switched my manual IP to 192.168.1.100 and then:
Change ipaddr back to 192.168.0.1…
Change manual IP back to 192.168.0.100…
And we're done! A working OpenWrt install complete with custom software, ready to try to get gpsd to work. The first thing I did was add enable gpsd at boot by creating /etc/init.d/gpsd with the following contents:
So far I've done some preliminary tests to find and enable the serial port. I've found that the 4 vias near the bottom left of this photo are likely serial suspects.
The top via is ground, the next two are Rx and Tx (I'll check which is which using an oscilloscope tomorrow) and the bottom is 3.3V. I've confirmed I can send and receive data (albeit, unreliably) via this interface by sticking a paper clip between the middle two vias, running '% cat < /dev/ttyS0' in one session and 'echo 'Hello, world!' > /dev/ttyS0' in another.
What remains is to dump the information I've found about this router for Google fodder and also in case someone wants to update the wiki!
* Another shot of the internals appears below, but the FCC also have photos from their tests on their website.
* It turns out the C2 hardware version I have actually has a circuit board with C1 stamped on it inside. So I do not know what the difference between C1 and C2 is.
* Filesystem:
* cpuinfo:
* Chips on board:
** AR9130-BC1E
** W9425G6EH-5: 4M, 16 BITS DDR SDRAM (there seems to be confusion about 4MB/8MB - it only has 4MB but each location is 16 bits)
** AR8216: Ethernet switch
** MX25l3205: 32Mbit CMOS Flash (RAM and FLASH sizes are reported backwards in some docs)
** RT9183H: Linear Regulator
** AR9130-BC1E
** W9425G6EH-5: 4M, 16 BITS DDR SDRAM (there seems to be confusion about 4MB/8MB - it only has 4MB but each location is 16 bits)
** AR8216: Ethernet switch
** MX25l3205: 32Mbit CMOS Flash (RAM and FLASH sizes are reported backwards in some docs)
** RT9183H: Linear Regulator
* The router comes with DIR-615_3.01-tomizone-1.0.2 firmware. This version does not appear to be on ftp.dlink.com, but is available from http://www.tomizone.com/downloads/firmware. It looks like tomizone support is the difference between C1 and C2. Given the trouble I had getting the emergency flash upgrade page to accept any images, it may be difficult to return to router to D-Link firmware.
More to come as I work on interfacing a Garmin GPS 18x OEM LVC to the serial port.
Some time ago I had to connect a device to my network that could be only connected via network wire. Unfortunately there was no access to a switch or something similar nearby. But my network (of course) has a wifi access point that my device could connect to if it would have a wifi adapter.
So how could I connect my device to the network as if it was connected by wire? It should behave just like a normal network client and for example get an ip address via DHCP, have the ability to connect to other LAN clients etc.
Solution is easy & very cheap. A (almost) transparent LAN/WLAN bridge!
Read on to see how you could setup such a bridge easily using a GUI (LuCI).
Notes
![Openwrt format disk Openwrt format disk](https://www.alfa.com.tw/upload/images/AWPCIE-1900U_4.jpg)
What we setup here is basically a routed client as described here: https://wiki.openwrt.org/doc/recipes/relayclient. It is called a pseudobridge in the article because technically it is a router pimped by some software to act like a bridge.
Whenever I refer to the ‘router’ I mean the TP-Link TL-WR841N device we are working on and not some router that may exist in your network.
Hardware
For my solution I use the very cheap and simple router TP-Link TL-WR841N. On this device you can easily install the custom firmware that we will need.
The TL-WR841N I am using here works pretty well for this setup but is not recommended by OpenWrt anymore due to low flash/ram. So in case you want to upgrade to a newer version of OpenWrt in the future choose a device with more flash/ram.
Prerequisites
In order to be able to do the setup you need a few things:
- A working access point that has access to the internet
- A desktop/notebook with an SSH client (e.g. PuTTY)
- A network cable to connect desktop/notebook to the router
Openwrt Format Usb Drive
1. Install custom firmware (OpenWrt) on router
There are many very good tutorials how to install the custom firmware OpenWrt on a TL-WR841N. Therefore I am not describing this step.
I recommend sticking with the install instructions on the OpenWrt-Website, which in my case was: https://openwrt.org/toh/tp-link/tl-wr841nd#installation
I recommend sticking with the install instructions on the OpenWrt-Website, which in my case was: https://openwrt.org/toh/tp-link/tl-wr841nd#installation
For this tutorial I used release 18.06.04 of OpenWrt.
2. Reset (optional)
If you just installed the custom firmware you may ommit this step. But if you already twiddled with it or need to reset because you messed something up, just do this:
Openwrt For Raspberry Pi
- Power off the device
- Remove all cables (except the power cable of course)
- Press the reset button and keep it pressed
- Power on the device (keep the reset button pressed)
- Watch the status LEDs (keep the reset button pressed)
- The lock LED turns on (keep the reset button pressed)
- The lock LED turns off (keep the reset button pressed)
- The lock LED starts blinking (keep the reset button pressed)
- The lock LED starts to illuminate constantly
- Immediately release the reset button
- The device now resets to OpenWrt default configuration. During this process all LEDs may blink
- Wait till the lock LED illuminates constantly again
Now your device is reset to OpenWrt defaults and we can start to configure our LAN/WLAN bridge.
3. First steps
- Connect your desktop/laptop via network cable to the router using port 1
- Ensure, that your computer isn’t connected to any other network, e.g. via WLAN
- On your computer enable DHCP for your ethernet device
- On your computer open a browser window and visit http://192.168.1.1 which is the GUI/frontend of your OpenWrt router
- Initially there is no password set, so be sure there is no password in the password field and click Login
4. Set your password
- In the menu go to System/Adminstration
- Choose a password and enter it in the fields Password and Confirmation
- At the bottom of the page press Save & Apply
5. Set the ip address of your router
Your router needs to have an ip address that is outside of your LAN. Otherwise the bridging will not work. This will also be the address you have to use when you need to configure your router. So just choose an ip address that you normally never would use and you are save ?
I chose 192.168.15.1 for my router as the whole subnet 192.168.15.0/24 isn’t yet used. If you choose another address remember to replace 192.168.15.1 in every part of this guide.
I chose 192.168.15.1 for my router as the whole subnet 192.168.15.0/24 isn’t yet used. If you choose another address remember to replace 192.168.15.1 in every part of this guide.
- In the menu go to Network/Interfaces
- For the interface LAN click on action Edit
- In the field IPv4 address enter your new ip address, in my case 192.168.15.1
- Because the bridge should be transparent, we have to disable the DHCP server. Therefore find the DHCP section and check the Ignore Interface option
- Click Save & Apply
- In current versions of OpenWrt you get a “Configuration has been rolled back!” alert which is because of the changed ip address your browser and the router cannot communicate anymore. This is perfectly normal. Please just click Apply unchecked and wait till the (also normal) “Device unreachable” message appears.
From now on your router is reachable with its new address 192.168.15.1. Because we disabled the DHCP server your computer will not get a new ip address automatically. You have to set it manually now:
Intel ssd form factor. When they fail, they fail completely: no data recovery is possible. They still have the same high rates of early failure; like all electronic devices there’s a risk of mis-assembly and component failure.But uniquely, the flash memory uses in SSDs can only survive a certain number of write cycles. S.M.A.R.T (Self-Monitoring, Analysis and Reporting Technology) is an automated self-test system for SSDs and more traditional spinning HDDs. So it pays to keep an eye on the health of a drive that might suddenly and irreversibly fail without warning.Both failure types can be predicted and planned for in advance based on certain characteristic failure patterns.
- Give your computer a new ip address that belongs to the new subnet. I gave the ethernet adapter of my notebook the ip address 192.168.15.2 and netmask 255.255.255.0
To resume configuration you have to reconnect to the router now.
Openwrt Format Sd Card
- In your web browser go to http://192.168.15.1 which is the new URL of the router frontend
- Login in with username root and your password
6. Remove unneeded wireless connection
As we don’t want the router to work as an access point we have to delete the automatically generated wireless connection.
- In the menu go to Network/Wireless
- Find the connection with SSID “OpenWrt” and mode “Master”.
- Click Remove
- Confirm removal in the popped up dialog
7. Connect router to your WLAN
- In the menu go to Network/Wireless
- Click Scan in the upper right
- When the scan is finished choose the network you want to join and click Join Network
- In the appearing dialog enter the passphrase of the WLAN you want to join
- Click Submit
- Click Save & Apply
If everything went well, your router should now be connected to your network and have access to the internet. This can be checked easily:
- Go to Network/Diagnostics
- Click on Ping
If the ping was successful it should result in something like shown on the right.
8. Install relayd on router
- With the SSH client of your choice (e.g. PuTTY) connect to your router using ip address 192.168.15.1. Rember to connect as user root. In linux for example you would have to connect like
- Enter the password you set for OpenWrt in step 4
- Do an pkg update:
- Install relayd
- Install relayd protocol for LuCI
- Activate relayd:
- End SSH session:
9. Configure bridge via web GUI
- Open your browser and visit http://192.168.15.1 again.
- Login in with username root and your password
- In the menu go to Network/Interfaces
- Click Add new interface
- In the Name of the new interface field enter stabridge
- In the Protocol of the new interface dropdown choose Relay bridge
- Click Submit
- In the Relay between networks section check lan: and wwan:
- Click Save & Apply
10. Adjusting firewall rules
- In the menu go to Network/Firewall
- In the Zones section Add
- In the Name field enter bridgezone
- In the Forward dropdown choose accept
- In the Covered networks section check lan: and wwan:
- Anything else stays unchanged
- Click Save & Apply
11. Restart router and test
- In the menu go to System/Reboot
- Click Perform reboot
Your setup is now finished. Any device that is connected to a port of the router (except the WAN port) should now behave like it would be directly connected to the LAN by wire.
To test this with my notebook I did the following steps: Ntfs mac os.
- Disabled my wifi adapter
- Set my ethernet connection back to DHCP
The result is that my central DHCP server gave me a new ip address and I have full access to the internet and all devices in my local network.
Exactly what I wanted. This way I can extend my network to wire-only devices even when there is no network socket available.
Mission complete ?
Closing remarks
Remember that the configured router has the static ip address 192.168.15.1 which is very likely not reachable in the local network, e.g. because it has subnet 192.168.1.0/24. If you want to access the router itself, e.g. to make changes to the configuration like connecting to a different wifi network you would have to set the ip of your computer to 192.168.15.2 so it would be able to connect to 192.168.15.1. Additionally the router is configured to ask for an own ip address via DHCP (via interface WWAN). So you may lookup the address and connect to that ip. This works from any device in the network but the ones that are connected directly to the ports of the router.
Was this article helpful?
Consider buying me a coffee to keep my brain fueled ?
Tagged with: bridge, LuCI, network, OpenWrt, WLAN