Multiple IP addresses

Posted on 2000-05-12
Medium Priority
Last Modified: 2010-03-18
My requirement is to simulate a scenario
in which 2 machines are connected via
gateways accross an insecure network.

   A --G1--<insecure net>--G2-- B

But the problem is that I have only two machines
available. One of them has 2 network cards which
I would be using to simulate the '2 gateways across
the net' (G1 and G2). But the other machine has just one network
card, but I would like to simulate it as the 2 'end-point'
machines (A and B).
So I tried cloning the eth0 (having address for A) with a different
IP address (for B, for a different subnet) and tried to
route the packets through the 'gateway' to the 'other' IP
address ('B') but apparently the kernel (or whatever) detects
that the 'remote' address is of the same host and the
packets are never transferred through the network card -
they are simply looped back.

Is it possible to configure the 'end-point' machine
such that it cannot detect it's own 'other' IP address
and is forced to route the packet to the specified
gateway ?
Question by:avinashb050800
  • 4
  • 3
  • 2
LVL 40

Expert Comment

ID: 2807221
I don't think so, given the way routing works. But, with only two machines you can't actually simulate your scenario. Network traffic over the "insecure network" will only be between the two "gateways" because they have direct routes to each other. So it really doesn't matter if you have one or two NIC's in each box.

You'd need a minimum of four systems to set up the scenario for any realistic testing (but you probably already know that). If the goal is work with mechanisms for transport over insecure networks (encrypted tunnels and the like) you can work that part of the problem with just two systems, each with a single NIC. The routing issues can't be examined without the presence of the gateway boxes.

Author Comment

ID: 2809747
Thanks Jlevie for your comment - but let me put my question in a sharper focus.

If I have a machine with 2 IP addresses and only 1 NIC, is possible to route the packets between them through an external gateway ?

I tried modifying the routing tables to affect that but the packets never reach the NIC. Apparently at some stage the IP detects that the destination address is 'local' ...

LVL 40

Expert Comment

ID: 2811379
Could you give a specific example of how you've configured the IP's?
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.


Expert Comment

ID: 2813201
Looks like you're trying to implement a VPN. IP tunneling could be a solution to your scenario. In which case private packets are encapsulated and forwarded by way of public, insecure connection.
You need to configure the Linux kernels to support these features on both end stations. Of course I'm just point out this direction. If this suite your situation, you'd want step-by-step instructions and more detailed documentation on how to configure the interfaces.

Author Comment

ID: 2814040
I have cloned my eth0 so I now have
-->eth0 with IP addr
-->eth0:0 with IP addr

and in the routing tables I have added
Dest          gw             Iface   eth0

The configuraration works for all '205.*' bound packets except for '205.7'.
LVL 40

Accepted Solution

jlevie earned 300 total points
ID: 2814671
Well of course. is, by definition, the local machine and the routing engine knows that. From a routing standpoint it has no need to forward the packet anywhere else as the packet is already at its final destination. The system will, as you've observed, quite happily route data out eth0:0 for any other IP in

Expert Comment

ID: 2814783
I suppose the insecure connection that  A has now is eth0 ( through GW1 ( to the other end point B.
Now what you want to accomplish is establish an end-to-end connection through the above link, am I right?  If this is what you have in mind, then continue...
The IP-IP, or IP tunneling which implements the GRE, generic routing protocol, is what you need.
In your case, it's not necessary to have two physical network interfaces in each endpoint. You create and configure a (pseudo, virtual...) tunnel interface for on A, also similar on endpoint B.  The kernel, IP protocol stack, will encapsulate these packets with headers so that they can be forwarded through the default gateway. On the other endpoint, the kernel of course will take care of the decapsulation.
Different venders have different implementation. Here we have Linux, right?

Author Comment

ID: 2816579
I guess jlevie, you've got a point. I would need a reeeeal low level tweaking in the kernel to manage this (route.c ?)...
LVL 40

Expert Comment

ID: 2817978
Ummm, yeah I think that would require major surgery of the kernel's routing engine.

You really need more than two systems to do this. As I think that you are trying to play with encrypted VPNs you'd want four to fully simulate the scenario. However, if you don't have that you could come pretty close by simply treating the link between the two boxes as the insecure network and running the VPN over that. If you think each of the nodes as an encrypting "gateway", it doesn't really make much difference to the box whether the traffic originates from within the box or from a second NIC. Presumably the routing engine is taking care of where the traffic originated and when it's time to encrypt it and pass it out over the link the traffic has effectively become "local".

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
If you are looking for an automated tool which can generate reports for Outlook emails and other items from PST file, then you can go for Kernel PST Reporter tool. The reports which are created by this tool are helpful to analyze and understand PST …

589 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question