Instalación de OpenWrt en un dispositivo TP-Link WDR4300

Vásquez Ponte

Instalación de la distribución de Linux OpenWrt en un router inalámbrico de banda dual simultáneo TP-Link WDR4300.

Modelo: TP-Link WDR4300

Versión de OpenWrt: openwrt-ar71xx-generic-tl-wdr4300-v1-squashfs-factory.bin

Establecer una conexión con cable al puerto LAN 1 del router WDR4300. En una consola ver que dirección IP ha sido adquirida. En este ejemplo se ha conectado una máquina Linux Debian al router WDR4300.

ifconfig
eth0      Link encap:Ethernet  HWaddr 00:11:22:33:44:55
   inet addr:192.168.0.100  Bcast:192.168.0.255  Mask:255.255.255.0
   UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
   RX packets:10879 errors:0 dropped:0 overruns:0 frame:0
   TX packets:6442 errors:0 dropped:0 overruns:0 carrier:3
   collisions:0 txqueuelen:1000
   RX bytes:15543710 (15.5 MB)  TX bytes:559758 (559.7 KB)

Abrir un navegador e iniciar una sesión en el router WDR4300 usando admin como nombre de usuario y contraseña.

Instalar el firmware de OpenWrt como se muestra en las siguientes imágenes.

Después de reiniciar, el router estará en otro segmento de la red.

ifconfig
eth0      Link encap:Ethernet  HWaddr 00:11:22:33:44:55
   inet addr:192.168.1.222  Bcast:192.168.1.255  Mask:255.255.255.0
   UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
   RX packets:16221 errors:0 dropped:0 overruns:0 frame:0
   TX packets:13978 errors:0 dropped:0 overruns:0 carrier:7
   collisions:0 txqueuelen:1000
   RX bytes:16852043 (16.8 MB)  TX bytes:9248200 (9.2 MB)

Conectarse vía Telnet al router WDR4300.

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.19.4 (2014-01-27 08:51:57 MST) 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
 -----------------------------------------------------
 BARRIER BREAKER (Bleeding Edge, r39404)
 -----------------------------------------------------
  * 1/2 oz Galliano         Pour all ingredients into
  * 4 oz cold Coffee        an irish coffee mug filled
  * 1 1/2 oz Dark Rum       with crushed ice. Stir.
  * 2 tsp. Creme de Cacao
 -----------------------------------------------------

Cambiar la contraseña del dispositivo.

passwd
Changing password for root
New password: ****************
Retype password: ****************
Password for root changed by root
exit

Connectarse vía SSH al dispositivo WDR4300.

ssh 192.168.1.1
The authenticity of host '192.168.1.1 (192.168.1.1)' can't be established.
RSA key fingerprint is 99:88:77:66:55:44:33:22:11:00:AA:BB:CC:DD:EE:FF.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.1' (RSA) to the list of known hosts.
root@192.168.1.1's password:

BusyBox v1.19.4 (2014-01-27 08:51:57 MST) 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
 -----------------------------------------------------
 BARRIER BREAKER (Bleeding Edge, r39404)
 -----------------------------------------------------
  * 1/2 oz Galliano         Pour all ingredients into
  * 4 oz cold Coffee        an irish coffee mug filled
  * 1 1/2 oz Dark Rum       with crushed ice. Stir.
  * 2 tsp. Creme de Cacao
 -----------------------------------------------------

Conectar el puerto WAN del router WDR4300 a Internet y reiniciar el dispositivo.

Connectarse nuevamente vía SSH al dispositivo WDR4300, instalar LUCI y activar el servicio uhttpd.

opkg update

opkg install luci

/etc/init.d/uhttpd start

/etc/init.d/uhttpd enable

Activar la red inalámbrica comentando (#) la línea "option disabled 1" en el archivo de configuración /etc/config/wireless.

Extracto del archivo: /etc/config/wireless

config wifi-device  radio0
        option type     mac80211
        option channel  11
        option hwmode   11ng
        option path     'platform/ar934x_wmac'
        option htmode   HT20
        list ht_capab   LDPC
        list ht_capab   SHORT-GI-20
        list ht_capab   SHORT-GI-40
        list ht_capab   TX-STBC
        list ht_capab   RX-STBC1
        list ht_capab   DSSS_CCK-40
        # REMOVE THIS LINE TO ENABLE WIFI:
        #option disabled 1

config wifi-device  radio1
        option type     mac80211
        option channel  36
        option hwmode   11na
        option path     'pci0000:00/0000:00:00.0'
        option htmode   HT20
        list ht_capab   LDPC
        list ht_capab   SHORT-GI-20
        list ht_capab   SHORT-GI-40
        list ht_capab   TX-STBC
        list ht_capab   RX-STBC1
        list ht_capab   DSSS_CCK-40
        # REMOVE THIS LINE TO ENABLE WIFI:
        #option disabled 1

Desconectar el cable del puerto WAN (Internet) y reiniciar el dispositivo WDR4300.

Connectarse vía SSH al dispositivo WDR4300 y verificar los procesos activados.

ps w
  PID USER       VSZ STAT COMMAND
    1 root      1340 S    /sbin/procd
    2 root         0 SW   [kthreadd]
    3 root         0 SW   [ksoftirqd/0]
    4 root         0 SW   [kworker/0:0]
    5 root         0 SW<  [kworker/0:0H]
    6 root         0 SW   [kworker/u2:0]
    7 root         0 SW<  [khelper]
    8 root         0 SW   [kworker/u2:1]
   62 root         0 SW<  [writeback]
   64 root         0 SW<  [bioset]
   66 root         0 SW<  [kblockd]
   94 root         0 SW   [kworker/0:1]
   99 root         0 SW   [kswapd0]
  146 root         0 SW   [fsnotify_mark]
  175 root         0 SW<  [ath79-spi]
  184 root         0 SW   [kworker/u2:2]
  284 root         0 SW<  [deferwq]
  295 root         0 SW   [kworker/0:2]
  298 root         0 SW   [kworker/0:3]
  332 root         0 SW   [khubd]
  372 root         0 SWN  [jffs2_gcd_mtd3]
  436 root       888 S    /sbin/ubusd
  437 root       768 S    /sbin/askfirst ttyS0 /bin/ash --login
  524 root         0 SW<  [cfg80211]
  621 root      1308 S    /sbin/logd
  635 root      1516 S    /sbin/netifd
  650 root      1180 S    /usr/sbin/odhcpd
  676 root      1148 S    /usr/sbin/dropbear -F -P /var/run/dropbear.1.pid -p 22
  759 root      1480 S    udhcpc -p /var/run/udhcpc-eth0.2.pid -s /lib/netifd/dhcp.script -f -t 0 -i eth0.2 -C
  921 root      1728 S    /usr/sbin/hostapd -P /var/run/wifi-phy0.pid -B /var/run/hostapd-phy0.conf
  925 root      1716 S    /usr/sbin/hostapd -P /var/run/wifi-phy1.pid -B /var/run/hostapd-phy1.conf
  967 root      1524 S    /usr/sbin/uhttpd -f -h /www -r OpenWrt -x /cgi-bin -u /ubus -t 60 -T 30 -k 20 -A 1 -n 3 -N 100 -R -p 0.0.
 1007 root      1480 S    /usr/sbin/ntpd -n -p 0.openwrt.pool.ntp.org 1.openwrt.pool.ntp.org 2.openwrt.pool.ntp.org 3.openwrt.pool.
 1023 nobody     960 S    /usr/sbin/dnsmasq -C /var/etc/dnsmasq.conf -k
 1077 root      1216 R    /usr/sbin/dropbear -F -P /var/run/dropbear.1.pid -p 22
 1078 root      1484 S    -ash
 1088 root      1476 R    ps w

Abrir un navegador e iniciar una sesión en el router WDR4300 usando root como nombre de usuario y la misma contraseña que usamos para la conexión vía SSH.