Showing posts with label openwrt. Show all posts
Showing posts with label openwrt. Show all posts

Monday, 31 March 2014

TP-Link Archer C7 V2 - OpenWrt - Barrier Breaker

Was looking for the best AC wifi router to replace my Buffalo WHR-G300NH and found that TP-Link has just released an Archer C7 V2 which has wifi card supported by ath10k driver based on the information found here.

Here is the packaging, it says that it supports Unifi & Maxis Fiber but the support is not out of the box. You need to ask the seller a beta firmware which has VLAN support but I couldn't get mine working using even the beta firmware on my Maxis Fiber. Emailed TP-Link support but got a reply saying that they don't have Unifi/Maxis Fiber ready firmware and asked if I want to swap with one that already have, but nah, I bought the router not for running the stock firmware anyway.



Ver 2.0 hardware as per the sticker.

Anyway, I waited for a week or so and someone came up with the new hardware profile which creates the correct firmware image for OpenWrt. If you've this new V2.0 hardware and wanted to run OpenWrt on it but couldn't wait to get the patches into the trunk, check this patches:


To build your own OpenWrt firmware for this ver 2.0 hardware, followed these steps:

1. Have Debian 6.0 or any development system which could cross-compile the OpenWrt firmware. There are many guides available on the net, but for me, I've a VMWare Debian 6.0 VM ready on my Hackintosh machine. 
2. Follow the guide found in: http://wiki.openwrt.org/doc/howto/obtain.firmware.generate. Follow the steps to get the trunk, untar the file and apply the above patches.
3. To generate the image, I was using the following command, I need the ath10k and luci support in the image:
$ make image PROFILE=ARCHERC7V2 PACKAGES="ath10k luci"
4. The generated image ready to be flashed can be found in the bin/ar7xxx/ as openwrt-ar71xx-generic-archer-c7-v2-squashfs-factory.bin

UPDATE: The profile has been updated into the mainstream trunk distribution and the trunk now contains the image for Archer C7 V2.0. The image can be downloaded here:

http://downloads.openwrt.org/snapshots/trunk/ar71xx/openwrt-ar71xx-generic-archer-c7-v2-squashfs-factory.bin

1-4: Do not forget that the trunk images do not contain LUCI, so, you may need to login into your router using ssh or telnet. Get it to the net and install LUCI using command line or, if you want to, you could follow the step 1-4 above, have you own image rebuild with the necessary LUCI packages.

UPDATE: The latest Barrier Breaker RC3 can be downloaded now. This has the fixes for 5GHz band which includes the calibrated setting etc. I've tested this with multi devices that support the 5GHz band and they work just fine. Please head up here to download the latest image:

http://downloads.openwrt.org/barrier_breaker/14.07-rc3/ar71xx/generic/openwrt-ar71xx-generic-archer-c7-v2-squashfs-factory.bin

LATEST UPDATE: Barrier Breaker has been available for many months now, so, please download it from the official website. Please read the comments left by visitors, they may contain important information that is helpful to make full use of the features available for this router.

5. Go and flash the firmware, do remember, the default IP address for OpenWrt router is 192.168.1.1.



To get Maxis Fiber to run, just go to network->vlan and have the following, surely don't forget to set the PPPOE userid and password:


That should be it.

Wednesday, 25 January 2012

CUPS + HL-2140 (USB printer) + WZR-HP-G300NH + OpenWRT

Why running CUPS on the router?

I've had a small home server running Ubuntu to server the whole house, but it seems I'm the only one using it fully. I had my Brother HL-2140 connected to the server but since I've some spare room left in the router, why not run the print server on the router?

But why CUPS?

The other option I've is running non-spooling server, p910nd, but I believe I should make full use of the free space/memory on the router. If the router overloaded, I'll consider using p910nd later on.

What needs to be done to get CUPS running?

You need a capable router, WZR-HP-G300NH is one. It has 32MB flash ROM and 64MB RAM. I'm currently running OpenWrt Backfire 10.03.1-RC6 on it.

To install CUPS, just use LUCI to install the cups package.

How about getting the HL-2140 USB printer to work along?

There is nothing special, cups seems to have supported USB printer, so we shouldn't need to install the kmod-usb-printer package. It seems that the CUP's backend needs libusb, so, please install the libusb package.

just install the kmod-usb-printer package from LUCI, this will also install all the required packages such as kmod-usb-core, kmod-usb-ohci and kmod-usb2. If everything working, you'll see the following messages from dmesg or system log:

usblp0: USB Bidirectional printer dev 9 if 0 alt 0 proto 2 vid 0x04F9 pid 0x0033
usbcore: registered new interface driver usblp


There should be new device available: /dev/lp0


If everything works, you'll see your printer when you issue the following command:
root@OpenWrt:/mnt/share# /usr/lib/cups/backend/usb
DEBUG: list_devices
DEBUG: usb_find_busses=1
DEBUG: usb_find_devices=5
direct usb://Brother/HL-2140%20series?serial=F9J555425 "Brother HL-2140 series" "Brother HL-2140 series" "MFG:Brother;CMD:PJL,HBP;MDL:HL-2140 series;CLS:PRINTER;" ""



That is it?

Not so fast young man, there are few more things need to be done especially spooling. Since we've pretty much limited space, adding external USB storage is recommended. I've few USB sticks that I don't really use. So, I got myself a 4-port hub. Stick the 4GB USB stick, format it with ext4 and mount it. To get the USB storage working, I've installed kmod-usb-storage (I believe this will install few other packages too), kmod-fs-ext4 and e2fsprogs (to prepare the USB stick). Format the stick and mount it to /mnt/share and using LUCI, configure to make this mounted during bootup time.

The standard configuration file for CUPS has the USB pointing to /dev/usb/lp0 but OpenWRT has instead created /dev/lp0. So, edit /etc/cups/printers.conf and change that. Otherwise CUPS won't find the USB printer.

Here is my /etc/cups/cupsd.conf configuration file:
AccessLog syslog
ErrorLog syslog
LogLevel info
PageLog syslog
PreserveJobHistory No
PreserveJobFiles No
AutoPurgeJobs Yes
MaxJobs 25
MaxPrinterHistory 10
User root
Group root
RIPCache 512k
TempDir /mnt/share/cups
RequestRoot /mnt/share/cups
# Allow remote access
Port 631
Listen /var/run/cups/cups.sock
HostNameLookups Off
KeepAlive On
# Share local printers on the local network.
Browsing On
BrowseOrder allow,deny
BrowseRemoteProtocols
BrowseAddress @LOCAL
BrowseLocalProtocols CUPS
BrowseProtocols cups
< Location />
# Allow shared printing and remote administration...
Order allow,deny
Allow all
< /Location>
< Location /admin>
AuthType Basic
AuthClass System
# Allow remote administration...
Order allow,deny
Allow all
< /Location>
< Location /admin/conf>
AuthType Default
Require user @SYSTEM
# Allow remote access to the configuration files...
Order allow,deny
Allow all
< /Location>


NOTE: The code above won't allow me to have '< >' so, I put a space after the '<' .. So, edit and remove the space if you want to cut and paste my configuration. Yes, I'm allowing everyone to get access to CUPS configuration interface. You're free to edit it for sure. To add the printer, just go to http://your-router-ip-address:631 Go to administration, add printer, select the AppSocket/HP JetDirect option. Remember the output from /usr/lib/cups/backend/usb? Use the URI there and paste it into the "Connection" field. Example, for my printer, the URI returned by the backend command is: usb://Brother/HL-2140%20series?serial=F9J555425

Cut and paste the above into "Connection" field.

Somehow, we're not allowed by cups to have both User and Group to be the same, so to force the the backend to run as root, change the permission for /usr/lib/cups/backend/usb to 700.

Make sure cupsd running, so, fire it up in LUCI under System -> Startup, enable it and click start.

What else need to be done?

I had a problem when trying to print from my Mac, I'm getting an authentication error. Checking the syslog, there is this error: "Returning IPP client-error-not-authorized for Print-Job" and from my Mac, I'm getting "Authentication Required to Print" error. I didn't realised that I did not click on the "Share" option for the printer. So, if you're getting this error.. check if the printer has "Share This Printer" option ticked.

That is all .. have fun to get your printer + CUPS running on your router.

Thanks for the Openwrt wiki, somehow, my previous setup was working great until suddenly it won't print anything after I upgraded my router to the latest 10.03.01 backfire. So, please check for updated guide here:

http://wiki.openwrt.org/doc/howto/cups.server.

Sunday, 10 July 2011

Getting astrill vpn to work with OpenWRT (the hard way)!

I've just subscribed to Astrill vpn service with a thought that they've openwrt scripting works as per the old twitter post that saying they're working on it. But to my dismay, they still doesn't have one that work. I created a support ticket as suggested by a twitter reply from Astrill support but it came back saying that they only support DD-WRT, so, no openwrt, fonera or tomato support at the moment.

The reason why I'm sticking with OpenWRT on my WZR-HP-G300NH router is, I've got the VLAN port & tagging to work on this router with the latest OpenWRT trunk. And reading many DD-WRT related notes, they still couldn't get the VLAN port/tagging to work on the router, hence, I'm stuck.

So, what did I do today? Searching for more information on the net on how to get the openvpn client to work on OpenWRT. If you know the way, surely, it is not hard.. but it took me few hours to figure out what I need to get this thing working.

So, what you need to get astrillvpn working on your openwrt router (in my case the WZR-HP-G300NH)?

  1. Get the latest trunk release of OpenWRT (or probably this will work with the official release firmware too). 
  2. Install OpenVPN support, there is LUCI interface for OpenVPN configuration (at least on trunk release it has it).
  3. Download the Astrill's openvpn certificates from the member page. It should be under Servers -> OpenVPN Certificate generator.
  4. Unzip the certificates file, there will be load of them. If you're interested to use the Los Angeles server, there are five of them, choose one. There are 4 sections that will be of our interest from this configuration file. The OpenVPN and the 3 certificates.
  5. Copy and paste the certificates and copied them into /etc/openvpn directory of your router. I created three standard files as per the example I found in the /etc/config/openvpn, they are:
    • /etc/openvpn/ca.crt (copy the content from Astrill openvpn file, anything between the ca and /ca.
    • /etc/openvpn/client.crt (anything between the cert and /cert)
    • /etc/openvpn/client.key (anything between the key and /key)
  6. Done with the certificate, now, we need to configure the openvpn. Easiest is to edit it manually, here is the example I've:

    config 'openvpn' 'astrill_west_cost'
    option 'client' '1'
    option 'dev' 'tun'
    option 'proto' 'udp'
    option 'resolv_retry' 'infinite'
    option 'nobind' '1'
    option 'persist_key' '1'
    option 'persist_tun' '1'
    option 'comp_lzo' '1'
    option 'verb' '3'
    option 'enable' '1'
    option 'ca' '/etc/openvpn/ca.crt'
    option 'cert' '/etc/openvpn/client.crt'
    option 'key' '/etc/openvpn/client.key'
    option 'remote' 'XX.XX.XX.XX 8292'

    Replace the remote with the correct vpn server IP address and save the file.

  7. I've no idea if this is required, but during my first hour of testing, I could use ping to ping out outside IP/sitename but I couldn't use my browser to browse anything. So, I've added the following into my /etc/firewall.user. To tell you the truth, I've copied this from somewhere. I know nut about firewall & iptable etc. I'm not good at all these, at all.
    iptables -I FORWARD -o tun+ -j ACCEPT
    iptables -t nat -I POSTROUTING -o tun+ -j MASQUERADE

  8. Go to your LUCI interface. You'll find your configuration shown as the following:


  9. Click on the Start to start your vpn connection, and Stop to stop it. 
I believe that should be all about it on how to get Astrill's openvpn to work with OpenWRT. Good luck!

Tuesday, 4 May 2010

WZR-HP-G300NH, OpenWRT & Huawei E160E


Finally, the latest release of OpenWRT 10.03 (codenamed BackFire) is out and it supports the WZR-HP-G300NH. Didn't take long until your truly take a plunge and flash his router with this latest firmware. Actually, the firmware supported the router since it's development release but since I'm not really into testing beta stuff, I've been patiently waiting for it to be available.. officially that it.

What the first thing I tried to do .. ? You guess it right, if you've followed my blog before .. trying to get APRS4R running on it but excitement overcomes the most basic thing I should do .. yes, RTFM .. APRS4R doesn't have support for other than mipsel and x86. So, what should I do with this mega router (64MB RAM with over 65% left after all the basic stuff loaded and over 32MB flash with over 90% empty)? One thing for sure, from my last week experience, where screamyx was so damn slow due to some international link was brought down for maintenance .. yes, a backup 3G broadband and I want this to be available without tinkering with my network setup everytime this thing happens. So, after thinking for few days .. and saw somebody wanted to let go his 3G USB dongle (Huawei E160E) for RM120, didn't think that long and my wallet had flattened a bit..

What do I need to get this E160E running? Tried it many times, loading kmod-usb-ohci and kmod-usb-uhci alongside the requirement to get USB working on Linux but no go.. just to realise that this router has USB2 .. so .. added kmod-usb2 got it going.. the E160E was recognised only after I added the following line into /etc/modules.d/60-usb-serial:


usbserial vendor=0x12d1 product=0x1003 maxSize=4096

What else needed, as per the documentation, comgt is required too, this has script to do the call-out for the 3G.

And for anyone wanted to do the same thing, the following guide is really helpful (at least for me and many others) in getting things going:

 Tips and tricks working with Form templates in S4 Public Cloud: Downloading XML In SD and some MM outputs, you could change the print queue...