List Info

Thread: Re: Sending network traffic to "self" externally - is it possible?




Re: Sending network traffic to "self" externally - is it possible?
country flaguser name
United States
2007-04-15 13:29:55
[moved to netbsd-help]

  I'm trying to test an ethernet switch.  I have a single
workstation
  that already has multiple NICs in it, and I'd like to be
able to use
  it for this purpose.  In addition to saving space &
power, it will
  also be easier if I only have to manage a single system. 
Furthermore,
  I could run simultaneous captures (e.g. tcpdump) on both
interfaces,
  which also simplifies timestamp comparison.

You can likely do this by changing routes.  When you
ifconfig an
address, you'll get a cloning route for the subnet, which
will lead to
arp and "arp entries" which are really host routes
with LLINFO and
WASCLONED flags.

You can delete the cloning route, or you can just add a host
route.
Beware that this will disrupt ARP functioning and if the
switch is
paying attention that may be trouble.  But if it's truly an
Ethernet
switch, it won't look at IP or ARP.

You may also find that output packets get checked someplace
for "is this
one of my addrs", but my memory on this is very fuzzy -
that may only be
on input.

You could also write a test program with bpf that doesn't
use IP.

-- 
    Greg Troxel <gdtir.bbn.com>

Re: Sending network traffic to "self" externally - is it possible?
country flaguser name
United States
2007-04-16 23:07:10
On Apr 15, 2007, at 11:29 AM, Greg Troxel wrote:

> [moved to netbsd-help]
>
>>   I'm trying to test an ethernet switch.  I have a
single workstation
>>   that already has multiple NICs in it, and I'd
like to be able to  
>> use
>>   it for this purpose.  In addition to saving space
& power, it will
>>   also be easier if I only have to manage a single
system.   
>> Furthermore,
>>   I could run simultaneous captures (e.g. tcpdump)
on both  
>> interfaces,
>>   which also simplifies timestamp comparison.
>
> You can likely do this by changing routes.  When you
ifconfig an
> address, you'll get a cloning route for the subnet,
which will lead to
> arp and "arp entries" which are really host
routes with LLINFO and
> WASCLONED flags.
>
> You can delete the cloning route, or you can just add a
host route.
> Beware that this will disrupt ARP functioning and if
the switch is
> paying attention that may be trouble.  But if it's
truly an Ethernet
> switch, it won't look at IP or ARP.

Hi Greg,

I tried your suggestion of adding host routes, but wasn't
able to get it
working.  It also seems to reliably crash the kernel in the
routing  
layer
when I attempt to ping with that configuration (this is
3.1/i386 from  
CD).

I tried first removing the cloning route, then adding two
host  
routes, with
different combinations of -cloning; using host vs. net/32 +
gateway  
of the
other interface IP.  I wasn't able to add these routes using
-ifa/- 
ifp though;
I get "bad value" or "invalid
argument".

Just FYI, here is some information on my setup:

% ifconfig tlp0 ; ifconfig tlp1
tlp0:
flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu
1500
         address: 00:00:e8:13:40:cd
         media: Ethernet autoselect (100baseTX full-duplex)
         status: active
         inet 192.168.0.1 netmask 0xfffffffc broadcast
192.168.0.3
         inet6 fe80::200:e8ff:fe13:40cd%tlp0 prefixlen 64
scopeid 0x2
tlp1:
flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu
1500
         address: 00:00:e8:13:89:d3
         media: Ethernet autoselect (100baseTX full-duplex)
         status: active
         inet 192.168.0.2 netmask 0xfffffffc broadcast
192.168.0.3
         inet6 fe80::200:e8ff:fe13:89d3%tlp1 prefixlen 64
scopeid 0x3
% netstat -rn -f inet
Routing tables

Internet:
Destination        Gateway            Flags     Refs     Use
   Mtu   
Interface
127/8              127.0.0.1          UGRS        0        0
 33192  lo0
127.0.0.1          127.0.0.1          UH          1        0
 33192  lo0
192.168/30         link#2             UC          0        0
     -   
tlp0

% route delete -net 192.168.0.0/30
delete net 192.168.0.0
% route add -host 192.168.0.1 -iface -ifp tlp1
writing to routing socket: Invalid argument
add host 192.168.0.1: Invalid argument

... so that doesn't work.  How about this:

% route add -host 192.168.0.1 192.168.0.2 -iface
add host 192.168.0.1: gateway 192.168.0.2
% route add -host 192.168.0.1 192.168.0.2 -iface
add host 192.168.0.1: gateway 192.168.0.2

(which doesn't report an error on the cli, but does print
this in the  
logs:
Apr 16 15:07:31 randy /netbsd: arp_rtrequest: bad gateway
value)

% netstat -rn -f inet
Routing tables

Internet:
Destination        Gateway            Flags     Refs     Use
   Mtu   
Interface
127/8              127.0.0.1          UGRS        0        0
 33192  lo0
127.0.0.1          127.0.0.1          UH          1        0
 33192  lo0
192.168.0.1        192.168.0.2        UHS         0        0
     -   
tlp1
192.168.0.2        192.168.0.1        UHS         0        0
     -   
tlp0

Looks like it should work, but no-go on the ping and I get
this in  
the logs:

Apr 16 15:10:18 randy /netbsd: arpresolve: can't allocate
llinfo on  
tlp1 for 192.168.0.1

If there are any other ideas, I'm willing to give them a
shot.


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )