Page 1 of 2

Gargoyle CLI

Posted: Sat Mar 19, 2016 10:39 pm
by Lantis
When something goes wrong, usually the first thing someone will ask you to troubleshoot is, "we need a system log".
They might ask you, "can we see your config files?"
Or maybe they'll ask you to modify, add or remove files from the file system on the router.

We are going to cover the basics of logging in to the router via the command line and executing common commands, and we are going to cover logging in with a GUI to edit the file system.

You will need:
- PuTTY.exe OR Terminal.app on Mac or Linux.
- Your routers IP address
- Your router password

Logging in to the command line
Using PuTTY.exe, select an SSH connection type, leave the port at default 22, and enter "root@ROUTERIP", substituting ROUTERIP for the IP address of your router.
Then click Open.
Image
You will be asked for the password for your router. Type it in and press ENTER. Note that when you type your password, the cursor won't move and no characters will appear on screen. This is normal.
Image
On successful login you will be greeted with the Gargoyle logo and a prompt to enter a command.
Congrats, you're in!
Image

Common commands you may be asked to enter are:

Code: Select all

logread
used to get the system log from the router. just copy and paste this to the person requesting it from you

Code: Select all

cat
used to display the contents of a file, usually asked for when we want to see what is in a config file. e.g. cat /etc/config/wireless

Code: Select all

wifi
used to restart the wifi after making a change

Code: Select all

uci get config.section.option
we use this if we are specifically only interested in a particular setting. e.g. uci get wireless.radio0.hwmode

Code: Select all

uci set config.section.option=setting
we use this to change a specific setting in the config. e.g. uci set wireless.radio0.hwmode=11g

Code: Select all

uci commit
we use this to save any changes we have made to configs

Any commands that work on Openwrt should work on Gargoyle. That means that the wiki pages at openwrt.org are a great resource if you need help. E.g. https://wiki.openwrt.org/doc/uci/wireless is good for self checking a wireless configuration file for problems.

NOTE: If asked for a config file, before sending it to the person make sure you have a quick flick through it to make sure that there is no sensitive information in it e.g. passwords. This is commonly the case in the wireless config file. If there is, just blank them out with something like "REMOVEDPASSWORD" so that we know you changed it.



If the command line looks too scary for you, and you're more of a point and click kind of person, then i recommend WinSCP.
Logging in to the file system
Using WinSCP, set up a "new site".
Make the protocol SCP, the host name is the ip address of your router, and the port number is 22. Username is "root" and the password is the password for your router.
Image
Click Login and you will be greeted with the file system for the router.
If you are asked about remembering passwords, it is generally a good idea otherwise you will be constantly reentering the password to do anything.
Image
Now you can navigate the file system just like you would on a computer. If you need to show us something, just double click to open it, and copy paste. If you need to edit something, double click to open, make the changes, hit save and close.

Common directories you might get asked to go to are:
/etc/config - where we keep all of our config files
/tmp - where some relevant temporary config files are kept
/usr/data/bwmon - where graph data is stored (and can occasionally cause boot loops)
/www - where the GUI files are kept


Putting a router into failsafe recovery mode
Watch how to do it here
Note: As of Gargoyle 1.10.0, use SSH, not Telnet, to access Failsafe


Caution should be used when poking around in either the command line or the file system. Poking and prodding the wrong files or commands can cause an unstable router. 99 times in 100, its recoverable, but you'll be frustrated with yourself. :D

Re: Gargoyle CLI

Posted: Sat Mar 26, 2016 7:32 pm
by danymarc
thank you, nice info. for CLI newbies

Re: Gargoyle CLI

Posted: Fri Apr 08, 2016 2:30 am
by larcy
Are there any instructions on how to reflash a router from the CLI, useful for situations where you can get into the CLI, but not the GUI

Re: Gargoyle CLI

Posted: Sat Apr 09, 2016 6:26 am
by ispyisail
larcy wrote:Are there any instructions on how to reflash a router from the CLI, useful for situations where you can get into the CLI, but not the GUI
depends on router make/model

see openwrt wiki for your router

Re: Gargoyle CLI

Posted: Sat Apr 23, 2016 10:37 pm
by Lantis
Added a video for how to drop a router into failsafe recovery mode.
also as a big friendly reminder...

:!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!:
30/30/30 DOES NOTHING ON GARGOYLE
:!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!:

Re: Gargoyle CLI

Posted: Sun Apr 24, 2016 3:27 am
by tapper
Lantis wrote:Added a video for how to drop a router into failsafe recovery mode.
also as a big friendly reminder...

:!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!:
30/30/30 DOES NOTHING ON GARGOYLE
:!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!: :!:
hahaha was thinking the same thing lol.

Re: Gargoyle CLI

Posted: Sat Sep 03, 2016 5:08 am
by GhostYou
hi,

I can't get into my router even when its in fail safe mode. followed your video (https://www.youtube.com/watch?v=_NqHpRHl8gQ) for fail safe mode and used putty telnet 192.168.1.1 and ssh root@192.168.1.1 . have the light flashing faster and every thing. but even when if i ping the ip it just times out. I could still see it broadcasting the wireless network i set up but it will not give out ip address so i can't log in with phone. NOTED that it doesn't broad cast in fail safe mode.

model: Tl wr941nd v5.1 got a tl-wr941nd_v5.0factory from 1 of your forums. viewtopic.php?f=8&t=5690

It was working then I was poking around in lan settings and think i left it on pppoe (like a NOOB) and saved changes. this has stopped me logging back in to it for the past 6 hours :evil: .

ANY and all help is most appreciated.

Re: Gargoyle CLI

Posted: Sat Sep 03, 2016 9:43 am
by Lantis
Try different ports on the router.
When in failsafe, only use telnet. I'm not even sure it will respond to a ping.
And ensure you're in the right subnet with a static IP in your machine.

Re: Gargoyle CLI

Posted: Mon Sep 05, 2016 4:59 am
by GhostYou
Thx will do as I have a tl wr941nd v2 router as well with gargoyle on it and its working fine.... BUT I can't access that one in failsafe mode as well.

Think i must be missing a step. I hard set my ip to 192.168.1.2 subnet 255.255.255.0 then useing putty with telnet selected at 192.168.1.1 it auto fills port as 23 but i have tried 24 and 22. no luck.

I can how ever use putty and telnet to access the working router when it is NOT in failsafe mode fine.

Re: Gargoyle CLI

Posted: Mon Sep 05, 2016 7:48 am
by tapper
GhostYou wrote:Thx will do as I have a tl wr941nd v2 router as well with gargoyle on it and its working fine.... BUT I can access that one in failsafe mode as well.

Think i must be missing a step. I hard set my ip to 192.168.1.2 subnet 255.255.255.0 then useing putty with telnet selected at 192.168.1.1 it auto fills port as 23 but i have tried 24 and 22. no luck.

I can how ever use putty and telnet to access the working router when it is NOT in failsafe mode fine.
Hi mate I had this one time with a wrd3600 try the wan port when in failsafe .