Summary
- seems to have ralink RT3052 chipset
- the included openWRT firmware was compiled for hame mpr-a2 so this appears to be a clone. Update: it's an mpr-a1 clone. mpr-a2 openwrt/lede firmware does not allow for dhcp client to work correctly on ethernet port
Commands:
- Enable wireless:
uci set wireless.@wifi-device[0].disabled=0; uci commit wireless; wifi
- Reset to factory defaults:
- mount_root
- mtd -r erase rootfs_data
- reboot -f
- 1to see see iptables rules generated: use fw3 print
- with a “deny all” rules the below rules would allow LAN to access snappykids.cc IP only
- iptables -t filter -I zone_wan_output -p tcp -d 173.236.164.109/255.255.255.255 -m comment –comment “!fw3: allow-SnappyKids” -j zone_wan_dest_ACCEPT
- iptables -t filter -I zone_wan_output -p udp -d 173.236.164.109/255.255.255.255 -m comment –comment “!fw3: allow-SnappyKids” -j zone_wan_dest_ACCEPT
- sysupgrade from cmd line: sysupgrade -v /tmp/filename-of-downloaded-sysupgrade.bin
- Use flag -n if configuration flags should not be kept
- to monitor packets being transmitted use tcpdump. It only catches packets that are actually transmitted tho maybe and not stuff blocked by iptables?
- use logread not dmsg to see messages from startup
- enable init script with /etc/init.d/script enable
- get the MAC address of the router: arp -n | grep `route -n | awk '/UG/{1print $2}'` | awk '{print $4}'
- “B” has 00:00:00:04:6d:b3
- on 8-Mar-2018 “B” has 50:6a:03:a5:4a:1a (?)
- eth0, eth0.1, br-lan, wlan0 has 00:0A:EB:38:0D:4D
- eth0.2 has 02:0A:EB:38:0D:4E
- stock: 78:20:08:00:97:5B
- stock labeled “standard”: 78:20:08:00:97:5f
- log example: logger testLog “Blah1” # testlog writes “Blah1”
- to get sshfs to work do an opkg update then opkg install openssh-sftp-server
- hexdump -C shows you file contents with hex
- mount example for fat32 read only: mount -t vfat /dev/sdc2 /mnt/share -o ro
- using opkg:
- use –force-depends if the kernel version doesn't match.
- get link status of ethernet port: dmesg | tail | grep “link changed” | tail -c 3 | head -c 1
- memory usage by process: cat /proc/meminfo
Host Machine
- to get leases: cat /var/lib/misc/dnsmasq.leases
SSH in:
- must ssh in as root. The magical incantation is: ssh -i /path/to/nano1_rsa root@<IP ADDRESS>
- if the certificate fails, make sure PubkeyAuthentication no is commented out in /etc/ssh/ssh_config
- it may be necessary to restart the ssh service after making this change: sudo systemctl reload ssh.service
OpenWRT and firmware
- openWRT-mt7620 - an openWRT build that include ralink-utils which has ated and friends
-
RT5350 SDK Firmware
NTP server
- add into /etc/config/dhcp in the lan area: list dhcp_option '42,192.168.53.1' (assuming 192.168.53.1 is the address of the nano router itself on the lan)
- not sure if it matters or not but in /etc/config/system we have
config timeserver 'ntp' option enabled '1' option enable_server '1'
- not sure why but ESP8266 isn't always getting it
Dumb AP:
(based on https://openwrt.org/docs/guide-user/network/wifi/dumbap)
Change /etc/config/network to read:
config interface 'loopback' option ifname 'lo' option proto 'static' option ipaddr '127.0.0.1' option netmask '255.0.0.0' config globals 'globals' option ula_prefix 'fd38:6ad4:9ddd::/48' config interface 'lan' option type 'bridge' option ifname 'eth0.1' option proto 'dhcp' config device 'lan_dev' option name 'eth0.1' config switch option name 'rt305x' option reset '1' option enable_vlan '1' config switch_vlan option device 'rt305x' option vlan '1' option ports '0 1 2 3 4 6t'
Disable DHCP server, DHCP6 server, firewall, acceptions:
/etc/init.d/dnsmasq disable /etc/init.d/dnsmasq stop /etc/init.d/odhcpd disable /etc/init.d/odhcpd stop /etc/init.d/firewall disable /etc/init.d/firewall stop /etc/init.d/acceptions disable /etc/init.d/acceptions stop
Restart network:/etc/init.d/network reload
Links:
- build openWRT on Mac OS (works on High Sierra)
- first login (telnet, serial port, ssh, etc.)
- turning on the wireless (required for attached firmware)
Loading new images
TFTP
- sudo apt install tftpd-hpa
- set serial baud rate to 57600
- choose option “2” in bootloader
- firmware goes in /var/lib/tftpboot
Uploading with pure HTML/CSS:
- https://codepen.io/anon/pen/zRbdRp
Memory Layout:
dev: size erasesize name mtd0: 00030000 00001000 "u-boot" mtd1: 00010000 00001000 "u-boot-env" mtd2: 00010000 00001000 "factory" mtd3: 003b0000 00001000 "firmware" mtd4: 00126852 00001000 "kernel" mtd5: 002897ae 00001000 "rootfs" mtd6: 000c0000 00001000 "rootfs_data" 0x00000000-0x00800000 : "ALL" 0x00000000-0x00030000 : "Bootloader" 0x00030000-0x00040000 : "Config" 0x00040000-0x00050000 : "Factory" 0x00050000-0x01000000 : "Kernel"
from the stock:
/proc/mtd# cat /proc/mtd dev: size erasesize name mtd0: 00800000 00010000 "ALL" mtd1: 00030000 00010000 "Bootloader" mtd2: 00010000 00010000 "Config" mtd3: 00010000 00010000 "Factory" mtd4: 007b0000 00010000 "Kernel"
Todo:
- check the allow dns rule
- family ipv4 or ipv6 stuff
- remove everything about ipv6 except disable?
Attached: latest mpr-a1 LEDE firmware with bitbucket customizations