Linux Ip Routing

anonymous

Newbie
Joined
Dec 17, 2007
Messages
32
Reaction score
0
I have one vps with multiple internet ip(virtual ethernet interfaces; eth0:0 and eth0:1 ) but i can only use one ip when i use as ssh tunneling(outgoing connections).
Solution is ip routing but it seems complicated.
Is there anyone explain step by step please ?
 

bpaw

Junior Member
Joined
Aug 9, 2008
Messages
175
Reaction score
50
This should work:

route add -host xxx.xxx.xxx.xxx dev eth0:1

The x's refer to the IP address of the destination - NOT your IP address. You need to replace eth0:1 with the device you want for all outgoing traffic. All traffic going to host xxx.xxx.xxx.xxx will appear to be coming from whatever IP address is bound to eth0:1
 

anonymous

Newbie
Joined
Dec 17, 2007
Messages
32
Reaction score
0
This should work:

route add -host xxx.xxx.xxx.xxx dev eth0:1

The x's refer to the IP address of the destination - NOT your IP address. You need to replace eth0:1 with the device you want for all outgoing traffic. All traffic going to host xxx.xxx.xxx.xxx will appear to be coming from whatever IP address is bound to eth0:1

Thank you very much this works but what i exactly want to do is;
assume
eth0:0 has ip 111.111.111.111
eth0:1 has ip 222.222.222.222

if i open ssh to 111.111.111.111 then i want outgoing connections will be 111.111.111.111, and if i open ssh to 222.222.222.222 then i want outgoing connections will be 222.222.222.222.
(but now when i open ssh to 222.222.222.222, outgoing connections are from 111.111.111.111, this is the problem i have )
 
Top