Forcing a particular IP address out to an interface

nick4soup_at_yahoo.com.au
Date: 10/12/05


Date: 11 Oct 2005 17:33:46 -0700

Hi,

I have two machines, both running 2.6.{8,9} kernels

 +-----left------+ +-----right-----+
 | | | |
 | 192.168.1.23 +-ppp0---+ 192.168.1.10 |
 | 192.168.1.49 | | |
 | 192.168.1.75 | | iptables masq |
 | . . . . . . . | | to/from ppp0 |
 | | | |
 | 192.168.0.23 +-eth0---+ 192.168.0.10 |
 | | | |
 +---------------+ +---------------+

The 192.168.1.xxx are bound to the ppp0 connection (xxx.23 by the usual
pppd option, the 49/75 by using "ifconfig ppp0:0 ...49" and "ifconfig
ppp0:1 ...75"

What I want (for testing purposes) is when I
  nick@left $ ping 192.168.1.49
I want the ping packets to travel to eth0, to 'right', and 'right' will
forward over ppp0 back to 'left'. Similar for ...23 and ...75

However the result is I get very short ping times, making me suspect
that it stayed entirely within the machine.
  nick@left $ telnet 192.168.1.49 80 ## I have a web server
and
  nick@left $ netstat -a -n | grep -w 80
gives
  source = 192.168.1.49:<random_port>
  destin = 192.168.1.49:80

What I like to see
  source = 192.168.1.10:<random_port> (ie masq'd from 'right')
  destin = 192.168.1.49:80

====================
Question:
====================
How do I force the packets for 192.168.1.xxx out over eth0?

What I tried so far:
  root@left $ route add -host 192.168.1.49 gw 192.168.0.10
seems to have no effect
  nick@left $ route -n
gives a default route to 192.168.0.10 (as intended)
  nick@right $ route -n
gives a default route to 192.168.1.23 (as intended, via ppp)

====================
Notes:
====================
 1. If I had 3 machines, I'd use them!
        (left)--eth0--(right)--ppp0--(extra)
 2. It seems I could use vmware, or I can use iptables/DNAT, but are
there any easier approaches?

Nick Bishop
-----
email replies ignored
-----
Proposed additions to the PDP11 instruction set:
  GWN Generate Whining Noise
  FDP Fill Desk with Paper
  TT Tangle Threads
-oOo-



Relevant Pages

  • Re: Network Horror
    ... and I have tried a route add 0.0.0.0 through the same gateway ... but WinME and WinXP machines can not. ... In answer to your question on Routing tables, ... I can neither ping the devices nor can they ping me. ...
    (comp.unix.sco.misc)
  • RE: How to route ICMP packets...
    ... Proxies don't forward. ... You will need to have a helper service on the proxy system which can then ping ot trace route on your behalf enabled. ... > machines and can't figure out how to route the ICMP packets through the ...
    (microsoft.public.win2000.networking)
  • newbie debian network problem : no ping on eth0
    ... I have installed debian 3.1r2 onto a Dell Latitude CPi laptop ... However I can't ping to or from the laptop on my home network. ... the ping packets are being sent via lo rather than eth0. ... My route table looks ok: ...
    (comp.os.linux.networking)
  • Re: Cant ping
    ... I can ping by IP machines on the same subnet (or at least ... there is no response from the nameserver, but `route -n` is quick, ... because there is no need for a nameserver. ...
    (Debian-User)
  • Re: Basic routing problem
    ... > I have two machines and a router which is connected to the internet. ... > I can not get A to ping R nor the Internet ... I assume you missed to add a route on R for the net of A pointing ...
    (Debian-User)