Routeur Netgear DG834G

De MicElectroLinGenMet.

Sommaire

Description

Modem ADSl / Routeur / Switch 4 ports sans fil (54 Mbit/s) 802.11g.


Specifications

  • 4-port 10/100 Mbit/s Ethernet switch
  • Wireless Access Point (802.11b+g)
  • ADSL modem (DG834G v1)
  • Firewall
  • Routeur


Notes

Fonctions spéciales par l'interface web

  • Mode debug => telnet activé:
wget  --http-user=admin --http-passwd="password" --user-agent=Mozilla/5.0 -O netgear.html 'http://routeur/setup.cgi?todo=debug'
  • Reboot auto.
wget --http-user=admin --http-passwd=password --user-agent=Mozilla/5.0 'http://routeur/setup.cgi?todo=reboot'
  • Statut du routeur:
wget --http-user=admin --http-passwd="password" --user-agent=Mozilla/5.0 'http://routeur/setup.cgi?next_file=s_status.htm' ou ?next_file=system.htm ou ?todo=logout
  • Deconnexion web routeur:
wget --http-user=admin --http-passwd="password" --user-agent=Mozilla/5.0 -O /dev/null 'http://routeur/setup.cgi?todo=logout'


Commandes en console

Valider le mode debug avec l'interface web pour avoir l'accés telnet.

dan@vesta:~$ telnet routeur
Trying 192.168.0.xxx...
Connected to routeur.
Escape character is '^]'.

BusyBox v0.61.pre (2005.09.27-08:20+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.


# cat /proc/cpuinfo
processor               : 0
cpu model               : MIPS 4KEc V4.8
BogoMIPS                : 149.91
wait instruction        : no
microsecond timers      : yes
extra interrupt vector  : yes
hardware watchpoint     : yes
VCED exceptions         : not available
VCEI exceptions         : not available


# cat /proc/version
Linux version 2.4.17_mvl21-malta-mips_fp_le (root@Run-P4) (gcc version 2.95.3 20010315 (release/MontaVista)) #6 Wed Sep 7 16:50:05 CST 2005


# busybox --help
BusyBox v0.61.pre (2005.09.27-08:20+0000) multi-call binary

Usage: busybox [function] [arguments]...
   or: [function] [arguments]...

       BusyBox is a multi-call binary that combines many common Unix
       utilities into a single executable.  Most people will create a
       link to busybox for each function they wish to use, and BusyBox
       will act like whatever it was invoked as.

Currently defined functions:
       [, ash, busybox, cat, chmod, cp, dd, dmesg, echo, egrep, false,
       free, grep, ifconfig, init, insmod, kill, killall, ln, ls, lsmod,
       mkdir, modprobe, more, mount, mv, ping, ps, reboot, rm, rmmod,
       route, sh, sleep, test, touch, true, umount, wget


# free
              total         used         free       shared      buffers
  Mem:        14412        13308         1104            0          300
 Swap:            0            0            0
Total:        14412        13308         1104


# mount
/dev/mtdblock/0 on / type squashfs (ro)
none on /dev type devfs (rw)
/proc on /proc type proc (rw)
ramfs on /tmp type ramfs (rw)


Autre commandes utils

Affiche machines du réseau:

# /usr/sbin/nbtscan 192.168.250.0/24
192.168.250.4;VESTA;00:11:D8:XX:XX:XX
...


Lancer un serveur web:

# mini_httpd -p 1080 -d /tmp

Exemple d'utilisation:

dan@vesta:~$ wget -q -O - http://routeur:1080/wan_uptime
4292536.68 4290127.89

dan@vesta:~$ wget -q -O - http://routeur:1080/wan_ipaddr
83.199.44.4 

Caracteristiques de la liaison adsl:

# cat /proc/avalanche/avsar_modem_stats

AR7 DSL Modem Statistics:
--------------------------------
[DSL Modem Stats]
       US Connection Rate:     960     DS Connection Rate:     7808
       DS Line Attenuation:    20      DS Margin:              1
       US Line Attenuation:    11      US Margin:              6
       US Payload :            2908166256      DS Payload:             1672642272
       US Superframe Cnt :     41962235        DS Superframe Cnt:      41962236
       US Transmit Power :     0       DS Transmit Power:      0
       LOS errors:             0       SEF errors:             0
       Frame mode:             3       Max Frame mode:         0
       Trained Path:           1       US Peak Cell Rate:      2264
       Trained Mode:           3       Selected Mode:          1
       ATUC Vendor Code:       0       ATUC Revision:  1
       Hybrid Selected:        1       Trellis:                1
       Showtime Count:         17      DS Max Attainable Bit Rate:     7840
       BitSwap:                1       US Max Attainable Bit Rate:     n/a
       ...


Scripts pour piloter le Netgear

Script expect pour afficher règles iptables (Firewall)

Scripts lancé sur un Linux du réseau, se connecte sur le routeur et lance une commande iptables.

Exécution du script:

dan@vesta:~ $ netgearfwstat.exp
spawn telnet routeur
Trying 192.168.0.254...
Connected to routeur.
Escape character is '^]'.

BusyBox v0.61.pre (2005.09.27-08:20+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

# iptables -L OUT_FILTER
Chain OUT_FILTER (1 references)
target     prot opt source               destination         
RETURN     all  --  anywhere             anywhere           
# exit
Connection closed by foreign host.


Fichier script:

#!/usr/bin/expect
# netgearfwstat.exp

  # Open a telnet session to a remote server.
  spawn telnet routeur
  expect "# "

  # Send and then wait.
  send "iptables -L OUT_FILTER\n"
  expect "# "

  # Capture the results of the command into a variable. This can be displayed, or written to disk.
  set results $expect_out(buffer)

  # Exit the telnet session, and wait for a special end-of-file character.
  send "exit\r"
  expect eof


Scripts pour activer règles firewall sur le Netgear


  • filtre_win.exp

Filtre @IP 192.168.250.6 à 192.168.250.9 en sortie.
Cette règle apparait dans le menu firewall sur le serveur web du routeur.

#!/usr/bin/expect

 # Open a telnet session to a remote server.
 spawn telnet routeur
 expect "# "

 # Send and then wait.
 send "nvram set fw_out_rules='1:Any(ALL):0:192.168.250.6-192.168.250.9:0/0:2'\n"
 expect "# "

 # Send and then wait.
 send "/usr/sbin/rc firewall restart\n"
 expect "# "

 # Send and then wait.
 send "iptables -L OUT_FILTER\n"
 expect "# "

 # Capture the results of the command into a variable. This can be displayed, or written to disk.
 set results $expect_out(buffer)

 # Exit the telnet session, and wait for a special end-of-file character.
 send "exit\r"
 expect eof



  • defiltre_win.exp

Defiltre @IP 192.168.250.6 à 192.168.250.9, ligne décochée dans le menu

#!/usr/bin/expect

 # Open a telnet session to a remote server.
 spawn telnet routeur
 expect "# "

 # Send and then wait.
 send "nvram set fw_out_rules='0:Any(ALL):0:192.168.250.6-192.168.250.9:0/0:2'\n"
 expect "# "

 # Send and then wait.
 send "/usr/sbin/rc firewall restart\n"
 expect "# "

 # Send and then wait.
 send "iptables -L OUT_FILTER\n"
 expect "# "

 # Capture the results of the command into a variable. This can be displayed, or written to disk.
 set results $expect_out(buffer)

 # Exit the telnet session, and wait for a special end-of-file character.
 send "exit\r"
 expect eof