First Steps with OpenWrt 10.03.1

First order of business after installing OpenWrt is to telnet to your device and set a root password. To do so telnet to 192.168.1.1 and, once you get the OpenWrt prompt, issue the passwd command. Now set a password and close the telnet connection.

$ telnet 192.168.1.1
Trying 192.168.1.1...
Connected to 192.168.1.1.
Escape character is '^]'.
 === IMPORTANT ============================
  Use 'passwd' to set your login password
  this will disable telnet and enable SSH
 ------------------------------------------

BusyBox v1.15.3 (2011-11-24 00:44:13 CET) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 Backfire (10.03.1, r29592) ------------------------
  * 1/3 shot Kahlua    In a shot glass, layer Kahlua 
  * 1/3 shot Bailey's  on the bottom, then Bailey's, 
  * 1/3 shot Vodka     then Vodka.
 ---------------------------------------------------
root@OpenWrt:/# passwd
Changing password for root
New password:
Retype password:
Password for root changed by root
root@OpenWrt:/# exit
Connection closed by foreign host.
$

With a root password set telnet access will be disabled and for all subsequent connections you will use ssh. All further telnet connection attempts will fail, because the connection will be refused. This is standard OpenWrt behavior.

$ telnet 192.168.1.1
Trying 192.168.1.1...
Connected to 192.168.1.1.
Escape character is '^]'.
Login failed.
Connection closed by foreign host.
$ ssh root@192.168.1.1
The authenticity of host '192.168.1.1 (192.168.1.1)' can't be established.
RSA key fingerprint is e3:74:ff:f7:54:45:12:ba:94:66:08:8f:40:05:a4:71.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts.
root@192.168.1.1's password: 

BusyBox v1.15.3 (2011-11-24 00:44:13 CET) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 Backfire (10.03.1, r29592) ------------------------
  * 1/3 shot Kahlua    In a shot glass, layer Kahlua 
  * 1/3 shot Bailey's  on the bottom, then Bailey's, 
  * 1/3 shot Vodka     then Vodka.
 ---------------------------------------------------
root@OpenWrt:~#

Now that we’ve established our connection to the router I suggest you change its default ip address so that it doesn’t conflict with any other routers you may be using. I’ll use 192.168.100.1. To change the ip address issue the following commands (you can read more about UCI here):

root@OpenWrt:~# uci set network.lan.ipaddr=192.168.100.1
root@OpenWrt:~# uci commit

Now reboot your router. The results of the above configuration are the following:

  • Router ip set to 192.168.100.1
  • DHCP addresses served in range 192.168.100.x

Bringing up the ADSL Interface

To bring up the ADSL interface we need to add the configuration below to /etc/config/network (I assume here that your ISP employs PPPoE bridged over ATM – occasionally called PPPoEoA. I also assume that the ATM PVC uses vpi 8, vci 35 and encapsulation LLC)*:

config 'interface' 'wan'
        option 'ifname' 'nas0'
        option 'proto' 'pppoe'
        option 'username' 'USERNAME'
        option 'password' 'PASSWORD'

config 'atm-bridge' 'atm'
        option 'unit' '0'
        option 'vpi' '8'
        option 'vci' '35'
        option 'encaps' 'llc'
        option 'payload' 'bridge'

To add the configuration above we can either edit the /etc/config/network file directly or issue the following commands at the OpenWrt prompt:

root@OpenWrt:~# uci set network.wan=interface          #add wan section
root@OpenWrt:~# uci set network.wan.ifname=nas0
root@OpenWrt:~# uci set network.wan.proto=pppoe
root@OpenWrt:~# uci set network.wan.username=USERNAME
root@OpenWrt:~# uci set network.wan.password=PASSWORD
root@OpenWrt:~#
root@OpenWrt:~# uci set network.atm=atm-bridge         #add atm section
root@OpenWrt:~# uci set network.atm.unit=0
root@OpenWrt:~# uci set network.atm.vpi=8
root@OpenWrt:~# uci set network.atm.vci=35
root@OpenWrt:~# uci set network.atm.encaps=llc
root@OpenWrt:~# uci set network.atm.payload=bridge
root@OpenWrt:~#
root@OpenWrt:~# uci commit

Don’t forget to replace USERNAME and PASSWORD with the ones provided by your ISP. Confirm by issuing uci show network or cat /etc/config/network.

Now run /etc/init.d/br2684ctl start to create the nas0 interface and bring up the wan interface:

root@OpenWrt:~# /etc/init.d/br2684ctl start
br2684ctl[1728]: Interface "nas0" created sucessfully
br2684ctl[1728]: Communicating over ATM 0.8.35, encapsulation: LLC
br2684ctl[1728]: Interface configured
root@OpenWrt:~#

You should now be connected to the internet. If you check the router’s log by issuing logread, you’ll see pppd establishing a PPP session with your ISP:

root@OpenWrt:~# logread
<output omitted>
daemon.info pppd[1485]: PPP session is 17049
daemon.info pppd[1485]: Using interface pppoe-wan
daemon.notice pppd[1485]: Connect: pppoe-wan  nas0
daemon.notice pppd[1485]: PAP authentication succeeded
daemon.notice pppd[1485]: peer from calling number 00:90:1A:A4:08:72
authorized
daemon.notice pppd[1485]: local  IP address xx.xx.xx.xx
daemon.notice pppd[1485]: remote IP address xx.xx.xx.xx
daemon.notice pppd[1485]: primary   DNS address xx.xx.xx.xx
daemon.notice pppd[1485]: secondary DNS address xx.xx.xx.xx
user.notice ifup: Enabling Router Solicitations on wan (pppoe-wan)
user.info firewall: adding wan (pppoe-wan) to zone wan
root@OpenWrt:~#

If you run ifconfig you should have a nas0 and a pppoe-wan interface.

root@OpenWrt:~# ifconfig
<output omitted>
nas0      Link encap:Ethernet  HWaddr 00:E0:A0:A6:66:70  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:342 errors:0 dropped:0 overruns:0 frame:0
          TX packets:478 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:31331 (30.5 KiB)  TX bytes:28629 (27.9 KiB)

pppoe-wan Link encap:Point-to-Point Protocol  
          inet addr:xx.xx.xx.xx  P-t-P:xx.xx.xx.xx  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1
          RX packets:9 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3 
          RX bytes:885 (885.0 B)  TX bytes:498 (498.0 B)
root@OpenWrt:~#

And last but not least, you should be able to ping outside addresses:

root@OpenWrt:~# ping www.yahoo.com
PING www.yahoo.com (87.248.122.122): 56 data bytes
64 bytes from 87.248.122.122: seq=0 ttl=54 time=94.505 ms
64 bytes from 87.248.122.122: seq=1 ttl=54 time=95.070 ms
64 bytes from 87.248.122.122: seq=2 ttl=54 time=95.265 ms
^C
--- www.yahoo.com ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 94.505/94.946/95.265 ms
root@OpenWrt:~#

If you have any questions or if you spotted any errors or omissions, please leave me a comment.

* Multiprotocol encapsulation over AAL5 is defined in RFC 2684. For more information check  http://tools.ietf.org/html/rfc2684.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: