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 07-26-2013, 12:27 PM   #1
icedown
LQ Newbie
 
Registered: May 2007
Distribution: Gentoo
Posts: 18

Rep: Reputation: 0
Forwarding to a secondary router


At my house I have 2 internet connections. The primary one is satellite, high speed, very high pings. The second one is a 3G connection, relatively low speed but good ping. My router is an ubuntu machine with 2 nics. One nic is connected to the satellite, the other to the internal network. The 3G gateways is connected to the internal network as well. I'm wanting certain traffic, eg dns, ssh, games, etc, that need low latency to be routed to the 3G gateway from the main router. what kind of iptables rules will I need?
 
Old 07-26-2013, 01:27 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,348

Rep: Reputation: Disabled
iptables rules do not affect packet routing. However, iptables can be used to "mark" packets of a certain kind, and it is possible to route packets based on these "marks".

What you want to do is called policy routing, and you need to have the iproute2 tools installed to be able to do it. Basically, you will need to do this:
  • create one or more alternative routing tables with the ip route add table command
  • create iptables rules that match certain types of packets and "mark" them using the MARK target
  • create at least one rule with the ip rule add command to direct marked packets to a certain routing table
Are you using your Linux system as a router, or do you want to do this just for local traffic from the Linux PC?
 
1 members found this post helpful.
Old 07-26-2013, 01:50 PM   #3
icedown
LQ Newbie
 
Registered: May 2007
Distribution: Gentoo
Posts: 18

Original Poster
Rep: Reputation: 0
It's a router for the network. What iptable should I use to mark? Prerouting in nat?
 
Old 07-26-2013, 02:33 PM   #4
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,348

Rep: Reputation: Disabled
Quote:
Originally Posted by icedown View Post
It's a router for the network. What iptable should I use to mark? Prerouting in nat?
Prerouting in mangle. Use the MARK target and specify a value with the --set-mark option. The MARK value is just a number you can refer to in an ip rule later.
 
1 members found this post helpful.
  


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
port forwarding without router jkeertir Linux - Newbie 3 09-17-2009 11:56 AM
forwarding from router via desktop to laptop diederick76 Linux - Networking 6 01-02-2008 03:53 PM
Ip forwarding on a router rfleming Linux - Networking 4 10-13-2007 04:28 PM
Port Forwarding For Router kool_kid Linux - Networking 4 09-25-2007 03:10 PM
Linksys router- forwarding ports glore Linux - Networking 1 06-02-2004 12:00 AM

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

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