Setting the Source Address for Telnet

Problem

You want to force your router to use a particular IP source address when making outbound Telnet connections.

Solution

To configure a single common IP source address for all outbound Telnet session, use the following configuration command:

Router1#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#ip telnet source-interface loopback0
Router1(config)#end
Router1#

You can also set the IP source address for individual outbound Telnet sessions on the command line:

Router1#telnet 172.25.1.5 /source-interface loopback0

Discussion

By default, the router uses the IP address of the closest interface to the destination as the source address when it makes an outbound Telnet session. Network administrators frequently want to use an address other than the closest to the destination, however. For instance, access-lists or route filters may prevent the default source address from reaching its destination. Selecting a particular source IP address of a Telnet session can also help in troubleshooting network problems.

Cisco provides two methods for setting the source IP address of Telnet sessions, one global and one session specific. The global configuration example forces all Telnet sessions to use the IP address of the configured interface as its source address. However, if the configured interface has no IP address, or is operationally down, then the router will resort to its default behavior of using the closest ...

Get Cisco IOS Cookbook, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.