Find the answer to your Linux question:
Results 1 to 2 of 2
Hi to all, first topic here :P I have: - A dedicated server hosted in US, ip 1.2.3.4 - A VPS hosted in FR, ip 2.3.4.5 Both server have Linux/Debian, ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2012
    Posts
    1

    Forward outgoing request to a remote server only for some destinations


    Hi to all, first topic here :P

    I have:

    - A dedicated server hosted in US, ip 1.2.3.4
    - A VPS hosted in FR, ip 2.3.4.5

    Both server have Linux/Debian, and only one ip each (eth0)

    What i need:

    All outgoing traffic from 1.2.3.4 exit normally to internet,
    EXCEPT for destination IP X,Y,Z,etc, that i want to be done by 2.3.4.5 server.
    The 2.3.4.5 it's dedicated to this, and accept connections ONLY from 1.2.3.4.

    I'm newbie about networking.
    I understand i need to create "route" in 1.2.3.4, and
    enabling IP forwarding with some iptables rule (nat? masquerading?) in 2.3.4.5.

    It's possible to do with only one IP on 2.3.4.5?

    Thanks for help!

  2. #2
    Just Joined! Fishbone_Beat's Avatar
    Join Date
    Nov 2009
    Location
    Costa Rica
    Posts
    19
    Maybe this can help, the command you are looking for is called "route" and you can use it with the following options (I only show here whats relevant to your goals:

    add
    add a new route.
    target
    the destination network or host. You can provide IP addresses in dotted decimal or host/network names.
    -net
    the target is a network.
    -host
    the target is a host.
    netmask NM
    when adding a network route, the netmask to be used.

    So the command would be something like:
    Code:
    route add -net 123.45.67.0 netmask 255.255.255.0 dev eth0
    eth0 being the interface you want to forward the packets to.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •