See 'WikiDevi' @ the Internet Archive (MW XML, Files, Images)
upgraded MW to 1.30 - maybe things are slightly less broken

Conceptronic C54BRS4A 2.0

From WikiDevi
Jump to: navigation, search

Conceptronic C54BRS4A 2.0

Manuf/OEM/ODM Alpha Networks WRG-G19

Country of manuf.: China

Type: wireless router

Power: 5 VDC, 2.5 A
Connector type: barrel

CPU1: Atheros AR2317 (180 MHz)
FLA1: 2 MiB
2,097,152 B
16,384 Kib
2,048 KiB
16 Mib
0.00195 GiB
(STMicroelectronics 25P16V6P)
RAM1: 16 MiB
16,777,216 B
131,072 Kib
16,384 KiB
128 Mib
0.0156 GiB
(ESMT M12L128168A-7T)

Expansion IFs: none specified
JTAG: yes
Serial: yes, 3.3V TTL

WI1 chip1: Atheros AR2317
WI1 802dot11 protocols: bg
WI1 antenna connector: none

ETH chip1: Atheros AR2317
Switch: IC+ Model?
LAN speed: 10/100
LAN ports: 4
WAN speed: 10/100
WAN ports: 1

bg

Third party firmware supported: galinux (C54BRS4A)

Default IP address: 192.168.0.1
the IP 192.168.0.1 is used by 686 additional devices
of which 1 are Conceptronic devices
Default login user: admin
Default login password: admin
admin:admin credentials used by 1128 additional devices
of which 1 are Conceptronic devices

802dot11 OUI: 00:80:5A (1 E, 6 W, 2006)
Ethernet OUI: 00:80:5A (1 E, 6 W, 2006)

For a list of all currently documented Atheros chipsets with specifications, see Atheros.


"8WRGG19..1C1G" is silkscreened on the board.

This device is using AR2317-AC1A.

Other WRG-G19s...

 FLA1RAM1Switch model
Airlink101 AR335W4 MiB
4,194,304 B
32,768 Kib
4,096 KiB
32 Mib
0.00391 GiB
16 MiB
16,777,216 B
131,072 Kib
16,384 KiB
128 Mib
0.0156 GiB
IP175C
Airlink101 AR430W4 MiB
4,194,304 B
32,768 Kib
4,096 KiB
32 Mib
0.00391 GiB
16 MiB
16,777,216 B
131,072 Kib
16,384 KiB
128 Mib
0.0156 GiB
IP175E
Conceptronic C54BRS4A 2.02 MiB
2,097,152 B
16,384 Kib
2,048 KiB
16 Mib
0.00195 GiB
16 MiB
16,777,216 B
131,072 Kib
16,384 KiB
128 Mib
0.0156 GiB
D-Link DIR-300 rev A14 MiB
4,194,304 B
32,768 Kib
4,096 KiB
32 Mib
0.00391 GiB
16 MiB
16,777,216 B
131,072 Kib
16,384 KiB
128 Mib
0.0156 GiB
IP175E

Despite having 2MB Flash, this device still has a third-party firmware available for the device.

Teo Ramirez's c54brs4a v2 firmware

The default SSID may be C54BRS4A.

General information[edit]

This information is sourced from here.

Thanks to
Teo Ramirez (Spain)
teoDELETEramirezME()gmail.com
http://galinux.myftp.org

uname[edit]

# uname -a
Linux (none) 2.4.25-LSDK-5.0.0-RC5 #1 mar jul 5 23:14:58 UTC 2011 mips unknown

cpuinfo[edit]

# cat /proc/cpuinfo
system type             : Atheros AR531X_COBRA
processor               : 0
cpu model               : unknown V6.4
BogoMIPS                : 183.50
wait instruction        : no
microsecond timers      : yes
tlb_entries             : 16
extra interrupt vector  : yes
hardware watchpoint     : no
VCED exceptions         : not available
VCEI exceptions         : not available

mtd[edit]

# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00200000 00010000 "spiflash"
mtd1: 00137000 00010000 "rootfs"
mtd2: 001d0000 00010000 "upgrade"
mtd3: 00010000 00010000 "rgdb"
mtd4: 00020000 00010000 "RedBoot"
mtd5: 00010000 00010000 "Board/RadioCfg"
mtd6: 00200000 00010000 "flash"

free[edit]

# free
              total         used         free       shared      buffers
  Mem:        14160        13144         1016            0         1032
 Swap:            0            0            0
Total:        14160        13144         1016

meminfo[edit]

# cat /proc/meminfo
        total:    used:    free:  shared: buffers:  cached:
Mem:  14499840 13746176   753664        0  1056768  4452352
Swap:        0        0        0
MemTotal:        14160 kB
MemFree:           736 kB
MemShared:           0 kB
Buffers:          1032 kB
Cached:           4348 kB
SwapCached:          0 kB
Active:           3860 kB
Inactive:         3164 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:        14160 kB
LowFree:           736 kB
SwapTotal:           0 kB
SwapFree:            0 kB

loadavg[edit]

# cat loadavg
#1 min, 5 min, 15 min, running/total last proc.
1.07 1.10 1.07 2/209 8630

uptime[edit]

# uptime, while heavy traffic and "devsniffing":
 21:56:32 up  2:48, load average: 2.97, 2.76, 2.64

/proc/sys/net/ipv4[edit]

# ls /proc/sys/net/ipv4
tcp_timestamps                     icmp_echo_ignore_broadcasts
tcp_window_scaling                 icmp_ignore_bogus_error_responses
tcp_sack                           route
tcp_retrans_collapse               igmp_max_memberships
ip_forward                         inet_peer_threshold
ip_default_ttl                     inet_peer_minttl
ip_autoconfig                      inet_peer_maxttl
ip_no_pmtu_disc                    inet_peer_gc_mintime
ip_nonlocal_bind                   inet_peer_gc_maxtime
tcp_syn_retries                    tcp_orphan_retries
tcp_synack_retries                 tcp_fack
tcp_max_orphans                    tcp_reordering
tcp_max_tw_buckets                 tcp_ecn
ipfrag_high_thresh                 tcp_dsack
ipfrag_low_thresh                  tcp_mem
ip_dynaddr                         tcp_wmem
ipfrag_time                        tcp_rmem
tcp_keepalive_time                 tcp_app_win
tcp_keepalive_probes               tcp_adv_win_scale
tcp_keepalive_intvl                icmp_ratelimit
tcp_retries1                       icmp_ratemask
tcp_retries2                       tcp_tw_reuse
tcp_fin_timeout                    tcp_frto
tcp_tw_recycle                     tcp_low_latency
tcp_abort_on_overflow              ipfrag_secret_interval
tcp_stdurg                         neigh
tcp_rfc1337                        conf
tcp_max_syn_backlog                netfilter
ip_local_port_range                ip_conntrack_max
icmp_echo_ignore_all

ps[edit]

# ps
  PID  Uid     VmSize Stat Command
    1 0           160 S   init
    2 0               SW  [keventd]
    3 0               RWN [ksoftirqd_CPU0]
    4 0               SW  [kswapd]
    5 0               SW  [bdflush]
    6 0               SW  [kupdated]
    7 0               SW  [mtdblockd]
   51 0           648 S   xmldb -n wrgg19_conceptronic_c54brs4a -t
  178 0            96 D   ifconfig eth0 hw ether 00:80:5a:5c:XX:XX up
  213 0           240 S   fresetd
  306 0           280 S   wlxmlpatch
  384 0           208 S   portt
  602 0           240 S   telnetd -l /usr/sbin/login -u admin:(TELNET_PASS) -i br0
  640 0           200 S   -sh
  646 0           224 S   /usr/sbin/login admin (TELNET_PASS)
  647 0           200 S   sh -c /bin/sh
  648 0           260 S   /bin/sh
25616 0           224 S   /usr/sbin/login admin (TELNET_PASS)
25618 0           200 S   sh -c /bin/sh
25619 0           252 S   /bin/sh
17408 0           312 S   udhcpc -i vlan2 -p /var/run/udhcpc-vlan2.pid -s /var/
18076 0           296 S   udhcpd /var/run/udhcpd-br0.conf
18077 0           252 S   dhcpxmlpatch -f /var/run/udhcpd-br0.lease
18103 0           220 S   sh /var/run/http-loop.sh
18117 0           776 S   httpd -s wrgg19_conceptronic_c54brs4a -f /var/etc/htt
18246 0           328 S   dnrd -s 8.8.4.4 -c off
18284 0           256 S   dyndns -S 2 -u (MY_DYNDNS_NAME) -p (MY_DYNDNS_PASS) -i
29534 0           244 S   syslogd -F sysact -F attack -F notice
29542 0           168 S   klogd -l br0 -w vlan2
31497 0           172 R   ps

/var/etc/httpd.cfg[edit]

# cat /var/etc/httpd.cfg
Umask 026

Tuning {
        NumConnections 15
        BufSize 12288
        InputBufSize 4096
        ScriptBufSize 4096
        NumHeaders 100
        Timeout 60
        ScriptTimeout 60
        MaxUploadSize 3735552
}

PIDFile /var/run/httpd.pid
LogGMT On

Control {
        Types {
                text/html { html htm }
                text/xml { xml }
                text/plain { txt }
                image/gif { gif }
                image/jpeg { jpg }
                text/css { css }
                application/ocstream { * }
        }
        Specials {
                Dump { /dump }
                CGI { cgi }
                Imagemap { map }
                Redirect { url }
                Internal { _int }
        }
        External {
                /sbin/atp { php  }
                /sbin/xgi { xgi bin }
                /sbin/sgi { sgi }
        }
        IndexNames { index.html }
}

Server {
        Interface br0
        Virtual {
                AnyHost
                Control {
                        Realm ""
                        UserFile /var/etc/httpasswd
                        Error401File /www/sys/not_auth.php

                        SessionControl On
                        SessionIdleTime 3600
                        SessionMax 8
                        SessionFilter { php xgi _int cgi }
                        ErrorFWUploadFile       /www/sys/wrongImg.htm
                        ErrorCfgUploadFile      /www/sys/wrongConf.htm
                        InfoFWRestartFile       /www/sys/restart.htm
                        InfoCfgRestartFile      /www/sys/restart2.htm
                        Alias /
                        Location /www

                }
                Control {
                        Alias /var
                        Location /var/www
                }

                Control {
                        Alias /HNAP1
                        Location /www/HNAP1
                        External {
                                /usr/sbin/hnap { hnap }
                        }
                        IndexNames { index.hnap }
                }
        }
}

Server {
        Interface br0
        Port 1900
        ServerName "Linux, UPnP/1.0, C54BRS4A Ver 2.00"
        Address 239.255.255.250 # UPnP broadcase
        UDPServer On
        Virtual {
                AnyHost
                Control {
                        Alias /
                        Location /www/upnp
                        External {
                                /usr/sbin/upnpdev { * }
                        }
                }
        }
}

Server {
        Interface br0
        Port 49152
        ServerName "Linux, UPnP/1.0, C54BRS4A Ver 2.00"
        Virtual {
                AnyHost
                Control {
                        Alias /
                        Location /htdocs/upnp
                        External {
                                /usr/sbin/upnpdev { upnp }
                        }
                }
        }
}
Server {
        Interface vlan2
        Port 8000
        Virtual {
                AnyHost
                Control {
                        Realm ""
                        UserFile /var/etc/httpasswd
                        Error401File /www/sys/not_auth.php

                        SessionControl On
                        SessionIdleTime 3600
                        SessionMax 8
                        SessionFilter { php xgi _int cgi }
                        ErrorFWUploadFile       /www/sys/wrongImg.htm
                        ErrorCfgUploadFile      /www/sys/wrongConf.htm
                        InfoFWRestartFile       /www/sys/restart.htm
                        InfoCfgRestartFile      /www/sys/restart2.htm
                        Alias /
                        Location /www

                }
                Control {
                        Alias /var
                        Location /var/www
                }
        }
}

Boot scripts[edit]

In /etc/init.d/rcS

/etc/init.d/S03config[edit]

/etc/init.d/S03config links to /etc/scripts/config.sh

	#!/bin/sh
	nvram=`cat /etc/config/nvram`
	image_sign=`cat /etc/config/image_sign`
	
	case "$1" in
	start)
		echo "Mounting proc and var ..."
		mount -t proc none /proc
		mount -t ramfs ramfs /var
		mkdir -p /var/etc /var/log /var/run /var/state /var/tmp /var/etc/ppp /var/etc/config /var/dnrd /var/etc/iproute2
		echo -n > /var/etc/resolv.conf
		echo -n > /var/TZ
		echo "127.0.0.1 hgw" > /var/hosts
	
		echo "***************  |  SYS:001" > /var/log/messages
	
		echo "Inserting modules ..." > /dev/console
		insmod /lib/modules/sw_tcpip.o
		insmod /lib/modules/ifresetcnt.o
		# wireless driver
		insmod /lib/modules/wlan.o
		insmod /lib/modules/wlan_xauth.o
		insmod /lib/modules/wlan_wep.o
		insmod /lib/modules/wlan_tkip.o
		insmod /lib/modules/wlan_scan_sta.o
		insmod /lib/modules/wlan_scan_ap.o
		insmod /lib/modules/wlan_ccmp.o
		insmod /lib/modules/wlan_acl.o
		insmod /lib/modules/ath_hal.o
		insmod /lib/modules/ath_rate_atheros.o
		# insert module ath_dfs.o for madwifi driver v5.2.0.112
		test -f /lib/modules/ath_dfs.o && insmod /lib/modules/ath_dfs.o
		# get the country code for madwifi, default is fcc.
		ccode=`rgcfg getenv -n $nvram -e countrycode`
		[ "$ccode" = "" ] && ccode="840"
		insmod /lib/modules/ath_ahb.o countrycode=$ccode
	
		wlanconfig ath0 create wlandev wifi0 wlanmode ap
		env_wlan=`rgcfg getenv -n $nvram -e wlanmac`
		[ "$env_wlan" = "" ] && env_wlan="00:13:10:d1:00:02"
		ifconfig ath0 hw ether $env_wlan
		insmod /lib/modules/ar231x_gpio.o
	
		# prepare db...
		echo "Start xmldb ..." > /dev/console
		xmldb -n $image_sign -t > /dev/console &
		sleep 1
		/etc/scripts/misc/profile.sh get
		/etc/templates/timezone.sh set
		/etc/templates/logs.sh
	
		# bring up network devices
		env_wan=`rgcfg getenv -n $nvram -e wanmac`
		[ "$env_wan" = "" ] && env_wan="00:13:10:d1:00:01"
		ifconfig eth0 hw ether $env_wan up
		rgdb -i -s /runtime/wan/inf:1/mac "$env_wan"
	
		TIMEOUT=`rgdb -g /nat/general/tcpidletimeout`
		[ "$TIMEOUT" = "" ] && TIMEOUT=7200 && rgdb -s /nat/general/tcpidletimeout $TIMEOUT
		echo "$TIMEOUT" > /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_timeout_established
	
		# Setup VLAN
		vconfig set_name_type VLAN_PLUS_VID_NO_PAD > /dev/console
		vconfig add eth0 1	> /dev/null 2>&1
		vconfig add eth0 2	> /dev/null 2>&1
		brctl addbr br0 	> /dev/console
		brctl stp br0 off	> /dev/console
		brctl setfd br0 0	> /dev/console
		# Start up LAN interface & httpd
		ifconfig br0 0.0.0.0 up			> /dev/console
		/etc/templates/webs.sh start	> /dev/console
		;;
	stop)
		umount /tmp
		umount /proc
		umount /var
		;;
	esac
	

/etc/init.d/S10system.sh[edit]

/etc/init.d/S10system.sh links to> /etc/scripts/system.sh

	#!/bin/sh
	case "$1" in
	start)
		echo "start fresetd ..."		> /dev/console
		fresetd &
		echo "start scheduled ..."		> /dev/console
		/etc/templates/scheduled.sh start	> /dev/console
		echo "setup layout ..."			> /dev/console
		/etc/scripts/layout.sh start	> /dev/console
		echo "start LAN ..."			> /dev/console
		# SEE BELLOW
		/etc/templates/lan.sh start		> /dev/console
		echo "enable LAN ports ..."		> /dev/console
		# SEE BELLOW
		/etc/scripts/enlan.sh			> /dev/console
		echo "start WLAN ..."			> /dev/console
		/etc/templates/wlan.sh start	> /dev/console
		echo "start Guest Zone"			> /dev/console
		/etc/templates/gzone.sh start > /dev/console
		/etc/templates/enable_gzone.sh start	> /dev/console
		echo "start RG ..."				> /dev/console
		/etc/templates/rg.sh start		> /dev/console
		echo "start DNRD ..."			> /dev/console
		/etc/templates/dnrd.sh start	> /dev/console
		# start telnet daemon MOVED
		#/etc/scripts/misc/telnetd.sh	> /dev/console
		# Start UPNPD
		if [ "`rgdb -i -g /runtime/router/enable`" = "1" ]; then
		echo "start UPNPD ..."			> /dev/console
		/etc/templates/upnpd.sh start	> /dev/console
		fi
		echo "start WAN ..."			> /dev/console
		/etc/scripts/misc/setwantype.sh	> /dev/console
		/etc/templates/wan.sh start		> /dev/console
		echo "start LLD2D ..."			> /dev/console
		/etc/templates/lld2d.sh start	> /dev/console
		if [ "`rgdb -i -g /runtime/func/neaps`" = "1" ]; then
		echo "start Neaps ..."			> /dev/console
		/etc/templates/neaps.sh start	> /dev/console
		fi
		if [ "`rgdb -i -g /runtime/func/lpd`" = "1" ]; then
		echo "start lpd ..."			> /dev/console
		/etc/templates/lpd.sh start		> /dev/console
		fi
		echo "start igmpproxy ..."
		/etc/templates/igmpproxy.sh start > /dev/console
		if [ -f /etc/templates/smbd.sh ]; then
		echo "start smbtree search ..."
		/etc/templates/smbd.sh smbtree_start > /dev/console
		echo "start smbmount ..."
		/etc/templates/smbd.sh smbmount_start > /dev/console
		fi
		if [ -f /etc/templates/ledctrl.sh ]; then
		echo "Change the STATUS LED..."
		/etc/templates/ledctrl.sh STATUS GREEN > /dev/console
		fi
		if [ -f /etc/scripts/misc/profile_ca.sh ]; then
		echo "get certificate file ..."			> /dev/console
		/etc/scripts/misc/profile_ca.sh start	> /dev/console
		fi
		if [ -f /etc/templates/wimax.sh ]; then
		echo "start wimax connection ..."
		/etc/templates/wimax.sh start > /dev/console
		fi
		# ONCE CONFIGURED var/etc/httpasswd BY PROFILE,
		# START TELNET WITH SAME ADMIN/PASSWORD WITH SAME DATA THAN WEB CONFIG
		/etc/scripts/misc/telnetd.sh	> /dev/console
		# START FTP DAEMON
		#/etc/scripts/misc/ftpd.sh	> /dev/console
		# AWAITING FOR INCOMING LIVE CONFIG,
		/etc/scripts/misc/remotecmd.sh	> /dev/console
		;;
	stop)
		if [ -f /etc/templates/wimax.sh ]; then
		echo "stop wimax connection ..."
		/etc/templates/wimax.sh stop > /dev/console
		fi
		echo "stop igmpproxy ..."
		/etc/templates/igmpproxy.sh stop > /dev/console
		if [ "`rgdb -i -g /runtime/func/lpd`" = "1" ]; then
		echo "stop lpd ..."				> /dev/console
		/etc/templates/lpd.sh stop		> /dev/console
		fi
		if [ "`rgdb -i -g /runtime/func/neaps`" = "1" ]; then
		echo "stop Neaps ..."			> /dev/console
		/etc/templates/neaps.sh stop	> /dev/console
		fi
		echo "stop LLD2D ..."			> /dev/console
		/etc/templates/lld2d.sh stop	> /dev/console
		echo "stop WAN ..."				> /dev/console
		/etc/templates/wan.sh stop		> /dev/console
		if [ "`rgdb -i -g /runtime/router/enable`" = "1" ]; then
		echo "stop UPNPD ..."			> /dev/console
		/etc/templates/upnpd.sh stop	> /dev/console
		fi
		echo "stop DNRD ..."			> /dev/console
		/etc/templates/dnrd.sh stop		> /dev/console
		echo "stop RG ..."				> /dev/console
		/etc/templates/rg.sh stop		> /dev/console
		echo "stop Guest Zone ..."		> /dev/console
		/etc/templates/enable_gzone.sh stop > /dev/console
		/etc/templates/gzone.sh stop	> /dev/console
		echo "stop WLAN ..."			> /dev/console
		/etc/templates/wlan.sh stop		> /dev/console
		echo "stop LAN ..."				> /dev/console
		/etc/templates/lan.sh stop		> /dev/console
		echo "reset layout ..."			> /dev/console
		/etc/scripts/layout.sh stop		> /dev/console
		echo "stop scheduled ..."			> /dev/console
		/etc/templates/scheduled.sh stop		> /dev/console
		echo "stop fresetd ..."			> /dev/console
		# KILL ONLY FTP DAEMON
		killall stupid-ftpd
		killall fresetd
		;;
	restart)
		sleep 3
		$0 stop
		$0 start
		;;
	*)
		echo "Usage: system.sh {start|stop|restart}"
		;;
	esac
	exit 0

/etc/scripts/layout.sh[edit]

/etc/scripts/layout.sh start generates /var/run/layout_start.sh

		#!/bin/sh
		echo [$0] $1 ... > /dev/console
		echo Start router layout ...
		echo "WRITE 29 24 1"    > /proc/driver/ae531x
		echo "WRITE 29 25 1"    > /proc/driver/ae531x
		echo "WRITE 29 26 1"    > /proc/driver/ae531x # parece q encienden/apagan
		echo "WRITE 29 27 1"    > /proc/driver/ae531x
		echo "WRITE 29 28 2"    > /proc/driver/ae531x
		echo "WRITE 29 30 2"    > /proc/driver/ae531x
		echo "WRITE 29 23 07c2" > /proc/driver/ae531x
		echo "WRITE 30 1 2f00"  > /proc/driver/ae531x
		echo "WRITE 30 2 0030"  > /proc/driver/ae531x
		echo "WRITE 30 9 1089"  > /proc/driver/ae531x
		ifconfig vlan1 up
		ifconfig vlan2 up
		brctl addif br0 ath0
		brctl addif br0 vlan1
		brctl setbwctrl br0 ath0 900
		ifconfig br0 up
		rgdb -i -s /runtime/router/enable 1

/etc/templates/lan.sh generates /var/run/lan_start.sh

		#!/bin/sh
		echo [$0] ... > /dev/console
		echo "Start LAN (br0/192.168.0.2/255.255.255.0)..." > /dev/console
		ifconfig br0 192.168.0.2 netmask 255.255.255.0
		echo "Start DHCP server (br0) ..." > /dev/console
		echo -n > /var/run/udhcpd-br0.lease
		udhcpd /var/run/udhcpd-br0.conf &
		dhcpxmlpatch -f /var/run/udhcpd-br0.lease &
		echo $! > /var/run/dhcppatch-br0.pid
		hostname
		if [ -f /usr/sbin/igmpproxy ]; then
		echo "Start igmp ..." > /dev/console
			/etc/templates/igmpproxy.sh start
		fi

/etc/scripts/enlan.sh

		#!/bin/sh
		##define IP_CTRL_SOFTWARE_RESET        0x8000
		#define	PHY_SW_RST	0x8000
		echo "WRITE 0 0 8000" > /proc/driver/ae531x
		echo "WRITE 1 0 8000" > /proc/driver/ae531x
		echo "WRITE 2 0 8000" > /proc/driver/ae531x
		echo "WRITE 3 0 8000" > /proc/driver/ae531x

/etc/templates/wlan.sh

#!/bin/sh
echo [$0] $1 ... > /dev/console
TEMPLATES="/etc/templates/wifi"
case "$1" in
start|restart)
	[ -f /var/run/wlan_stop.sh ] && sh /var/run/wlan_stop.sh > /dev/console
    rgdb -A $TEMPLATES/wlan_run.php -V generate_start=1 > /var/run/wlan_start.sh
    rgdb -A $TEMPLATES/wlan_run.php -V generate_start=0 > /var/run/wlan_stop.sh
    sh /var/run/wlan_start.sh > /dev/console
	;;
stop)
	if [ -f /var/run/wlan_stop.sh ]; then
    	sh /var/run/wlan_stop.sh > /dev/console
    	rm -f /var/run/wlan_stop.sh
	fi
	;;
*)
	echo "$0 [start|stop|restart]" > /dev/console
	;;
esac

/var/run/wlan-start.sh

# cat wlan_start.sh WEP, NO FILTER MAC
#!/bin/sh
echo [$0] ... > /dev/console
echo Start WLAN interface ath0 ... > /dev/console
iwpriv ath0 mode 2
iwpriv ath0 pureg 0 #pure g mode
iwpriv ath0 wmm 1
iwpriv ath0 doth 0 # 802.11h Support 1=Enable/0=Disable
iwconfig ath0 channel 5
iwpriv ath0 bintval 100
iwconfig ath0 rts 2346
iwconfig ath0 frag 2346
iwpriv ath0 dtim_period 1
iwpriv ath0 hide_ssid 0
iwconfig ath0 rate auto
iwconfig ath0 txpower 17
echo "To set txrate to (0M). set txpower to (17db)"
iwpriv ath0 protmode 0
iwpriv ath0 xr 0
echo 1 > /proc/net/br_forward_br0
iwpriv ath0 ap_bridge 1 # allow connected clients to access each other.
iwpriv ath0 maccmd 3 #clear the mac list
iwpriv ath0 maccmd 0
echo Start WLAN interface ath0 ... > /dev/console
iwpriv ath0 authmode 1
iwconfig ath0 key s:"(MY PASS)" [1]
iwconfig ath0 essid "WLAN_22"
ifconfig ath0 up
sleep 1

Default config[edit]

Mac:

It went unbootable when I set up 7D:4A:07:D3:A0:6C as wifi0 MAC. While in recovery mode, it identified as D-Link_53:11:01 (00:80:c8:53:11:01)

defaultvalue.xml contents:

<wrgg19_conceptronic_c54brs4a>
	<wan>
		<rg>
			<inf id="1">
				<mode>2</mode>
				<etherlinktype>0</etherlinktype>
				<static>
					<ip></ip>
					<netmask></netmask>
					<gateway></gateway>
					<clonemac></clonemac>
					<mtu>1500</mtu>
				</static>
				<dhcp>
					<clonemac></clonemac>
					<autodns>1</autodns>
					<mtu>1500</mtu>
				</dhcp>
				<pppoe>
					<mode>2</mode>
					<staticip></staticip>
					<user></user>
					<password></password>
					<acname></acname>
					<acservice></acservice>
					<autoreconnect>1</autoreconnect>
					<ondemand>0</ondemand>
					<idletimeout>0</idletimeout>
					<autodns>1</autodns>
					<mtu>1492</mtu>
					<clonemac></clonemac>
				</pppoe>
				<pptp>
					<mode>2</mode>
					<ip></ip>
					<netmask></netmask>
					<gateway></gateway>
					<dns></dns>
					<serverip></serverip>
					<user></user>
					<password></password>
					<autoreconnect>1</autoreconnect>
					<ondemand>0</ondemand>
					<idletimeout>0</idletimeout>
					<autodns>1</autodns>
					<mtu>1400</mtu>
				</pptp>
				<l2tp>
					<mode>2</mode>
					<ip></ip>
					<netmask></netmask>
					<gateway></gateway>
					<dns></dns>
					<serverip></serverip>
					<user></user>
					<password></password>
					<autoreconnect>1</autoreconnect>
					<ondemand>0</ondemand>
					<idletimeout>0</idletimeout>
					<autodns>1</autodns>
					<mtu>1400</mtu>
				</l2tp>
			</inf>
		</rg>
	</wan>
	<lan>
		<ethernet>
			<ip>192.168.0.1</ip>
			<netmask>255.255.255.0</netmask>
		</ethernet>
		<dhcp>
			<mode>1</mode>
			<server>
				<enable>1</enable>
				<pool id="1">
					<startip>192.168.0.100</startip>
					<endip>192.168.0.199</endip>
					<netmask>255.255.255.0</netmask>
					<domain></domain>
					<leasetime>604800</leasetime>
					<staticdhcp>
						<enable>1</enable>
					</staticdhcp>
				</pool>
			</server>
		</dhcp>
	</lan>
	<dnsrelay>
		<mode>2</mode>
		<server>
			<primarydns></primarydns>
			<secondarydns></secondarydns>
		</server>
	</dnsrelay>
	<nat>
		<enable>1</enable>
		<general>
			<gamingmode>1</gamingmode>
		</general>
		<dmzsrv>
			<enable>0</enable>
			<ip>192.168.0.0</ip>
		</dmzsrv>
		<passthrough>
			<pppoe>1</pppoe>
			<ipsec>1</ipsec>
			<pptp>1</pptp>
			<l2tp>1</l2tp>
		</passthrough>
	</nat>
	<security>
		<dos>
			<enable>1</enable>
		</dos>
		<log>
			<systeminfo>1</systeminfo>
			<debuginfo>0</debuginfo>
			<attackinfo>1</attackinfo>
			<droppacketinfo>0</droppacketinfo>
			<noticeinfo>1</noticeinfo>
		</log>
		<firewall>
			<pingallow>1</pingallow>
			<httpallow>0</httpallow>
			<httpremoteip></httpremoteip>
			<httpremoteport>8080</httpremoteport>
		</firewall>
		<macfilter>
			<action>0</action>
			<enable>0</enable>
		</macfilter>
		<domainblocking>
			<enable>0</enable>
		</domainblocking>
		<urlblocking>
			<enable>0</enable>
		</urlblocking>
	</security>
	<upnp>
		<enable>1</enable>
		<log>1</log>
		<pppoesession>0</pppoesession>
		<allow_disconnect_wan>1</allow_disconnect_wan>
	</upnp>
	<time>
		<syncwith>0</syncwith>
		<timezone>28</timezone>
		<daylightsaving>0</daylightsaving>
		<ntpserver>
			<ip>2.conceptronic.pool.ntp.org</ip>
			<interval>86400</interval>
		</ntpserver>
	</time>
	<sys>
		<hostname>c54brs4a</hostname>
		<sessiontimeout>300</sessiontimeout>
		<locale>en</locale>
		<countrycode>826</countrycode>
		<user id="1">
			<name>admin</name>
			<password>admin</password>
			<group>0</group>
		</user>
	</sys>
	<wireless>
		<enable>1</enable>
		<ssid>C54BRS4A</ssid>
		<autochannel>0</autochannel>
		<channel>6</channel>
		<authtype>0</authtype>
		<encrypttype>0</encrypttype>
		<wep>
			<length>64</length>
			<format>2</format>
			<defkey>1</defkey>
		</wep>
		<ssidhidden>0</ssidhidden>
		<wlanmode>3</wlanmode>
		<beaconinterval>100</beaconinterval>
		<fraglength>2346</fraglength>
		<rtslength>2346</rtslength>
		<ctsmode>0</ctsmode>
		<preamble>2</preamble>
		<txrate>0</txrate>
		<txpower>1</txpower>
		<dtim>1</dtim>
		<atheros>
			<supermode>0</supermode>
			<xr>0</xr>
		</atheros>
		<wps>
			<enable>0</enable>
			<configured>0</configured>
		</wps>
		<wpa>
			<radius id="1">
				<port>1812</port>
			</radius>
		</wpa>
		<wmm>1</wmm>
	</wireless>
</wrgg19_conceptronic_c54brs4a>

Route/Bridge layout[edit]

There are 3 'hidden pages' which are supposed to change this, but I've never tried, though: dev_bridge_dhcp.php dev_bridge_static.php dev_router_lan.php If you are willing to give them a try, please be careful, you could get your device bricked.

Also, the scripts above seem interesting:

/etc/scripts/layout.sh

#!/bin/sh
echo [$0] $1 ... > /dev/console
case "$1" in
start)
	[ -f /var/run/layout_stop.sh ] && sh /var/run/layout_stop.sh > /dev/console
	rgdb -A /etc/scripts/layout_run.php -V generate_start=1 > /var/run/layout_start.sh
	rgdb -A /etc/scripts/layout_run.php -V generate_start=0 > /var/run/layout_stop.sh
	sh /var/run/layout_start.sh > /dev/console
	;;
stop)
	[ -f /var/run/layout_stop.sh ] && sh /var/run/layout_stop.sh > /dev/console
	rm -f /var/run/layout_stop.sh
	;;
*)
	echo "Usage: $0 {start|stop}"
	;;
esac


/etc/scripts/layout_run.php

#!/bin/sh
echo [$0] $1 ... > /dev/console
<?
/* vi: set sw=4 ts=4: */
require("/etc/templates/troot.php");
/*
	echo "config vlan ..." > /dev/console
	# PHY 29, MII [28-24] - VLAN ID of Port [4-0]
	echo "WRITE 29 24 3" > /proc/driver/ae531x
	echo "WRITE 29 25 3" > /proc/driver/ae531x
	echo "WRITE 29 26 3" > /proc/driver/ae531x
	echo "WRITE 29 27 3" > /proc/driver/ae531x
	echo "WRITE 29 28 5" > /proc/driver/ae531x
	# PHY 29, MII 30 - default VLAN ID of Port 5 (cpu)
	echo "WRITE 29 30 5" > /proc/driver/ae531x
	# PHY 29, MII 23[10 to 6] - remove VLAN tags for Port [4-0]
	# bit   5432 1098 7654 3210
	# value 0000 0111 1100 0010 = 07c2
	# bit   15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
	# value  0  0  0  0  0 1  1 1 1 1 0 0 0 0 1 0 = 07c2
	# [1] add tags for Port 5 (cpu)
	echo "WRITE 29 23 07c2" > /proc/driver/ae531x
	# PHY 30, MII 2[13:8] - VLAN3 output port mask
	echo "WRITE 30 2 2f30" > /proc/driver/ae531x
	# PHY 30, MII 3[13:8] - VLAN5 output port mask
	echo "WRITE 30 3 303f" > /proc/driver/ae531x
	# PHY 30, MII 9
	# bit   2 1098 7654 3210
	# value 1 0000 1000 1001 = 0x1089
	# bit   12 11 10 9 8 7 6 5 4 3 2 1 0
	# value  1  0  0 0 0 1 0 0 0 1 0 0 1 = 0x1089
	# [12 to 8] Set Port [4-0] as WAN port
	# [7] Enable tag VLAN function
	# [3] Enable router function
	# [2 to 0] LAN group number
	echo "WRITE 30 9 1089" > /proc/driver/ae531x
*/
$mii_dev = "/proc/driver/ae531x";
$bridge = query("/bridge");
if ($bridge!=1)	{ $router_on = 1; }
else			{ $router_on = 0; }

if ($router_on==1)
{
	if ($generate_start==1)
	{
		echo "echo Start router layout ...\n";
		if (query("/runtime/router/enable")==1)
		{
			echo "echo Already in router mode!\n";
			exit;
		}
		echo "echo \"WRITE 29 24 1\"    > ".$mii_dev."\n";
		echo "echo \"WRITE 29 25 1\"    > ".$mii_dev."\n";
		echo "echo \"WRITE 29 26 1\"    > ".$mii_dev."\n";
		echo "echo \"WRITE 29 27 1\"    > ".$mii_dev."\n";
		echo "echo \"WRITE 29 28 2\"    > ".$mii_dev."\n";
		echo "echo \"WRITE 29 30 2\"    > ".$mii_dev."\n";
		echo "echo \"WRITE 29 23 07c2\" > ".$mii_dev."\n";
		#^bit   15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
		# value  0  0  0  0  0 1  1 1 1 1 0 0 0 0 1 0 = 07c2
		# [10 to 6] - remove VLAN tags for Port [4-0]
		# [1] add tags for Port 5 (cpu)
		echo "echo \"WRITE 30 1 2f00\"  > ".$mii_dev."\n";
		echo "echo \"WRITE 30 2 0030\"  > ".$mii_dev."\n";
		echo "echo \"WRITE 30 9 1089\"  > ".$mii_dev."\n";
		echo "ifconfig vlan1 up\n";
		echo "ifconfig vlan2 up\n";
		echo "brctl addif br0 ath0\n";
		echo "brctl addif br0 vlan1\n";
		echo "brctl setbwctrl br0 ath0 900\n";
		echo "ifconfig br0 up\n";
		echo "rgdb -i -s /runtime/router/enable 1\n";
	}
	else
	{
		echo "brctl delif br0 vlan1\n";
		echo "brctl delif br0 ath0\n";
		echo "ifconfig vlan1 down\n";
		echo "ifconfig vlan2 down\n";
		echo "rgdb -i -s /runtime/router/enable \"\"\n";
	}
}
else
{
	if ($generate_start==1)
	{
		echo "echo Start bridge layout ...\n";
		if (query("/runtime/router/enable")==0)
		{
			echo "echo Already in bridge mode!\n";
			exit;
		}
		echo "echo \"WRITE 29 24 1\"    > ".$mii_dev."\n"; #NIC is aside the antenna
		echo "echo \"WRITE 29 25 1\"    > ".$mii_dev."\n";
		echo "echo \"WRITE 29 26 1\"    > ".$mii_dev."\n";
		echo "echo \"WRITE 29 27 1\"    > ".$mii_dev."\n"; #Nic is aside the WAN port
		echo "echo \"WRITE 29 28 1\"    > ".$mii_dev."\n";
		echo "echo \"WRITE 29 30 1\"    > ".$mii_dev."\n";
		echo "echo \"WRITE 29 23 07c0\" > ".$mii_dev."\n";
		#^bit   15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
		# value  0  0  0  0  0 1  1 1 1 1 0 0 0 0 0 0 = 07c0
		# [10 to 6] - remove VLAN tags for Port [4-0]
		# [1] add tags for Port 5 (cpu)
		echo "echo \"WRITE 30 9 0000\"  > ".$mii_dev."\n";
		echo "brctl addif br0 eth0\n";
		echo "brctl addif br0 ath0\n";
		echo "brctl setbwctrl br0 ath0 900\n";
		echo "ifconfig br0 up\n";
		echo "rgdb -i -s /runtime/router/enable 0\n";
	}
	else
	{
		echo "echo Stop bridge layout ...\n";
		echo "brctl delif br0 ath0\n";
		echo "brctl delif br0 eth0\n";
		echo "rgdb -i -s /runtime/router/enable \"\"\n";
	}
}
?>

Isolate a LAN port[edit]

LAN ports used to be assigned to vlan1. Let's change one of them:

vconfig add eth0 6 # don't use vlan 3-5
ifconfig vlan6 up
echo "WRITE 29 24 6" > /proc/driver/ae531x # Rear port 4 goes to vlan6
brctl addif br0 vlan6 # if you don't add it to the brigde, that IP will have no networking
route add -host 192.168.0.102 dev vlan6

now, route should give out sort of this:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.102   *               255.255.255.255 UH    0      0        0 vlan6
192.168.0.0     *               255.255.255.0   U     0      0        0 br0
77.27.16.0      *               255.255.248.0   U     0      0        0 vlan2
239.0.0.0       *               255.0.0.0       U     0      0        0 br0
default         1.16.27.77.dyna 0.0.0.0         UG    0      0        0 vlan2
# ^ note that I'm running one more brigde in my computer, between the router and my ISP.

Duplicate traffic[edit]

Actually, this will not work unless you patch the kernel with and added feature, although there is an easier working way of "teeing", but only UPD (use google);

Esto no funciona sin parchear el núcleo.

Con esto ya basta ejecutar el siguiente comando en el sistema remoto para para retransmitir con iptables [28] hacia nuestro sistema de monitorización:

iptables -t mangle -I FORWARD -j ROUTE -- gw 192.168.100.21 -- tee

Sin embargo, si deseamos ver todo el tráfico que se intenta enviar un host concreto, en este caso 192.168.100.22, deberíamos hacer la retransmisión antes que en la subtabla FORWARD por si las reglas de filtrado actuasen antes de dicha subtabla eliminando paquetes que el host está enviando:

                                              ı    a
iptables -t mangle -I PREROUTING -s 192.168.0.102 -j ROUTE -- gw 192.168.0.104 -- tee
iptables -t mangle -I POSTROUTING -d 1 92.168.0.102 -j ROUTE -- gw 192.168.0.104 -- tee

Assorted RGDB info[edit]

# rgdb -i -g /runtime/wan/inf:1/gateway < it gives out your ISP gateway

if( get("j",$_PREFIX."/wan/rg/inf:1/mode") == "5" )

$path = $prefix."/wan/rg/inf:1/l2tp/mode";
$l2tpMode = get("j",$path);
$path = $prefix."/wan/rg/inf:1/l2tp/ip";
$l2tpIp = get("j",$path);
$path = $prefix."/wan/rg/inf:1/l2tp/netmask";
$l2tpMask = get("j",$path);
$path = $prefix."/wan/rg/inf:1/l2tp/gateway";
$l2tpGw = get("j",$path);
$path = $prefix."/wan/rg/inf:1/l2tp/dns";
$l2tpDns = get("j",$path);
$path = $prefix."/wan/rg/inf:1/l2tp/serverip";
$l2tpSrvIp = get("j",$path);
$path = $prefix."/wan/rg/inf:1/l2tp/user";
$l2tpUser = get("j",$path);
$path = $prefix."/wan/rg/inf:1/l2tp/password";
$l2tpPass = get("j",$path);
$l2tpPass = $G_PASSWORD;
$path = $prefix."/wan/rg/inf:1/l2tp/autoreconnect";
$l2tpAuto = get("j",$path);
$path = $prefix."/wan/rg/inf:1/l2tp/ondemand";
$l2tpDemand = get("j",$path);
$path = $prefix."/wan/rg/inf:1/l2tp/idletimeout";
$l2tpIdle = get("j",$path);
$path = $prefix."/wan/rg/inf:1/l2tp/mtu";

$path = $prefix."/wan/rg/inf:1/dhcp/clonemac";

$path = $_PREFIX."/lan/ethernet/ip";
$lanIp = get("j", $path );
$path = $_PREFIX."/lan/ethernet/netmask";
$lanMask = get("j", $path );
$path = $_PREFIX."/sys/hostname";
$hostName = get("j", $path );
$path = $PREFIX."/dnsrelay/mode";
$dnsMode = get("j", $path );
$checkIP = get("j", "/lan/ethernet/ip");
$checkMask = get("j", "/lan/ethernet/netmask");
# rgdb -i -g /lan/ethernet/ip < it gives out the router's IP (LAN gateway)

$wanIp = get("h", "/wan/rg/inf:1/static/ip");

# cable status
xmldbc -x /runtime/switch/port:1/linktype		"get:psts -i 3"
xmldbc -x /runtime/switch/port:2/linktype		"get:psts -i 2"
xmldbc -x /runtime/switch/port:3/linktype		"get:psts -i 1"
xmldbc -x /runtime/switch/port:4/linktype		"get:psts -i 0"
xmldbc -x /runtime/switch/wan_port				"get:psts -i 4"

# rgdb -i -g /runtime/layout/wanif
vlan2
# rgdb -i -g /runtime/layout/lanif
br0
# rgdb -i -g /runtime/layout/wlanif
ath0