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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
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 |