==== 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@ * 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 ==== * [[https://github.com/hynnet/openwrt-mt7620|openWRT-mt7620]] - an openWRT build that include ralink-utils which has ated and friends * [[https://www.gargoyle-router.com/old-openwrt-coding.html|compiling a simple program for openWRT]] * [[https://watchmysys.com/blog/2015/10/build-package-your-software-for-openwrt/|building and packaging your own software for openWRT]] * [[https://wiki.openwrt.org/doc/howtobuild/single.package|how to build a single package]] ==== RT5350 SDK Firmware ==== * [[https://github.com/noblepepper/ralink_sdk|RT5350 SDK]] ===== 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: ==== * https://wiki.openwrt.org/toh/hame/mpr-a2 * [[https://wiki.openwrt.org/doc/howto/buildroot.exigence.macosx|build openWRT on Mac OS]] (works on High Sierra) * [[https://wiki.openwrt.org/doc/howto/build#make_menuconfig|configuring and building openWRT]] * [[https://wiki.openwrt.org/doc/howto/firstlogin|first login]] (telnet, serial port, ssh, etc.) * [[http://www.jauu.net/2015/03/03/complete-openwrt-guide/|some sort of guide I thought was important at one point]] * [[https://wiki.openwrt.org/doc/uci/wireless|turning on the wireless]] (required for attached firmware) * [[https://forum.openwrt.org/viewtopic.php?id=32810|router buttons]] * [[https://wiki.openwrt.org/doc/uci/network#protocol_dhcp|configuring openWRT network]] * [[https://wiki.openwrt.org/doc/techref/netifd|network interface daemon]] * [[https://wiki.openwrt.org/doc/howto/generic.flashing.serial|update firmware via serial port (Kermit)]] * [[https://www.gargoyle-router.com/old-openwrt-coding.html|compiling a simple c program]] * [[https://github.com/hynnet/openwrt-mt7620/tree/master/package/ralink-utils|ated and friends?]] * [[https://www.mail-archive.com/search?l=toybox@lists.landley.net&q=subject:%22%5C%5BToybox%5C%5D+Make+Errors%22&o=newest&f=1|fixed some sort of Make error with new GNU compiler]] ==== 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:%%//%%www.script-tutorials.com/demos/199/index.html * 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// {{ :lwc:hardware:wm02_nano_router:openwrt-ramips-rt305x-vmlinux.bin |}} {{ :lwc:hardware:wm02_nano_router:lede-ramips-rt305x-mpr-a1-squashfs-sysupgrade.bin |}}