LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-18-2022, 04:43 AM   #1
giuntru
LQ Newbie
 
Registered: Jan 2022
Posts: 2

Rep: Reputation: 0
How to get packets sent to TUN0 IP address


Hi guys, I'm trying a simple program that allocates a tun interface (tun0 20.20.20.20/24) and prints the received IP raw packets on the screen.

There are two PCs.
On PC1 I have eth0 10.10.10.10/24 and tun0 20.20.20.20/24.
On PC2 I have eth0 10.10.10.11/24 and I added a static route to reach 20.20.20.0/24 via 10.10.10.10

If I ping 20.20.20.100 from PC2, the packets are printed correctly on PC1 since they pass through tun0 and are read by my program.

However if I ping 20.20.20.20, that is the tun0 IP address, the packets are not printed on PC1.
It seems that the ping is processed by another interface (maybe lo).

Is there any way to read packets sent to tun0 IP address 20.20.20.20?

Any suggestion is welcome!

Tnx

Last edited by giuntru; 01-18-2022 at 04:57 AM.
 
Old 01-18-2022, 09:25 AM   #3
giuntru
LQ Newbie
 
Registered: Jan 2022
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks a lot, I will go through the documents!
 
  


Reply



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 On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ip packets are not forwarded from tun0 to interface eth0 kawan Linux - Networking 2 07-17-2018 05:23 PM
Route eth2 TCP packets to tun0 with IPTABLES & IP RULE/ROUTE Thireus Linux - Networking 4 05-09-2011 12:38 PM
iptables: preroute outgoing packets from tun0 to eth0 ? malo_umoran Linux - Networking 2 09-22-2010 02:35 AM
iptables question with OpenVPN (tun0 to tun0 filtering) fang0654 Linux - Server 3 09-30-2009 02:17 AM
packets sent VS packets received fsasya Linux - Networking 0 07-18-2004 07:11 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration