Wednesday, January 16, 2013

Update openwrt PC (x86).

More and more of the plastic routers you get from a retailer are limiting you from installling a third party firmware to make the unit more valuable. So it is nice you can put an old pc back to work and install the same kind of firmware you would put on the store bought routers. Also with the pc you can swap the nic cards for better nics without getting a whole new system.


Pulled out of the closet the pc I was using as a router and found that a few things have changed. I just went ahead and installed the latest openwrt kamikaze image on the system. What does the system have? Intel PII 266 mhz with 192 meg ram. The openwrt hard drive is only 2 gig. Thinking about using another case. The system actually has two drives. one with a minimal Debian linux to be able to get the latest image or dd (or install) to the openwrt drive. The Debian linux drive is usally left unconnected.






First thing I did was to change the dead motherboard battery.  Second  thing I did was change the password from the console.



There have been a few changes and a few quirks. When I cranked up the system it did not seem to see the wan (internet). so I had to do a couple of things. 

# Copyright (C) 2006 OpenWrt.org

config interface loopback
    option ifname    lo
    option proto    static
    option ipaddr    127.0.0.1
    option netmask    255.0.0.0

config interface lan
    option ifname    eth0
    option type     bridge
    option proto    static
    option ipaddr    192.168.6.1
    option netmask    255.255.255.0

config interface wan
    option ifname eth1
    option proto dhcp

First I had to add the wan interface to the /etc/config/network file. Those are the last three lines. then I had to bring up the interface with: (ifup wan)

# ifup eth1 


I also changed the default ipaddress of the lan from 192.168.1.1 to 192.168.6.1 so as to not interfere with my local network.

local network 192.168.1.x) > router > private network (192.168.6.x)

Then there were changes to some of the commands. You used to use ipkg, so now to update the system you would use (opkg replaced ipkg):

# opkg update

You can ssh root@openwrtbox and do everything remotely from the command line.


So far so good. Then I tried to access a web interface remotely. Did not work, So I had to install a web interface to the system. There are actually three to choose from. I chose Luci or the first on the list suggested in the install notes.  To do that you have to add the repository (where to get the files from). So you add that repository to the /etc/opkg.conf file. In this case it was just one line or the last line in the file:

src/gz snapshots http://downloads.openwrt.org/kamikaze/8.09.2/x86/packages
dest root /
dest ram /tmp
lists_dir ext /var/opkg-lists
option overlay_root /jffs
src luci http://downloads.openwrt.org/kamikaze/8.09.2/x86/packages

Now you let the system know the file has changed, so again you do:

# opkg update

The you need to install the web interface. There are quite a few modules you can install, but I just did the basic interface. You can add more later.

# opkg install luci-web

At this point it would not hurt to do a reboot. You should then be able to see the router's web page.

Cool!  Almost forgot. If you have more than one pc to connect to the router, you will need to get a switch.

Note: Some people say that using a pc for a router has much better throughput than the plastic store bought routers. Your mileage may vary. 
May replace the existing hard drive for a compact flash adapter. Required less energy and no moving parts.

No comments:

Post a Comment