LinuxQuestions.org
Review your favorite Linux distribution.
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-2012, 06:41 PM   #1
Zagaz
LQ Newbie
 
Registered: Dec 2012
Posts: 2

Rep: Reputation: Disabled
need to force seperate subnets out via different gateways on debian 6.0.1 iptables


hey Guys,

I have a box running debian 6 with 3 NICs
192.168.52.0/24 --> etho --> debian-|
|--> eth2--> net
192.168.1.0/24 --> eth1 --> debian-|

the eth2 interface has 2 ip adresses both 172.16.1.2(gw 172.16.1.1) and 10.10.10.2(gw 10.10.10.1)

# The tertiary network interface - Outside interface
allow-hotplug eth2
iface eth2 inet static
address 172.16.1.2
netmask 255.255.255.252
network 172.16.1.0
broadcast 172.16.1.3
gateway 172.16.1.1
dns-nameservers 8.8.8.8


iface eth2:0 inet static
address 10.10.10
netmask 255.255.255.252
network 10.10.10.0
broadcast 10.10.10.3
gateway 10.10.10.1
dns-nameservers 8.8.8.8


id like to have an iptables firewall and have the 192.168.52.0 range on the net via 172.16.1.1 dsl router and the 192.168.1.0 range via the 10.10.10.1 isdn router. is this purely an iptables job or will there be some other stuff involved too? - im new to iptables
 
Old 12-23-2012, 12:29 PM   #2
Envite
LQ Newbie
 
Registered: Mar 2010
Posts: 23

Rep: Reputation: 0
You are talking about routing, not firewalling.

You'll need some routing tables and routing rules.

As for the routing table, something like
ip route add table 1 192.168.52.0/24 dev eth2 proto kernel scope link src 172.16.1.2
ip route add table 1 default via 172.16.1.1 dev eth2

And as for the routing rule, something like
ip rule add from 172.16.1.2 lookup 1

Regards
 
Old 12-23-2012, 04:31 PM   #3
Zagaz
LQ Newbie
 
Registered: Dec 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
ill give it a shot, but then how do i firewall these two conncetions?
 
Old 12-26-2012, 05:13 AM   #4
Envite
LQ Newbie
 
Registered: Mar 2010
Posts: 23

Rep: Reputation: 0
You firewall them as usual, with iptables. You only need to be sure to put correct source or destination address in the rules to avoid them catch all connections.
 
  


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
Question regarding 2 gateways one proxy and two subnets ? bakke Linux - Networking 1 09-11-2012 08:26 AM
two seperate networks - two gateways no routing [Centos 4.7] jon_the_eye Linux - Networking 5 07-07-2010 04:32 AM
iptables and multiple gateways caseydentinger Linux - Networking 1 06-02-2009 07:34 PM
On-demand PPP, routing, gateways, and iptables godofpumpkins Linux - Networking 1 10-10-2005 10:46 AM
Multiple Interfaces Seperate Gateways? byersjlpa Linux - Networking 10 01-09-2003 03:47 PM


All times are GMT -5. The time now is 11:19 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration