LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 10-10-2011, 01:02 PM   #1
paradox_mgh21
LQ Newbie
 
Registered: Oct 2011
Posts: 12

Rep: Reputation: Disabled
How can redirect incoming packet to another host?


i want to redirect incoming packets to another and another host that packets redirects to change destination of packets and send them back to the sender!like load balancers with DSR.
we have 3 Computer.computer1 send a tcp packet to computer 2 with source 1 and destination 2.computer 2 send received packet with source 1 and destination 3 to computer3.and computer3 send packets to computer1 with source 3 and destination 1.i used netfilter to get packets and change mac and ip and send them with dev_queue_xmit but packets drop in hub/switch.is better way to do this with modules?!
or source code to see?
 
Old 10-11-2011, 06:56 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
iptables is what you want to be looking at. Do a Google search, you should be able to find what you're looking for.
 
Old 10-11-2011, 07:10 AM   #3
fukawi2
Member
 
Registered: Oct 2006
Location: Melbourne, Australia
Distribution: ArchLinux, ArchServer, Fedora, CentOS
Posts: 449

Rep: Reputation: 34
Quote:
Originally Posted by paradox_mgh21 View Post
i want to redirect incoming packets to another and another host that packets redirects to change destination of packets and send them back to the sender!like load balancers with DSR.
http://www.youtube.com/watch?v=WL1foQKD3OI
(Sorry, had to be said.... I'm not the only one who is confused by that sentence)
 
Old 10-11-2011, 02:18 PM   #4
paradox_mgh21
LQ Newbie
 
Registered: Oct 2011
Posts: 12

Original Poster
Rep: Reputation: Disabled
Unhappy I'm so sorry!

i'm so so sorry about my english!
i know what iptable is.but i want to write module.
in fact i want to implement an load balancer(one-armed , direct server return "DSR",layer 2 or 3) with netfilter(just for packet capturing in layer 2 of tcp/ip,PREROUTING).
1 - i got packets
2 - i changed destination ip and mac to ip and mac of server
3 - i sent it with dev_queue_xmit and this function return 0(successful)
but no packet receive on server!!!
 
Old 10-11-2011, 05:11 PM   #5
fukawi2
Member
 
Registered: Oct 2006
Location: Melbourne, Australia
Distribution: ArchLinux, ArchServer, Fedora, CentOS
Posts: 449

Rep: Reputation: 34
You don't need to write your own module to do load balancing.

Here are a couple of pages with information about it:
Using nth module: http://linuxgazette.net/108/odonovan.html
Using clusterip module: http://lserinol.blogspot.com/2008/05...-iptables.html (this implements LB on the servers themselves, without the need for a dedicated load-balancer box)

You can also use LD or keepalived:
http://www.ultramonkey.org/3/topologies/lb-eg.html
http://www.howtoforge.com/high-avail...ed-debian-etch
http://billboebel.typepad.com/blog/2...alancing_.html

---------- Post added 12th Oct 2011 at 09:11 ----------

You don't need to write your own module to do load balancing.

Here are a couple of pages with information about it:
Using nth module: http://linuxgazette.net/108/odonovan.html
Using clusterip module: http://lserinol.blogspot.com/2008/05...-iptables.html (this implements LB on the servers themselves, without the need for a dedicated load-balancer box)

You can also use LD or keepalived:
http://www.ultramonkey.org/3/topologies/lb-eg.html
http://www.howtoforge.com/high-avail...ed-debian-etch
http://billboebel.typepad.com/blog/2...alancing_.html
 
1 members found this post helpful.
Old 10-14-2011, 05:08 AM   #6
paradox_mgh21
LQ Newbie
 
Registered: Oct 2011
Posts: 12

Original Poster
Rep: Reputation: Disabled
Smile ThankYou!

ThankYou ThankYou ThankYou.
Every one who helped me .
 
  


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
Redirect incoming traffic to an other port (ubuntu openvpn server) krisox Linux - Newbie 3 12-06-2010 12:22 AM
Why packet incoming interface (sk_buff->dev) effects application reception? farkeu Linux - Networking 1 08-22-2009 06:11 PM
Packet Filter to redirect a packet to a user level process akawale Linux - Networking 3 09-01-2006 12:06 PM
how do you config postfix to redirect incoming email to a php script genux33 Linux - General 0 12-14-2005 03:46 AM
syslogd: how to redirect incoming logs psychobyte Linux - Networking 1 02-22-2004 12:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:06 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