Setting the Source Address for Telnet Connections
Problem
You want to force Telnet to use a specific IP address when connecting from the router to another system.
Solution
Include the source address in the Telnet command:
aviva@RouterA> telnet source 172.19.121.15 server1 Trying 172.19.121.246… Connected to server1.mycompany.com. Escape character is '^]'. server1 (ttyp0) login:
Discussion
By default, the source address included in locally generated Telnet and other TCP/IP packets is the address of the interface on which the Telnet request is sent. This means the source address may change from connection to connection. If multiple equal-cost next hops are present for a destination, the lo0 loopback interface address is used as the source address. If you configure the system default-address-selection statement in the configuration, which uses the lo0 interface address as the router's system address, this address is used as the source for most Telnet connections (see Recipe 7.4).
The result of this behavior is that the default Telnet source address is not always the same and not always deterministic. If the source address matters when using Telnet to access another system, include it in the telnet command. One instance when you should do so is when filtering the source address on incoming connections, which may block packets coming to the default source address. Another instance is when you use Telnet as a generic way to check and troubleshoot other TCP ports (such as connecting to a server on port 25 to see if it is listening for SNMP mail connections). The source address that you specify must be an address that's configured on the router.
See Also
Recipes 7.4 and 7.12