Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
05-17-2013, 12:58 PM
|
#1
|
LQ Newbie
Registered: Oct 2012
Posts: 18
Rep: 
|
if there are 2 NIC on the same machine, can a tcp client on one NIC connect to a tcp
I use tun/tap to create a tun NIC tun0 with IP 10.10.10.2, and I have a real NIC eth0 with IP 202.112.34.49
then I run a tcp client which binds its socket to 202.112.34.49 and a tcp server binding 10.10.10.2. but I can't establish a tcp connection between them.
so can a tcp client on one NIC connect to a tcp server on the other NIC?
thanks!
|
|
|
05-17-2013, 02:24 PM
|
#2
|
Senior Member
Registered: Apr 2009
Posts: 1,900
Rep: 
|
You can create two tun interface, one for client and another for server. These two tun0 can communicate each other. The packet on real NIC will send to wire and never come back except another device make it back.
|
|
|
05-17-2013, 05:33 PM
|
#3
|
LQ Newbie
Registered: Oct 2012
Posts: 18
Original Poster
Rep: 
|
Quote:
Originally Posted by nini09
You can create two tun interface, one for client and another for server. These two tun0 can communicate each other. The packet on real NIC will send to wire and never come back except another device make it back.
|
I just heard that if they are on the same machine, the packets will never reach the tun interface, but they will go to loopback interface, is it right?
|
|
|
05-20-2013, 02:16 PM
|
#4
|
Senior Member
Registered: Apr 2009
Posts: 1,900
Rep: 
|
Dependant on what do you talk about? If you talk about whether the packet sending to interface is delivered to wire, no, tun/tap interface only exist in kernel and they never send the packet to wire. But loopback interface doesn't send packet to wire, either.
The advantage to use tun/tap interface is that you can create a network on same machine without any network device.
Check following Website and it can help understand tun/tap interface.
http://backreference.org/2010/03/26/...face-tutorial/
|
|
|
All times are GMT -5. The time now is 07:55 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|