LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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 04-20-2005, 11:40 PM   #1
Ammad
Member
 
Registered: Apr 2004
Distribution: redhat 9.0, fc4, redhat as 4
Posts: 517

Rep: Reputation: 31
firewall/filtering


i have two connections of internet, one 64 kbps and 2nd 128 kbps, squid and iptables running, i want to filter traffic if my client wants ftp downloads then 2nd connection should be utilize, and if client want to access http:// then all traffic should go to 1st interface,
how to implement? any one have idea
thanks
 
Old 04-21-2005, 04:27 AM   #2
fr_laz
Member
 
Registered: Jan 2005
Location: Cork Ireland
Distribution: Debian
Posts: 384

Rep: Reputation: 32
Hi,

assuming you've 2 NICs and 2 IPs from your 2 ISPs :
ISP1 => $IP1, $NIC1
ISP2 => $IP2, $NIC2

let's say that your lan is 192.168.0.0/24

Then you can use :
Code:
iptables -t nat -I POSTROUTING -s 192.168.0.0/24 -d ! 192.168.0.0/24 -p tcp --dport 80 -j SNAT --to-source $IP1
iptables -t nat -I POSTROUTING -s 192.168.0.0/24 -d ! 192.168.0.0/24 -j SNAT --to-source $IP2
This is not exactly what you asked :
Web trafic will be tranlsated to $IP1, so it will go out through the ISP1's interface
All other trafic will be tranlsated to $IP2, so it will go out through the ISP2's interface

Of course you can use filters like -p tcp --dport 80 in the second POSTROUTING rule, but if you have many rules to apply, then you should create a new chain so as to make your script more clear (and maybe more powerfull, but I'm not sure of this).

Last edited by fr_laz; 04-21-2005 at 04:28 AM.
 
  


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
ESSENTIAL FIREWALL RULES for packet filtering studpenguin Linux - Networking 10 12-05-2010 09:06 AM
Packet filtering firewall Maintech Slackware 3 10-30-2005 11:34 AM
Packet Filtering Firewall empre55 Linux - Networking 1 03-20-2005 08:35 AM
MAC address filtering firewall? gigaah Linux - Security 5 06-07-2004 11:05 AM
Firewall / Content Filtering - Recommendations 360 Linux - Security 1 09-25-2003 12:37 PM


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