LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 12-15-2012, 01:42 PM   #1
beolsson
LQ Newbie
 
Registered: Jun 2010
Posts: 2

Rep: Reputation: 0
Loop back IP packets to a NIC?


Hi Folks,

In order to do efficient bidirectional network testing, I would like to return all IP packets incoming to e.g. eth0, i.e. sapping source and destination address of all incomming packets and return them to eth0. Is this possible using iptables and NAT? Of course this can be done for a single port in user space but the gut feeling is that it should be possible and more efficient if done in the same way as conventional NAT.

Thanks
 
Old 12-17-2012, 02:30 PM   #2
jefro
Guru
 
Registered: Mar 2008
Posts: 11,722

Rep: Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445
Create a loopback cable? Many loopback issues within a nic are not true full nic tests. The nic actually may never get the packet or only into half the nic and then returned to system.
 
Old 12-19-2012, 10:18 AM   #3
beolsson
LQ Newbie
 
Registered: Jun 2010
Posts: 2

Original Poster
Rep: Reputation: 0
Well, a loopback cable is not really IP-savy.

I tried:

iptables -t nat -A PREROUTING -p tcp -m tcp -d 192.168.1.3 -j DNAT --to-destination 192.168.1.4

where 192.168.1.3 is the reflector machine (the one I am issuing the command on) and 192.168.1.4 is the machine to receive the redirected packets, i.e. the sender. However, no success... (to test I telnet 192.168.1.3 and would expect to connect to 192.168.1.4)

Any better ideas or do I miss something?
 
Old 01-04-2013, 02:17 AM   #4
routers
Member
 
Registered: Aug 2005
Location: Malaysia - KULMY / CNXTH
Distribution: Slackware, Fedora, FreeBSD, Sun O/S 5.10, CentOS
Posts: 771
Blog Entries: 6

Rep: Reputation: 75
IMO you need to do redirect port or call port forward for each program,
eg, telnet run on port 23 and create iptables rules this way

Code:
$IPT -t nat -I PREROUTING -p tcp -d 192.168.1.3 --dport 23 -j DNAT --to 192.168.1.4:23
or
$IPT -t nat -I PREROUTING -p tcp -d 192.168.1.3 --dport 23 -j DNAT --to 192.168.1.4
try it
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Packets go out one tunnel, come back another, then are dropped Atomicmongoose Linux - Networking 2 12-06-2010 06:35 PM
How to adjust routing of external packets to one NIC instead of another NIC? rfreiberger Linux - Newbie 3 04-14-2010 01:20 PM
loop packets out tap0 like an access point cr13 Linux - Networking 0 07-12-2007 02:42 AM
Forwarding packets between two NIC madhavann Linux - Networking 6 02-17-2006 10:23 PM
Why one nic accept packets destined for second nic gibcomp Linux - Networking 2 09-09-2004 12:21 AM


All times are GMT -5. The time now is 12:38 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration