Linux Ip Routing

Discussion in 'General Programming Chat' started by anonymous, Dec 27, 2008.

  1. anonymous

    anonymous Newbie

    Joined:
    Dec 17, 2007
    Messages:
    32
    Likes Received:
    0
    Occupation:
    Slave Trader
    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 ?
     
  2. bpaw

    bpaw Junior Member

    Joined:
    Aug 9, 2008
    Messages:
    175
    Likes Received:
    48
    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
     
    • Thanks Thanks x 1
  3. anonymous

    anonymous Newbie

    Joined:
    Dec 17, 2007
    Messages:
    32
    Likes Received:
    0
    Occupation:
    Slave Trader
    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 )