LinuxQuestions.org
Help answer threads with 0 replies.
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 02-17-2002, 10:28 AM   #1
bbenz3
Member
 
Registered: Feb 2002
Location: Orlando
Distribution: Whatever I feel like at the time I install.
Posts: 284

Rep: Reputation: 30
iptables router


I am currently learning linux slowly but surely. I am trying to get a router setup so that I can have more than two computers online.
This is my setup:
eth0 --> int lan
eth1 --> ext lan
eth2 --> ext lan
192.168.168.10 --> my int ip
I have this so that I can forward two differentent comps to diff ext ips for gaming purposes. The ftp server is running on 192.168.168.10 on port 2020. I also have a DHCP server running on the int NIC to provide IPs.

I have successfully gotten it to route everything through either ext NIC. However I can't seem to get it to send my int ip through the other NIC.

I used the following to setup the routes that work.
iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT
that works fine. I tried doing:
iptables -I FORWARD -s 192.186.168.10 -o eth2 -j ACCEPT
but that had no affect on my routing.

Last edited by bbenz3; 02-18-2002 at 06:03 PM.
 
Old 02-19-2002, 12:34 AM   #2
LionKing
Member
 
Registered: Jun 2001
Location: Allen, Texas, USA
Distribution: Redhat
Posts: 82

Rep: Reputation: 15
Your linux box is probably configured that at any given time, there is only one default gateway to external network.
i.e. your linux box can get through only one ISP at any given time.

Try to set your linux box with two gateways each with different metric, and perhaps you want it run some routing protocol as well, so the if any changes with your external network(say one ISP down), it will automatically re-calculate routing metric, and re-route packets out.

regds.
 
Old 02-25-2002, 01:18 PM   #3
bbenz3
Member
 
Registered: Feb 2002
Location: Orlando
Distribution: Whatever I feel like at the time I install.
Posts: 284

Original Poster
Rep: Reputation: 30
I have 2 default gateways.
eth1
eth2

I don't exactly have the money to have two ips's. I am pulling two IP's from the same Road Runner and I am trying to pass some int IPs through oen ext NIC card and the rest through the other.
any clues?
 
Old 02-25-2002, 02:21 PM   #4
LionKing
Member
 
Registered: Jun 2001
Location: Allen, Texas, USA
Distribution: Redhat
Posts: 82

Rep: Reputation: 15
You can't have TWO default gateways. i.e. Default gateway cannot be more than one. However, if you have some routing protocol running, then you can have dymanic routing tables(discovered by routing protocols) and it will assigned with prioity number (metric) to routing paths it finds. The discovered routing path are not gateways.

Default gateway is a gateway when there aren't any routing tables matching the destination, its also called 'gateway of last resort'.

regds.
 
Old 02-27-2002, 11:28 PM   #5
bbenz3
Member
 
Registered: Feb 2002
Location: Orlando
Distribution: Whatever I feel like at the time I install.
Posts: 284

Original Poster
Rep: Reputation: 30
when I type in route this is what I get.
Destination Gateway Genmask Flags Iface
192.168.168.0 * 255.255.255.0 U eth0
xx.xx.xx.0 * 255.255.254.0 U eth1
yy.yy.yy.0 * 255.255.252.0 U eth2
127.0.0.0 * 255.0.0.0 U lo
default yy.yy.yy.1.name 0.0.0.0 UG eth2
default xx.xx.xx.1.name 0.0.0.0 UG eth1


I think i understand why everything is going to eth2 now but I duno how to stop it and to change it.
 
Old 02-28-2002, 01:05 PM   #6
LionKing
Member
 
Registered: Jun 2001
Location: Allen, Texas, USA
Distribution: Redhat
Posts: 82

Rep: Reputation: 15
use the route command to manuplate your routing table and default gateway, example

route del default gw xx.xx.xx.1
route add default gw xx.xx.xx.1

man route
info route

good luck.
 
Old 02-28-2002, 01:14 PM   #7
bbenz3
Member
 
Registered: Feb 2002
Location: Orlando
Distribution: Whatever I feel like at the time I install.
Posts: 284

Original Poster
Rep: Reputation: 30
I have looked at that and done that but I don't understand exactly what I should be doing. I need to have two gateways. One should be default I assume and the other is the special one, which I want to route the "special" int IPs through.
plz help
 
Old 02-28-2002, 08:53 PM   #8
bbenz3
Member
 
Registered: Feb 2002
Location: Orlando
Distribution: Whatever I feel like at the time I install.
Posts: 284

Original Poster
Rep: Reputation: 30
I found the answer to the problem.

Here is how to do it.

iptables -t nat POSTROUTING -p all -d 0/0 -s "one int IP" -j SNAT --to-source "IP of one ext NIC"
 
  


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
iptables and linksys router robrecc Linux - Networking 1 11-25-2005 04:34 PM
iptables linksys router robrecc Linux - Security 1 11-25-2005 12:14 PM
iptables behind a router matador Linux - Networking 1 08-25-2004 10:09 AM
AppleTalk over IPTABLES router lumux Linux - Networking 0 12-15-2003 07:34 AM
iptables and hardware router te_conway Linux - Security 1 08-29-2002 06:14 PM

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

All times are GMT -5. The time now is 03:56 AM.

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