Buffalo WZR-HP-G300NH

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 04:30, 12 December 2010 (edit)
Strawwmann (Talk | contribs)
(Fix for wifi Dropouts)
← Previous diff
Revision as of 05:02, 19 December 2010 (edit) (undo)
Strawwmann (Talk | contribs)
(Fix for WiFi Dropouts)
Next diff →
Line 154: Line 154:
(If you use windows, choose properties of you adapter, click Advance, goto WINS tag, If your use linux, add <code>wins server = xxx.xxx.xxx.xxx</code> in <code>[global]</code> section of samba) (If you use windows, choose properties of you adapter, click Advance, goto WINS tag, If your use linux, add <code>wins server = xxx.xxx.xxx.xxx</code> in <code>[global]</code> section of samba)
-==Fix for wifi Dropouts==+==Fix for WiFi Dropouts==
-Many users of Buffalo DD-WRT (v24SP2) routers, like me, experience frequent wifi dropouts, even after tweaking wifi settings for strong reliable signals.+Many users of Buffalo DD-WRT (v24SP2) routers, like me, experience frequent WiFi dropouts, even after tweaking WiFi settings for strong reliable signals.
-This startup script monitors a wifi-connected device on your network that is always on to monitor wifi dropouts. If there are two missed pings, then it restarts the wifi interface to restore the connection. The script has been modified [http://www.dd-wrt.com/wiki/index.php/Useful_Scripts#Reset_Wireless_Radio from this one for Broadcom hardware], to get it to work on Ahteros hardware.+This startup script monitors a WiFi-connected device on your network that is always on to monitor WiFi dropouts. If there are two missed pings, then it restarts the WiFi interface to restore the connection. The script has been modified [http://www.dd-wrt.com/wiki/index.php/Useful_Scripts#Reset_Wireless_Radio from this one for Broadcom hardware], to get it to work on Ahteros hardware.
[http://www.dd-wrt.com/wiki/index.php/Startup_Scripts To get startup scripts to run, you will first need to follow these instructions]. I prefer the shell script method which, as the prerequisites list, requires that you you are set up for SSH (or Telnet) and SCP connections to the router. It also requires that you [http://www.dd-wrt.com/wiki/index.php/Jffs set up the jffs flash file system], so that you have somewhere permanent to store and run the script after reboots. [http://www.dd-wrt.com/wiki/index.php/Startup_Scripts To get startup scripts to run, you will first need to follow these instructions]. I prefer the shell script method which, as the prerequisites list, requires that you you are set up for SSH (or Telnet) and SCP connections to the router. It also requires that you [http://www.dd-wrt.com/wiki/index.php/Jffs set up the jffs flash file system], so that you have somewhere permanent to store and run the script after reboots.
Line 166: Line 166:
#!/bin/sh #!/bin/sh
-# Modified(for Atheros chips, e.g., Buffalo DD-WRT WZR-HP-G300NH)from:+# This script fixes problems with intermittent dropouts of the WiFi radio.
 +# It pings a Wifi client to monitor when the connection has dropped (2 missed pings)
 +# It then closes and restarts the WiFi interface to restore WiFi connections.
 +# Modified (for Atheros chips, e.g., Buffalo DD-WRT WZR-HP-G300NH) from:
# http://www.dd-wrt.com/wiki/index.php/Useful_Scripts#Reset_Wireless_Radio # http://www.dd-wrt.com/wiki/index.php/Useful_Scripts#Reset_Wireless_Radio
-# (Original script was for Broadcom chip, Atheros use different commands)+# (Original script was for Broadcom chip, but Atheros has no 'wl' command)
-# This script fixes problems with intermitent dropouts of the wifi radio.+
-# It pings a wifi client to monitor when the connection has dropped (2 missed pings)+
-# It then closes and restarts the wifi interface to restore wifi connections.+
-# A wireless client that should always be up, to monitor+# A wireless client that should always be up, to monitor (modify this for your own network)
CLIENT_IP=192.168.2.160 CLIENT_IP=192.168.2.160
Line 187: Line 187:
FAIL_AGAIN=10 FAIL_AGAIN=10
-# after cycling, wait this many seconds+# after cycling, wait this many seconds (limits excessive refreshes if the monitored device is off)
-AFTER_CYCLE=360+AFTER_CYCLE=9000
# Client must be up before starting main loop # Client must be up before starting main loop
Line 200: Line 200:
done done
-# main script+# main script to restart wireless interface
while sleep ${CHECK_EVERY} while sleep ${CHECK_EVERY}
do do
Line 211: Line 211:
if ! ping -c 1 ${CLIENT_IP} >/dev/null if ! ping -c 1 ${CLIENT_IP} >/dev/null
then then
- echo "${CLIENT_IP} dropped two, restarting ${INTERFACE} (wifi)"+ echo "${CLIENT_IP} dropped two, restarting ${INTERFACE} (WiFi)"
# wl -i ${INTERFACE} down **** NO wl command for Atheros hardware, replace # wl -i ${INTERFACE} down **** NO wl command for Atheros hardware, replace
ifconfig ${INTERFACE} down ifconfig ${INTERFACE} down

Revision as of 05:02, 19 December 2010

Contents

Specifications: Buffalo WZR-HP-G300NH

CPU Model: Atheros AR9132 rev 2 (0xb9) CPU Clock: 400 MHz RAM: 64 MB FLASH: 32 MB

DD-WRT on Buffalo WZR-HP-G300NH

Buffalo provides a re-branded version of DD-WRT specifically for this router. It can be flashed from the GUI and is available on the Buffalo website:

http://www.buffalotech.com/support/getfile/wzrhpg300nh-pro-v24sp2-14998.zip

Read Me Documentation for Buffalo delivered DD-WRT firmware: http://www.buffalotech.com/support/getfile/wzrhpg300nh-pro-v24sp2-14998.txt

As of Feb 2010, the WZR-HP-G300NH can be flashed with DD-WRT directly from the Buffalo web GUI. To do this, go to http://www.dd-wrt.com/site/support/router-database, look up Buffalo WZR-HP-G300NH, and download the firmware file you need (just one file).

  • The buffalo to ddwrt webflash file is a full build. It's for flashing from the original Buffalo firmware to DD-WRT.
  • The webupgrade file is to upgrade from an older version of DD-WRT. Use this to upgrade from an old version of DD-WRT.
  • To revert from DD-WRT back to stock firmware, go to http://www.dd-wrt.com/phpBB2/download.php?id=13418, and download the file. Flash using upgrade on the DD-WRT web GUI. This is the 1.6 stock firmware. You can then upgrade to the latest Buffalo firmware.

See the forums for details. Register and log in to see and download files.

DD-WRT on Buffalo WZR-HP-G300NH (Japanese version)

The official DD-WRT release cannot be pushed by web upload onto the Japanese WZR-HP-G300NH original Buffalo firmware. Buffalo Japan added a "safeguard" that checks for Japanese firmware and rejects western firmware. For people with a Japanese router, see the following two sites for details.

Samba Configuration

DD-WRT already includes a built-in Samba server, but is missing UI to configure it. These instructions provide a simple way to setup Samba. They are based on instructions from http://g300nh.blogspot.com/2010/06/samba-sharing-in-dd-wrt.html, but have been modified for uses not familiar with Linux. All setup can be done from within the DD-WRT interface without requiring the use of a remote shell.

Pre Requirements

DD-WRT doesn't have any tools to format an HDD, so you must have an preformatted HDD in a format that DD-WRT can understand (FAT32, EXT3, etc.)

Go to Services/USB within DD-WRT and change the settings as indicated below:

Core USB Support: Enable
USB 2.0 Support: Enable 
USB Storage Support: Enable 
ext2 / ext3 File System Support: Enable
FAT File System Support: Enable
Automatic Drive Mount: Enable 
Disk Mount Point: /mnt

After apply the changes, if you have already plugged in an HDD, you should see it's information in the UI.

Anonymous Sharing Setup

These step will share a disk that is already mounted at /mnt. It will be publicly available to everyone on the network and won't require a username or password to connect.

Go to Administrators/Commands in DD-WRT and copy the script below into the textbox then choose Save Startup

# Stop samba service
killall smbd
killall nmbd
sleep 2

# Configure samba
mkdir -p /tmp/etc/samba
echo "
[global]
	netbios name = DD-WRT
	workgroup = WORKGROUP
	server string = DD-WRT
	syslog = 10
	obey pam restrictions = yes
	socket options = TCP_NODELAY
	preferred master = no
	os level = 20
	
	security = share
	guest account = nobody
	invalid users = root, mail, deamon, reboot
	null passwords = yes
	guest only = yes	
	map to guest = Bad User

	private dir = /tmp/etc/samba/
	lock directory = /var/lock/
	pid directory = /var/run/

	unix charset = UTF-8
	dos charset = UTF-8
	map archive = No
	map hidden = No
	map system = No

[Share]
	path = /mnt/
	read only = no
	create mask = 0700
	directory mask = 0700
" > /tmp/etc/samba/smb.conf

# Add user for samba
# guest user
grep -q nobody /etc/passwd || echo 'nobody:x:65534:65534:nobody:/mnt:/bin/false' >> /etc/passwd

# Start samba service
SMBOPTIONS="-s /tmp/etc/samba/smb.conf"
/usr/sbin/smbd $SMBOPTIONS
/usr/sbin/nmbd $SMBOPTIONS

Setup Sharing with Username/Password

Because smbpasswd program build-in DD-WRT alway treat /etc/samba/smbpasswd as the samba password file, and /etc is readonly file system, should we must temporary bind /tmp/etc to /etc during add user. Change # Add user for samba section like below:

# Add user for samba
mount -o bind /tmp/etc /etc

# clear samba user if exists
echo "" > /tmp/etc/samba/smbpasswd

# guest user
grep -q nobody /etc/passwd || echo 'nobody:x:65534:65534:nobody:/mnt:/bin/false' >> /etc/passwd

# add user: username=share, password=sharepassword
grep -q share /etc/passwd || echo 'share:x:65534:65534:nobody:/mnt/:/bin/false' >> /etc/passwd
smbpasswd share sharepassword

umount /etc

If you need add more users, you can repeat these lines with the desired usernames and passwords

# add user: username=share, password=sharepassword
grep -q share /etc/passwd || echo 'share:x:65534:65534:nobody:/mnt/:/bin/false' >> /etc/passwd
smbpasswd share sharepassword

In the [global] section of Samba configuration, update the config value as indicated below:

	encrypt passwords = true
	passdb backend = smbpasswd
	security = user
	null passwords = no
	guest only = no	
	smb passwd file = /tmp/etc/samba/smbpasswd

Configuration Share Folder

add later

Setup DD-WRT as Windows Name Server

If your network has more than subnet, you might need to setup a Windows Name Server (WINS server), You can make you router become a WINS server even if you don't have a usb hdd or you don't need a sharing setup. Just user script like Anonymous Sharing Setup but change some setting in [global] section:

wins support = yes

Goto Setup/Basic section in dd-wrt and set WINS server in DHCP group to your lan ip address (ex: 192.168.11.1)


If in your network have any device use static IP, find the Wins section and point to dd-wrt lan ip address (If you use windows, choose properties of you adapter, click Advance, goto WINS tag, If your use linux, add wins server = xxx.xxx.xxx.xxx in [global] section of samba)

Fix for WiFi Dropouts

Many users of Buffalo DD-WRT (v24SP2) routers, like me, experience frequent WiFi dropouts, even after tweaking WiFi settings for strong reliable signals.

This startup script monitors a WiFi-connected device on your network that is always on to monitor WiFi dropouts. If there are two missed pings, then it restarts the WiFi interface to restore the connection. The script has been modified from this one for Broadcom hardware, to get it to work on Ahteros hardware.

To get startup scripts to run, you will first need to follow these instructions. I prefer the shell script method which, as the prerequisites list, requires that you you are set up for SSH (or Telnet) and SCP connections to the router. It also requires that you set up the jffs flash file system, so that you have somewhere permanent to store and run the script after reboots.

As with all startup scripts, you should first run this manually from a temporary location to make sure it is working correctly. Once you have it working properly, you can then make it a startup script (by giving it a '.startup' extension, making it executable (chmod to '700'), and placing it in /jffs/etc/config/ (or other auto startup directory)).

#!/bin/sh

# This script fixes problems with intermittent dropouts of the WiFi radio.
# It pings a Wifi client to monitor when the connection has dropped (2 missed pings)
# It then closes and restarts the WiFi interface to restore WiFi connections.
# Modified (for Atheros chips, e.g., Buffalo DD-WRT WZR-HP-G300NH) from:
# http://www.dd-wrt.com/wiki/index.php/Useful_Scripts#Reset_Wireless_Radio
# (Original script was for Broadcom chip, but Atheros has no 'wl' command)

# A wireless client that should always be up, to monitor (modify this for your own network)
CLIENT_IP=192.168.2.160

# Wireless interface that disappears
# (The command below will generate this automatically
# Should return 'atho' for Atheros hardware)
INTERFACE=`nvram get wl0_ifname`

# seconds between checks
CHECK_EVERY=60

# seconds to wait after failed ping to try again
FAIL_AGAIN=10

# after cycling, wait this many seconds (limits excessive refreshes if the monitored device is off)
AFTER_CYCLE=9000

# Client must be up before starting main loop
while true
do
  if ping -c 1 ${CLIENT_IP} >/dev/null
  then
    echo "${CLIENT_UP} ok - begining main loop"
    break
  fi
done

# main script to restart wireless interface
while sleep ${CHECK_EVERY}
do
  if ping -c 1 ${CLIENT_IP} >/dev/null
  then
    echo "${CLIENT_IP} ok"
  else
    echo "${CLIENT_IP} dropped one"
    sleep ${FAIL_AGAIN}
    if ! ping -c 1 ${CLIENT_IP} >/dev/null
    then
      echo "${CLIENT_IP} dropped two, restarting ${INTERFACE} (WiFi)"
      # wl -i ${INTERFACE} down  **** NO wl command for Atheros hardware, replace
      ifconfig ${INTERFACE} down
      sleep 3
      # wl -i ${INTERFACE} up
      ifconfig ${INTERFACE} up
      sleep ${AFTER_CYCLE}
    fi
  fi
done 2>&1

...