LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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-22-2009, 10:14 AM   #1
obaidmushtaq
LQ Newbie
 
Registered: Mar 2009
Posts: 12

Rep: Reputation: 0
iptables: marking packets for routing to two default gateways


Hi,

I am new to iproute2 and iptables and want to ask the experts here a question:

I have a machine on one network and two routers on the same network. I have to give an "application" (written in C) the choice of using any of the two routers as default gateways.

Right now I am changing the default gateway on the machine using system() call in C, based upon the input to the application. But I would like to have some nice solution.

I thought of creating two default routes using iptables with different tables numbers, marking the packets using iptables and setting the routing rules accordingly for the different marked packets. But the problem is that I cannot mark the packets in C code or can I? Usuallly, they are marked using iptables command.

I wonder if there is a best way to do this. I would really appreciate the responses.

Regards,

Obaid

Last edited by obaidmushtaq; 12-22-2009 at 10:17 AM. Reason: Spells
 
Old 01-13-2010, 05:28 PM   #2
OdinnBurkni
Member
 
Registered: Feb 2007
Location: Iceland
Distribution: Fedora 14, CentOS, FreeNAS
Posts: 126

Rep: Reputation: 20
2 gateways?

Not sure I understand you right or why you need this but you might want to look at load balancing or failover. There are some threads about that, if not here then google it. Might also be called multiwan.
 
Old 01-19-2010, 09:01 AM   #3
obaidmushtaq
LQ Newbie
 
Registered: Mar 2009
Posts: 12

Original Poster
Rep: Reputation: 0
Thanks, I figured out that we can use libnetfilter_queue to do this but I want a non-GPL solution. If you know it, please tell me. I will post a new message on appropirate forum for it.

BR,

Obaid
 
  


Reply

Tags
iptables


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
marking ARP packets with ebtables problem mgautam Linux - Networking 0 10-19-2009 04:34 AM
iptables marking question. netstv Linux - Networking 0 03-26-2009 11:36 AM
iptables packet marking and hfsc xanax Linux - Networking 0 02-18-2007 11:43 PM
On-demand PPP, routing, gateways, and iptables godofpumpkins Linux - Networking 1 10-10-2005 10:46 AM
iptables packet marking meks Linux - Networking 0 09-21-2004 05:14 PM


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