Road Warrior Portable Router

Hi,

I have heavily customised my AR150 to be a road warrior. The only mode it works is Natting.

On boot, it will wait for 10 seconds on WAN (ethernet/eth0) for an connecting. If this is successful local lan (ethernet/eth1) and wifi becomes access point.

If the WAN ethernet/eth0 connection is unsuccessful, it will scan the airwave and try to match a list of wifi connection profiles you have setup.When one is matched, it will try and connect. Should the connection failed or no matching profile is found, it will default to failsafe mode by becoming an Access Point (AP+STA problem). The local lan (ethernet/eth1) also serves local connections.

The scripts does not use gui to configure the wifi profiles and I’ve used my own iptable rules. It also saves wear on the flash by limiting writes once the wifi profiles are setup

I would be happy to post my script if anyone is interested.

Thanks

 

Yes, Please post!

When you say failsafe, I assume you mean just set the Option Disabled to 1.

RangerZ,

The failsafe revert AP+STA problem to AP, so you can always login via wifi.

I have also done similar configures for TP 703N which have only 1 physical ethernet, where the ethernet becomes either WAN or LAN.

 

Flash with openwrt-clean-gl-ar150-1.0.bin

Copy all 4 .ipk files to /tmp
Copy the gl.tar files to /etc/config

Then run the following commands: -

opkg install /tmp/ip_4.0.0-1_ar71xx.ipk
opkg install /tmp/iwinfo_2015-06-01-ade8b1b299cbd5748db1acf80dd3e9f567938371_ar71xx.ipk
opkg install /tmp/kmod-macvlan_3.18.23-1_ar71xx.ipk
opkg install /tmp/wireless-tools_29-5_ar71xx.ipk

cd /etc/config/
tar xvf gl.tar
chmod u+x *.sh
rm wireless
ln –s /tmp/wireless wireless

vi /etc/rc.local so it looks like this: -

Put your custom commands here that should be executed once

the system init finished. By default this file does nothing.

[ -x /etc/config/wifi.sh ] && /etc/config/wifi.sh
[ -x /etc/config/routes.sh ] && /etc/config/routes.sh
[ -x /etc/config/cleanupWifi.sh ] && ((/etc/config/cleanupWifi.sh)&)&

exit 0

Then disable the firewall/luci: -

/etc/init.d/firewall stop
/etc/init.d/firewall disable
/etc/init.d/uhttp stop
/etc/init.d/uhttp disable

edit
/etc/config/wirelessAP to change your AP wireless name/password
Run /etc/config/confWifi.sh to setup your wireless connections to your home network or hotspot

reboot

=========================================

The symbolic link /etc/config/wireless to /tmp/wireless saves the wear on the flash as /tmp is ramdisk/swap
wifi.sh - this scans the airwave and connects to your profiles in /etc/config/wireless<number>.* if it’s is found. If none are found/cannot connect, your wifi becomes an AP. This is called in /etc/rc.local. You do not need to run this manually

On boot, it will wait for 10 seconds on WAN (ethernet/eth0) for a connecting. If this is successful local lan (ethernet/eth1) and wifi becomes access point.

If the WAN ethernet/eth0 connection is unsuccessful, it will scan the airwave and try to match a list of wifi connection profiles you have setup.When one is matched, it will try and connect. Should the connection failed or no matching profile is found, it will default to failsafe mode by becoming an Access Point (AP+STA problem). The local lan (ethernet/eth1) also serves local connections.
confWifi.sh – this scans the airwave and allows you to setup wireless profiles to connect to. The last option is for manual setup.

chgNetwork.sh – this changes your network so it does not clash on 192.168.6.x to 192.168.7.x. It will switch between 192.168.x.x. to 10.10.x.x. Will need a reboot after this

routes.sh – this defines the ipfilter rules for NAT and blocking rules. This is call in /etc/rc.local. There are 3 modes

routes.sh 0 – stricter using drop rules - default

routes.sh 1 – relax rules using accept.

routes.sh 2 – accept rules, no natting

regenMac.sh – regenerates random mac for wifi (mac spoofing). Use this if the cafe hotspot limits you to 30mins a day. There are 3 modes

regenMac.sh – kill off loop process

regenMac.sh 0 – regen once

regenMac.sh <number> - regen every X minutes

cleanupWifi.sh - cleanup wifi profile specify in days during confWifi.sh. This is call in /etc/rc.local

I have use android apps
Juicessh (xterm) and ssh hot button to config these on the go

Enjoy!

Let me know if you have any questions

Due to the upload file size - I have to gzip the package. You have to gunzip the gl.tar.gz first before untarring

thanks for posting. Will have a close check. Seems it is necessary to implement this in the default firmware.

BTW, for the ipk files, you can just do a opkg update, the opkg install each one. Doesn’t it?

alzhao

That’s correct for the 4 ipk packages. Use the official repository. I was making life easier for installer.

I think you can rework wifi.sh to make it work if your system has wlan0 (AP) and wlan1 (Connect to upper router).

Let me know if you need any help

I am using WinRAR on Windows. I have both RAR and GZip associated with archives. It reports that the file is corrupt. Can you please check the archive.

Hi

I have download the link and it looks ok with 7zip

http://www.7-zip.org/download.html

I have also attached my scripts only without the 4 ipk packages.

You must download the 4 packages from the offical repository.

 

 

 

Thanks, I can open this archive.

After a quick review I think this is way to complex for my skill set. I also have some concerns about how it will play with other packages. I have OpenVPN installed on the GLI GUI, and not keep about redoing all this.

Do you have any idea if this is portable to other devices\platforms with the proper substitution of the relevant 4 packages?

I think it would work with openvpn if your wlan0 is AP and wlan1 (connect to router).

you will need to install iwinfo and wireless-tools minimum

opkg update

opkg install iwinfo

opkg install wireless-tools.

You will need these scripts in /etc/config

wifi.sh, confWifi.sh and wirelessAP

Then run

cd /etc/config

chmod u+x *sh

rm wireless
ln –s /tmp/wireless wireless

Add to your /etc/rc.local

[ -x /etc/config/wifi.sh ] && /etc/config/wifi.sh

Change your SSID/password in

/etc/config/wirelessAP

 

If you are worry about messing up your configs backup rootfs/rootfs_data first

cat /dev/mtd5 >/tmp/backup.bin
Download that file to your computer.

To restore. Transfer it to /tmp in router.
sysupgrade -v -n backup.bin

 

 

Second thought, your dhcp/network file might not align to my wirelessAP (interface name) etc or confWifi.sh. So it will not work.

You will need full scripts. You can backup your good image as indicated above before trying it