Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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 an ubuntu server machine (12.04) with 4 IP addresses for different websites that require unique ssl certificates.

I sometimes ssh out from this box and the box I am going to I have to tell it what IP address I will be coming from.

How do I specify which of the 4 ip addresses I want to use as my outgoing IP address?

If i do an ifconfig it appears that I am going out as the last ipaddress.

I guess you would want to specify either the address or the interface....

Thanks in advance!


share|improve this question

From ssh(1)

 -b bind_address
         Use bind_address on the local machine as the source address of
         the connection.  Only useful on systems with more than one

If this doesn't do what you want then you will have to configure routing (with ip route) in such a way that the preferred interface is used for the connection.

share|improve this answer

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.