Linksys AC Series Router Configuration Tips for OpenWRT: Difference between revisions
| Line 386: | Line 386: | ||
It is recommended to make sure the destination partition is the same size or larger of course. Be prepared to wait a while, even on a USB 3.0 port. | It is recommended to make sure the destination partition is the same size or larger of course. Be prepared to wait a while, even on a USB 3.0 port. | ||
*dd if=/dev/sda1 of=/dev/sda2 status=progress | *dd if=/dev/sda1 of=/dev/sda2 status=progress (to take advantage of the "status=progress" feature, the full version of dd must be installed: opkg install coreutils-dd) | ||
Note: After cloning, to save confusion and sanity, remove the source drive. It also may be necessary to reboot the router or dismount and mount the drive if it was already mounted to see the "cloned" directories and files. All of this is necessary because ''everything'' is cloned and OpenWRT may display two /dev/sdX devices that are exactly the same (IE sdb1 and sdb1 as two distinct, but duplicate device partitions). | Note: After cloning, to save confusion and sanity, remove the source drive. It also may be necessary to reboot the router or dismount and mount the drive if it was already mounted to see the "cloned" directories and files. All of this is necessary because ''everything'' is cloned and OpenWRT may display two /dev/sdX devices that are exactly the same (IE sdb1 and sdb1 as two distinct, but duplicate device partitions). | ||
| Line 2,250: | Line 2,250: | ||
====Alternate Shells==== | ====Alternate Shells==== | ||
OpenWRT uses the ASH (put in CAPS to make it stand out, but technically correctly referred to as ash) as the default shell within the BusyBox Binary / Executable. There are other choices. See the following two articles for an excellent explanation; | OpenWRT uses the ASH (put in CAPS to make it stand out, but technically correctly referred to as ash, same for bash / BASH) as the default shell within the BusyBox Binary / Executable. There are other choices. See the following two articles for an excellent explanation; | ||
*https://www.howtogeek.com/68563/htg-explains-what-are-the-differences-between-linux-shells/ | *https://www.howtogeek.com/68563/htg-explains-what-are-the-differences-between-linux-shells/ | ||
| Line 2,257: | Line 2,257: | ||
To install the ''chsh'' utility: opkg install shadow-chsh | To install the ''chsh'' utility: opkg install shadow-chsh | ||
===== Login ===== | =====Login===== | ||
When logging into a command prompt via SSH, by default DropBear is the SSH / SSHD Server / Daemon that responds. Various things take place as configured in the /etc/init.d/dropbear file which also calls other scripts, including /lib/functions.sh and other scripts in the /lib/functions directory. A quick examination of the scripts seem to indicate the capacity to detect if a full version of BASH has been installed, but upon testing it doesn't work (if the functionality is there at all). To change the login shell, edit the /etc/passwd file (Caution: it is recommended to leave a shell open that will continue to use the old settings if something goes wrong). | When logging into a command prompt via SSH, by default DropBear is the SSH / SSHD Server / Daemon that responds. Various things take place as configured in the /etc/init.d/dropbear file which also calls other scripts, including /lib/functions.sh and other scripts in the /lib/functions directory. A quick examination of the scripts seem to indicate the capacity to detect if a full version of BASH has been installed, but upon testing it doesn't work (if the functionality is there at all). To change the login shell, edit the /etc/passwd file (Caution: it is recommended to leave a shell open that will continue to use the old settings if something goes wrong when modifying the shell). | ||
===== SHELLS File ===== | * ASH: root:x:0:0:root:/root:/bin/ash | ||
* BASH: root:x:0:0:root:/root:/bin/bash | |||
=====SHELLS File===== | |||
The /etc/shells file contains a list of the various shells installed. By default, it contains a single line: /bin/ash | The /etc/shells file contains a list of the various shells installed. By default, it contains a single line: /bin/ash | ||
===== ASH (the BusyBox version of BASH (much smaller)) ===== | =====ASH (the BusyBox version of BASH (much smaller))===== | ||
Both /bin/''sh'' and /bin/''ash'' redirect to /etc/busybox by default in OpenWRT. | Both /bin/''sh'' and /bin/''ash'' redirect to /etc/busybox by default in OpenWRT. | ||
Two main files are used to configure profile settings | Two main files are used to configure profile settings | ||
* /etc/profile: All user settings | */etc/profile: All user settings | ||
* /~/.profile (/root/.profile for the root user): individual user settings | */~/.profile (/root/.profile for the root user): individual user settings | ||
Additional configuration documentation can be found here: https://linux.die.net/man/1/ash | Additional configuration documentation can be found here: https://linux.die.net/man/1/ash | ||
===== BASH (the full version) ===== | =====BASH (the full version)===== | ||
As noted, the default shell for OpenWRT is ASH. Check the /etc/passwd file for which shell the root user uses. For ASH, it will be /bin/ash, for BASH, it will be /bin/bash. Also try typing the ''env'' command, find the line in the output that states: SHELL=/bin/ash or /bin/bash | As noted, the default shell for OpenWRT is ASH. Check the /etc/passwd file for which shell the root user uses. For ASH, it will be /bin/ash, for BASH, it will be /bin/bash. Also try typing the ''env'' command, find the line in the output that states: SHELL=/bin/ash or /bin/bash | ||
| Line 2,280: | Line 2,283: | ||
Bash has several advantages, including keeping a history of commands that persists across reboots. | Bash has several advantages, including keeping a history of commands that persists across reboots. | ||
===== FISH ===== | =====FISH===== | ||
===== ZSH ===== | =====ZSH===== | ||
===== Profiles ===== | =====Profiles===== | ||
By default, all profiles are configured via the /etc/profile file. If multiple users are configured, each time a user logs into a command prompt, their profile will be configured with information in this file. | By default, all profiles are configured via the /etc/profile file. If multiple users are configured, each time a user logs into a command prompt, their profile will be configured with information in this file. | ||
| Line 3,550: | Line 3,553: | ||
===The Real Pin # 1=== | ===The Real Pin # 1=== | ||
Many website tutorials, YouTube videos, diagrams, and even images on the OpenWRT website show the TTL Serial Port for the AC series of routers numbered from left to right, starting with "pin 1", as viewed from the top / front of the circuit board. This is NOT correct, although both the names / labels of the pins and what their function is (Ground, TX (Transmit), and RX (Receive)), ''are correct''. It is an industry standard to identify "Pin 1" on a circuit board in several manners. The most common methods includes a triangle printed on the circuit board closest to "Pin 1" and a square solder connection (as viewed from the bottom). Another convention that is typically followed, but is not an absolute rule, is putting "Pin 1" closest to the nearest edge of a circuit board. The AC Series of routers all have a square solder connection on the bottom and a triangle printed on top of the circuit board for "Pin 1" on the right side of the connector, as viewed from the top. Since there is no pinout standard for that type of connector, the manufacturer (Linksys in this case) gets to define where "Pin 1" is located. | Many website tutorials, YouTube videos, diagrams, and even images on the OpenWRT website show the TTL Serial Port for the AC series of routers numbered from left to right, starting with "pin 1", as viewed from the top / front of the circuit board. This is NOT correct, although both the names / labels of the pins and what their function is (Ground, TX (Transmit), and RX (Receive)), ''are correct''. It is an industry standard to identify "Pin 1" on a circuit board in several manners. The most common methods includes a triangle printed on the circuit board closest to "Pin 1" and a square solder connection (as viewed from the bottom). Another convention that is typically followed, but is not an absolute rule, is putting "Pin 1" closest to the nearest edge of a circuit board. The AC Series of routers all have a square solder connection on the bottom and a triangle printed on top of the circuit board for "Pin 1" on the right side of the connector, as viewed from the top. Since there is no pinout standard for that type of connector, the manufacturer (Linksys in this case) gets to define where "Pin 1" is located. And per the triangle marking, pin closest to edge, and square solder connection pin number one is located as indicated by the below image. PERIOD. Image is courtesy of: http://wtarreau.blogspot.com/2018/ | ||
===Additional Information=== | ===Additional Information=== | ||
[[File:PinOut.png|alt=Pinout for TTL Connector on AC Series of Routers|left|thumb|Pinout for TTL Connector]] | |||
OpenWRT article for WRT3200ACM that applies to other models too: https://openwrt.org/toh/linksys/linksys_wrt3200acm#serial1 | OpenWRT article for WRT3200ACM that applies to other models too: https://openwrt.org/toh/linksys/linksys_wrt3200acm#serial1 | ||
| Line 3,560: | Line 3,564: | ||
Various comparisons between RS-232 and TTL: https://learn.sparkfun.com/tutorials/serial-communication/wiring-and-hardware | Various comparisons between RS-232 and TTL: https://learn.sparkfun.com/tutorials/serial-communication/wiring-and-hardware | ||
A general tuturial on configuring connectivity with an AC Series router: http://wtarreau.blogspot.com/2018/ | A general tuturial on configuring connectivity with an AC Series router: http://wtarreau.blogspot.com/2018/ (this person has the pin numbers labeled correctly and everyone else's incorrect opinion labeled as "theoretical", see image) | ||
<br /> | |||
==History== | ==History== | ||