Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have ~20 public IP addresses defined on my server. Now, when I connect to a remote server via terminal, it gets connected from the primary IP of my server.

But I want to use terminal from my another IP address. Is this possible?

share|improve this question
What do you mean by "via terminal"? Are you looking for a way to change the source IP address of all connections to a particular machine? Or are you looking for a way to invoke a specific program so that it makes a connection from a particular IP address? Or something else entirely? – David Schwartz Nov 13 '12 at 9:31
Sorry for the confusion. I meant "telnet", not "terminal". – Cem Nov 13 '12 at 11:05
up vote 3 down vote accepted

If you are using ssh to connect to the remote host then you can use the BindAddress directive to specify a local address to us for the connection

BindAddress Use the specified address on the local machine as the source address of the connection. Only useful on systems with more than one address. Note that this option does not work if UsePrivilegedPort is set to “yes”.

You can use this like so

ssh user@remote.tld -o

You can also configure your ~/.ssh/config file to do this on a per host basis.

Host remote.tld

Host another

Note that the Host matched has to be the same as that specified on the command line but you can use wildcards.

If you're using telnet then use the -b switch

-b address Use bind(2) on the local socket to bind it to a specific local address.

telnet -b remote.tld
share|improve this answer
@lain, thanks for your answer. What about telnet? – Cem Nov 13 '12 at 11:06
@Cem: updated my answer – Iain Nov 13 '12 at 11:14
Great, thanks @lain. That did the trick. – Cem Nov 13 '12 at 11:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.