pinging between two NIC on my PC

This is a discussion on pinging between two NIC on my PC within the Linux Networking forums, part of the Linux Forums category; Hi. Is it possible to ping two NIC on the same PC? I connected two NIC with cross cable, and ...


Go Back   Usenet Forums > Linux Forums > Linux Networking

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-22-2004
Ken
 
Posts: n/a
Default pinging between two NIC on my PC

Hi.

Is it possible to ping two NIC on the same PC?
I connected two NIC with cross cable, and set NIC1's IP as
192.168.0.1, NIC2's IP as 192.168.0.2.
Pinging 192.168.0.1 or 192.168.0.2 has reply.
But even after disconnecting cable.

What I want to do is sending or receiving IP packet VIA cable.
Could anybody have any idea, please?

TIA
Kenji
Reply With Quote
  #2 (permalink)  
Old 04-22-2004
Paul Black
 
Posts: n/a
Default Re: pinging between two NIC on my PC

Ken wrote:
> Hi.
>
> Is it possible to ping two NIC on the same PC?
> I connected two NIC with cross cable, and set NIC1's IP as
> 192.168.0.1, NIC2's IP as 192.168.0.2.
> Pinging 192.168.0.1 or 192.168.0.2 has reply.
> But even after disconnecting cable.


Correct. You can always ping your local IP address and each IP address
you're trying to ping is local.


> What I want to do is sending or receiving IP packet VIA cable.
> Could anybody have any idea, please?


I'm curious: why?


--
Paul Black mailto:paul.black@oxsemi.com
Oxford Semiconductor Ltd http://www.oxsemi.com
25 Milton Park, Abingdon, Tel: +44 (0) 1235 824 909
Oxfordshire. OX14 4SH Fax: +44 (0) 1235 821 141
Reply With Quote
  #3 (permalink)  
Old 04-22-2004
Toni Erdmann
 
Posts: n/a
Default Re: pinging between two NIC on my PC

Ken wrote:

> Hi.
>
> Is it possible to ping two NIC on the same PC?
> I connected two NIC with cross cable, and set NIC1's IP as
> 192.168.0.1, NIC2's IP as 192.168.0.2.
> Pinging 192.168.0.1 or 192.168.0.2 has reply.
> But even after disconnecting cable.
>
> What I want to do is sending or receiving IP packet VIA cable.
> Could anybody have any idea, please?
>
> TIA
> Kenji


Hi,

that's not so easy.

1.) Linux tries to find a shorter path - local loop,
IP stack recognized IP address as being it's own
and therefore does not use any NIC

2.) even if you tell 'ping' to use a certain NIC
'ping -I eth0 <ip of eth1>' it does not work,
because:

3.) Kernel does not accept incoming IP packets from
any NIC that has source and destination address
being it's own. To allow this, this would
require

4.) a kernel patch: I must search for it ...
but even then it does not work, because

5.) you can't tell the responding ICMP stack
(Echo Response) which NIC to use for sending,
so that the response goes again the short path.

We had such problems with UDP test program with
ppp0 interface and eth0 interface, both connected
via Cellular Phone over GPRS and back to eth0
(Test Center for GSM/GPRS). We tries to measure
the up- and downlink delays using only one
Laptop. Having 2 Laptops (1 for ppp0 and 1 for eth0)
cause problems with time synchronization.

Toni
Reply With Quote
  #4 (permalink)  
Old 04-23-2004
Ken
 
Posts: n/a
Default Re: pinging between two NIC on my PC

HI Paul.


> Correct. You can always ping your local IP address and each IP address
> you're trying to ping is local.


Yes, And I tried to change route table, but it couldn't work.


> > What I want to do is sending or receiving IP packet VIA cable.
> > Could anybody have any idea, please?

>
> I'm curious: why?


This is because I need to make a test program which checks both
ethernet on board and pc-card network card work fine.
I cannot expect that pc connects to other machines during testing.
So I want to connect them with cross cable then test.


Kenji
Reply With Quote
  #5 (permalink)  
Old 04-23-2004
Ken
 
Posts: n/a
Default Re: pinging between two NIC on my PC

Thanks Toni for your reply.
Sounds difficult.

What do you think this idea:
1. Run UDP server process which listen certain port.
2. Run UDP client process which does broadcast.
3. Then check if server process gets packets.

Kenji


> > Is it possible to ping two NIC on the same PC?
> > I connected two NIC with cross cable, and set NIC1's IP as
> > 192.168.0.1, NIC2's IP as 192.168.0.2.
> > Pinging 192.168.0.1 or 192.168.0.2 has reply.
> > But even after disconnecting cable.
> >
> > What I want to do is sending or receiving IP packet VIA cable.
> > Could anybody have any idea, please?
> >
> > TIA
> > Kenji

>
> Hi,
>
> that's not so easy.
>
> 1.) Linux tries to find a shorter path - local loop,
> IP stack recognized IP address as being it's own
> and therefore does not use any NIC
>
> 2.) even if you tell 'ping' to use a certain NIC
> 'ping -I eth0 <ip of eth1>' it does not work,
> because:
>
> 3.) Kernel does not accept incoming IP packets from
> any NIC that has source and destination address
> being it's own. To allow this, this would
> require
>
> 4.) a kernel patch: I must search for it ...
> but even then it does not work, because
>
> 5.) you can't tell the responding ICMP stack
> (Echo Response) which NIC to use for sending,
> so that the response goes again the short path.
>
> We had such problems with UDP test program with
> ppp0 interface and eth0 interface, both connected
> via Cellular Phone over GPRS and back to eth0
> (Test Center for GSM/GPRS). We tries to measure
> the up- and downlink delays using only one
> Laptop. Having 2 Laptops (1 for ppp0 and 1 for eth0)
> cause problems with time synchronization.
>
> Toni

Reply With Quote
  #6 (permalink)  
Old 04-23-2004
Toni Erdmann
 
Posts: n/a
Default Re: pinging between two NIC on my PC

Ken wrote:
> Thanks Toni for your reply.
> Sounds difficult.


Not really. We made it within a few hours
spending most of the time compiling and linking
the kernel.

>
> What do you think this idea:
> 1. Run UDP server process which listen certain port.
> 2. Run UDP client process which does broadcast.
> 3. Then check if server process gets packets.


No, I'm afraid that goes the short path too.


If you only like to know, whether somehing can
be sent and received ...

ping -I eth0 ip-of-eth1

start 'ethereal' capturing on eth1

or

start 'tcpdump -i eth1'

if you can see something coming in, all is ok.

Toni
Reply With Quote
  #7 (permalink)  
Old 04-26-2004
Ken
 
Posts: n/a
Default Re: pinging between two NIC on my PC

Thanks for your idea.

> Not really. We made it within a few hours
> spending most of the time compiling and linking
> the kernel.


I'm afraind We cannot take this because the customer requires to use
their own kernel.


> If you only like to know, whether somehing can
> be sent and received ...
>
> ping -I eth0 ip-of-eth1
>
> start 'ethereal' capturing on eth1
>
> or
>
> start 'tcpdump -i eth1'
>
> if you can see something coming in, all is ok.
>
> Toni


But this really helps me.
I appreciate you so much.

Regards,
Kenji
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 01:48 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0