Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 11-21-2010, 08:32 AM   #1
Registered: Mar 2007
Posts: 58

Rep: Reputation: 15
IPtables: Route outgoing traffic from internal host to only go a internet interface


My Ubuntu Box has 3 interfaces.
eth0 (Internal
eth1 (External ISP DHCP)
eth2 (External ISP Static IP)
I need the outgoing traffic to internet for 1 of the internal pc ( to only go only go through eth2.

How do i write using iptables to do the above?

Last edited by predatorz; 11-21-2010 at 08:33 AM.
Old 11-21-2010, 11:47 AM   #2
Registered: Oct 2007
Location: Italy
Distribution: Ubuntu
Posts: 77

Rep: Reputation: 17
It's a routing issue, not a firewall issue.

Check google for iproute2 and "source routing"
Old 11-21-2010, 11:13 PM   #3
Registered: Mar 2007
Posts: 58

Original Poster
Rep: Reputation: 15
Okay thanks.
Old 11-21-2010, 11:38 PM   #4
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
Look at Section 4.1 Simple Source Routing for an example:

An updated version of this document may have been supplied with the iproute2 package:

Last edited by jschiwal; 11-22-2010 at 12:08 AM.
Old 11-24-2010, 10:05 AM   #5
Registered: Mar 2007
Posts: 58

Original Poster
Rep: Reputation: 15
Thanks for the help, i managed to get it working nicely.


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
[SOLVED] How do I route traffic from a single host through a specific interface? sab0teur Linux - Networking 3 07-23-2014 06:14 AM
IPTables How to make outgoing traffic show from a different IP address codenjanod Linux - Networking 4 11-05-2009 02:10 PM
Route all HTTP traffic through wired interface on workstation jvolkman Linux - Networking 5 11-29-2006 09:51 PM
Iptables - Redirecting Outgoing Traffic Frankablu Linux - Networking 1 06-12-2005 02:18 PM
Route all traffic of a given type to an interface tsweatt Linux - Networking 0 09-01-2003 01:24 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:44 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration