From DD-WRT Wiki
 Installing DD-WRT
 Flashing from Buffalo Firmware
These instructions are for WHR-G300N v2 only. Go here for WHR-G300N v1 instructions.
Buffalo, unfortunately, encrypts their firmware, and their routers will accept only encrypted firmware in the web interface.
Fortunately, the stunning authors of DD-WRT have created a first time flash file. You can flash the WHR-G300N V2 over the Buffalo web firmware update interface. After which you can then use normal DD-WRT web flashing.
Go to the Brainslayer latest build folder and the "buffalo_whr_g300nv2" subfolder, and download the .bin file, choose the first time or the regular update depending on your needs.
After flashing it's important to perform a hard reset , otherwise the router probably won't work correctly.
 DD-WRT Upgrade Flashes
Get the files from the link provided just above. For upgrades in the DD-WRT interface you must use the regular .bin files, not the first time flash ones (these are intended for use in the Buffalo firmware web update only).
 Specific configuration
DDNS does at the time of this writing (Oct 2011) not work with any recent v24-sp2 build. It should generally work with every build below and including 16785, but does in fact not on this router. On this router you need anything up to and including 16214 to get DDNS to work.
 Important Notes
It seems support for this router is still experimental and not yet official. I used mine as an access point and was very happy to see channels 12 & 13 become available (I don't understand why Buffalo don't make them work in Europe). However, when I tried to set the channel to 40Mhz wide, the speeds for all transfers crashed (even after setting back to 20Mhz). It's a work in progress and I'm excited about it.
I should note that I plan on doing some speed throughput tests with the 1.82 Buffalo firmware. So far it looks like so long as you don't try and engage 40Mhz mode, DD-WRT might be faster!! I will carry on with the testing and see.
Client Bridge is not working with build r16214. It is using nearly 100% cpu (in relayd). Use build r14896 instead and follow the instruction: 
 Going back to Buffalo Firmware
I tried many times to TFTP without success. I got disheartened as my old Belkin 7230-4 was a piece of cake. You must follow these instructions for a successful TFTP flash. I have used these myself to flash my own WHR-G300N V2 back to Buffalo firmware.
To do this you can use Ubuntu 9.04 Desktop Live CD. I used Ubuntu 10.04 which I have installed on my laptop.
- Get the Buffalo firmware from their site. You may need to choose the right region, so I won't link here.
- Get TFTP app
- On ubuntu enable Universe repositories
- Update repositories using
sudo apt-get update
sudo apt-get install tftp
- Hold the reset button on your router for at least 10 seconds. I didn't do a 30/30/30 reset, but you might want to.
- Unplug all ethernet cables and the power cable.
- Connect your computer through ethernet directly to your router but leave the router turned off.
- Disable NetworkManager. In Ubuntu 9.10, run
sudo service networking stopOr, in Ubuntu 10.04, run
sudo service network-manager stop
- Set IP of ethernet interface to "192.168.11.2". In Ubuntu, run
sudo ifconfig eth0 192.168.11.2(assuming eth0 is your ethernet interface)
- set netmask to "255.255.255.0" I think this is default but just to be safe, run
sudo ifconfig eth0 netmask 255.255.255.0
- Make entry in the ARP table corresponding to the router. run
sudo arp -s 192.168.11.1 [MAC ADDRESS OF ROUTER]
- The MAC address of router is the SSID printed on the sticker, but every second digit/letter is followed by a ":", so you end up with something like "00:1D:73:8C:8D:D5" (THIS IS AN EXAMPLE DO NOT USE THIS NUMBER... I ACTUALLY JUST MADE IT UP)
- what this really does is tell the network that 192.168.11.1 (the IP address that the router will take for itself) corresponds with the MAC address of the router.
- I'm not sure the arp table business is entirely necessary but it cannot hurt... also this is the one step i have absolutely no idea how to do in windows...
- At this point you basically have a 1 computer network set up and your computer will be expecting the router (defined by its MAC address) to show up on 192.168.11.1 (which is the address the router will ask for/respond on when it is turned on)
- Important: Before starting TFTP navigate (on the shell) to the folder where you downloaded the firmware (otherwise you can not upload it using TFTP)
- Run TFTP
- Set verbose mode on (so we know what's going on);
Verbose mode on.
- Binary mode on (because we are uploading a binary file);
mode set to octet
- Trace on (so we get feedback on our commands);
Packet tracing on.
- Rexmt 1 (to retry the upload on failure every 1 second);
tftp> rexmt 1
- And timeout to 60 (repeatedly retry the upload for 60 seconds before giving up)
tftp> timeout 60
- Run TFTP
- in tftp connect to 192.168.11.1 (does not matter that router is still turned off)
tftp> connect 192.168.11.1
- At this point you aren't really "connected" in the sense that your computer requires any feedback from the router. tftp is basically just prepped to send the correct file to the correct address, as long as all the other pieces of the equation (the router) end up in the right place at the right time.
- now get ready to plug in your router, but don't do it yet. Also, make sure your computer is connected to one of the LAN ports of the router, not the WAN port (the WAN port is outlined in blue)
- In tftp put [firmware]
tftp> put whrg300nv2-182
- At this point tftp will keep trying to send the firmware to the router and when it fails (because the router isn't yet on or hasn't yet brought up it's tftp interface) it will wait 1 second and retry, up to 60 times (because that's how we set up the tftp client)
- Plug in the power cord to the router
- The router will start up and now and you will see some lights blinking (possibly)
- About 10-20 seconds in, you should notice that tftp is sending the file. instead of the retry message over and over you will see some progress scrolling down the screen and at the end it will tell you how many blocks or bytes were transferred in how many seconds
- After the transfer is complete, wait about 5-10 minutes (more like 6 minutes I think) during this wait the red light on front of the router will blink and then go off, eventually the wireless led comes on. (wireless led looks like a radar thing... don't know how to describe it really)
- When the wireless led is on, you are ready to go.
- Enable NetworkManager. In Ubuntu 9.10, run
sudo service networking startOr, in Ubuntu 10.04, run
sudo service network-manager start
 Thanks To
ERamseth and Chalkos. I copied chunks of their pages to put this together more efficiently. They also gave me the info I needed in order to be able to get my WHR-G300N V2 back to Buffalo firmware.
 Recovery from Bricking, Semi-bricking
If one accidentally flashes the wrong build to their router (i.e., one intended for a version 1 WHR-G300N), it appears to be possible to recover with minimal effort. From a solid red DIAG light, one can still TFTP back to the stock Buffalo firmware (as in the above directions). Unlike the available version 1 builds, it appears that no TFTP-compatible DD-WRT build is available for version 2 hardware, necessitating a return to stock firmware first before web-ui updating back to DD-WRT.
Do note that the TFTP availability window is short and easily missed, especially on modern Windows OS's where the ethernet interface doesn't immediately initialize -- connecting via a router/switch has been reported by some to fix this issue.