LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-04-2018, 03:00 AM   #1
charge
LQ Newbie
 
Registered: Apr 2018
Posts: 2

Rep: Reputation: Disabled
capturing iptables port REDIRECT


Iam trying to redirect port and verify the redirection is working using

Code:
iptables -t nat -D PREROUTING -i enp0s3 -p udp --dport 162 -j REDIRECT --to-port 10162
and then

Quote:
tcpdump -i enp0s3 udp port 10162
Sadly this is not capturing anything, at the same time, iam still receiving packets to port 162 seeing via tcpdump.

Also when i start using iptables redirect 162 -> 10162, i stop seeing snmptrapd messages in syslog informing me, that trap was received. After deleting the rule, the syslog is getting the info again.

What iam seeking, is evidence that port 10162 is receiving the redirected trap, which is input for my logstash and so i can investigate my bigger issue with ELK stack further. Basically iam in process of trying to follow the path step by step and see where my issue lies.

At least why snmptrapd stops saying trap is received in syslog (when redirected) and mabye the correct way how to set tcpdump to capture "inner" communication.
 
Old 04-04-2018, 05:39 AM   #2
charge
LQ Newbie
 
Registered: Apr 2018
Posts: 2

Original Poster
Rep: Reputation: Disabled
So the redirect works fine, i checked by other means (debuging logstash itself - sending snmptrap and catching it in logstash-console). I guess: When redirect takes place, snmptrapd is no longer getting anything on port 162 since its probably redirected before it reaches it by iptables, but tcpdump runs even before this redirection so its actually takes 162 as original port (based on message itself), BUT cant capture on port 10162 since its not running or reading "behind it". Thats my basic understanding. It would still be nice to know the way of checking also port 10162 after redirection, for even deeper understanding and knowledge...or better explanation than mine which is serious guessing
 
Old 04-04-2018, 07:56 AM   #3
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Tcpdump reads right off the interface. Whatever you do after that requires a correct filter expression to capture. You might find things easier with wireshark.
 
  


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
Iptables redirect to IP:PORT Yazeed98 Linux - Networking 3 08-11-2015 10:58 AM
with iptables, how-to redirect outgoing mail from port 25 to port 587 thumbelina Linux - Networking 12 03-19-2012 08:26 AM
Port redirect with help of IPTABLES EgoX Linux - Networking 1 09-06-2010 02:45 AM
debian iptables squid - redirect port 80 to port 8080 on another machine nickleus Linux - Networking 1 08-17-2006 12:59 AM
Redirect port with iptables |DeJoTa| Linux - Networking 0 07-11-2003 01:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:53 AM.

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