Run remote commands on Cisco routers from the computer

Can you place the cursor at the Windows command prompt and run a command on the router? Usually, you will first have Telnet or SSH to connect to the router to be able to execute commands? This article will show you how to simultaneously run router commands without having to exit the Windows command prompt, which is very convenient for controlling and automatically managing routers.

What is remote shell ( rsh )?

Remote shell is a common command line program in UNIX and Linux operating systems. By using Rsh , you can execute command line programs on a remote system. This remote system could be another UNIX or Linux operating system, or it could be a Cisco router or a switch. Rsh is part of the BSB UNIX operating system and includes rcp (remote copy) and rlogin (remote login).

While most Linux system administrators are familiar with rsh , some Windows administrators are not. In fact, both Windows XP and Windows Server 2003 include rsh . Figure A shows the illustration of using rsh at the command prompt.

Run remote commands on Cisco routers from the computer Picture 1
Picture A

However, when working with rsh , remember that rsh is not secure - It does not encrypt communications between remote devices and the system. You always need to configure rsh as securely as possible on the router by blocking the management machine's IP address and user name.

However, even with such precautions, rsh is still unsafe compared to SSH. So it would be good to use rsh on a protected and secure internal network. (This way, if you enable rsh through a firewall, it will use TCP port 514).

How to configure rsh on a router?

To be able to run a command on a Windows computer, proceed to the router, execute the commands, and then return the output to you, all you need to do is enter two commands. Let's take a look at the whole process.

First, you need to enable remote shell services on the router. Cisco IOS will call ip rcmd service. To activate this service, enter the following command on Global Configuration Mode:

Router (config) # ip rcmd rsh-enable

Second, you need to configure the workstation and user permissions to execute those remote shell commands. The following is an example of this command:

Router (config) # ip rcmd remote-host root 192.168.1.45 ddavis enable

Let's explain the command line above. The part ip rcmd remote-host is required. Next, you enter the ' local ' username on the router of the remote shell user who will log in when the commands are executed. The example above uses a local user ' root '.

Next, 192.168.1.45 is the IP address of the management workstation you want to allow to execute remote shell commands - in other words, this is the computer's IP address. Next, you see the internal Windows username: ddavis . As in the example, this is the name of the user who logged into the Windows XP machine as well as the user who will execute the rsh command on Windows. If you use a batch job script to execute the rsh command on Windows, you will need to enter the Windows username in the batch file.

Finally, the command contains the ' enable ' keyword. This command allows remote shell users to access to enable the type on the router. You can take this step further and specify the level of access allowed (for example, from level 1 to 15).

Keep in mind that these two commands assume that you already have a configured router and have a local user called ' root '. If you do not have a root user, you can use the following command:

Router (config) # username root privilege 15 password C1sCo!

Method of using rsh from Windows workstation

Once you have configured the commands above, you can easily run a remote shell command from the Windows command prompt. Figure B gives an example.

Run remote commands on Cisco routers from the computer Picture 2
Figure B

Actually you use the following command:

Z: rsh Router1 -l root sh ver

This is how that command line works:

  1. The server name is the first thing that needs to be specified (in the example above is Router1 ).
  2. Next, use -l (letter L) to determine the username that will be used to log in. (Note that ' ddavis ' will still need to be used on the local Windows computer to ensure safety).
  3. Finally, specify the command. In this case, execute the show version command (or sh ver ).

What can you do with the rsh command?

In addition to using the show version command, you can also perform the show running-configuration command (sh run) or other privileged commands. Here are some examples:

  1. show ip interface brief
  2. show ip route
  3. show ip ospf neighbors
  4. show ip bgp summary
  5. show log

What you can't do is run a Global Configuration Mode command, such as activating an interface or configuring an IP address. This is a limitation when using show commands.

However, one very useful thing you can do is copy the current configuration to a TFTP server and execute it inside an initial script on a Windows server. For example, you use the command copy running-configuration tftp: /1.1.1.1 .

What else can be done with remote commands?

If you look at the Cisco IOS documentation for remote commands, you will notice that there are a number of options that can be used with remote commands. One of the most recent features of that Cisco IOS is that you have the ability to validate newly ordered rsh and rcp commands by using an IOS Cisco access control list.

One of the more interesting changes is that you can use remote replication (rcp). Therefore, it is possible to copy a file using the rcp Windows command from the computer to the router or from the router to the computer without using TFTP or FTP. (You can enable the rcp command with the ip rcmd rcp-enable command.)

Conclude

Remote shell commands ( rsh or rcmd ) can be very useful for remote administration of your router. This is especially true if you want to create a Linux or Windows script that goes to all routers in the network and performs some show commands.

3.8 ★ | 15 Vote

May be interested

  • 5 best Cisco network device monitoring tools5 best Cisco network device monitoring tools
    network monitoring is essential because it can help prevent attacks and solve problems before they cause financial loss to your organization.
  • Solution to store over the network from the routerSolution to store over the network from the router
    wi-fi router with integrated network storage function is one of the effective and cost-effective data sharing solutions for small and medium-sized enterprises.
  • Top 15 free remote computer control toolsTop 15 free remote computer control tools
    remote computer control software allows users to control a remote computer with another computer. it is really useful when technical support, file transfer, etc. this article will introduce you to the top 15 best free remote computer control software in 2017.
  • 4 places to help you learn skills and get Cisco certification4 places to help you learn skills and get Cisco certification
    options will include online courses, online teachers and instructional software.
  • Detect dangerous security holes affecting many D-Link routersDetect dangerous security holes affecting many D-Link routers
    security researchers miguel méndez zúñiga and pablo pollanco of telefónica chile have just published proof-of-concept (poc) that allows hackers to execute remote commands and exploit vulnerabilities that leak information related to many d-link routers are being used worldwide.
  • Instructions for setting up a VPN site to site model on Cisco ASA systemsInstructions for setting up a VPN site to site model on Cisco ASA systems
    in the following article, we will show you some basic steps to set up and configure the site to vpn site with cisco asa system. currently, the concepts and applications of vpn for users are many, typically include: site to site, remote access ipsec, client-less, ssl, dmvpn ... and will be very difficult to mention specifically to any one element ...
  • 7 Cisco security tips7 Cisco security tips
    cisco has just released its first annual security report with the launch of cisco security center website (cisco.com/security). the report also makes predictions about security threats in 2008 along with advice from security experts.
  • The best Travel Router you need to bring in your tripThe best Travel Router you need to bring in your trip
    travel routers are often considered the 'swiss army knife' of the internet. this small device is no bigger than a credit card but don't let its small physique fool you.
  • How to Get MAC Address Using Remote IP AddressHow to Get MAC Address Using Remote IP Address
    do you need to determine the mac address of a certain computer on the network? whether you are using windows, macos or linux, you can easily find the mac address of any server on your local network with a few simple commands. today's tipsmake will show you how to use commands like arp and getmac to determine the mac address of a specific ip or hostname, in addition to how to use the nmap command to see all mac addresses in the network.
  • Discovered a particularly dangerous vulnerability in Cisco Jabber video conferencing softwareDiscovered a particularly dangerous vulnerability in Cisco Jabber video conferencing software
    if the vulnerability in cisco jabber is exploited successfully, the hacker will gain control of the victim's computer.