Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-22-2003, 02:24 AM   #1
Registered: Aug 2001
Posts: 77

Rep: Reputation: 15
simple routing between subnets without NAT

Incredibly stupid question:

How do I simply setup a linux box to route between 2 subnets?

All the tutorials I can find involve NAT or masaquerading and firewall rules to route between a public IP and an internal private subnet range.

But all I want to do is this:

Act as a router between 2 valid subnets:
eth0: 151.x.x.x (just an example)
eth1: 216.x.x.x (just an example)

Or act as a router between 2 different private subnets:
eth0: 10.x.x.x (just an example)
eth1: 192.x.x.x (just an example)

Can't I just set a routing table to do either of these with the route command?



Last edited by iggymac; 03-22-2003 at 02:25 AM.
Old 03-24-2003, 02:52 PM   #2
Senior Member
Registered: Feb 2003
Location: The Real Washington
Distribution: Debian, Android
Posts: 1,819

Rep: Reputation: 46
To the best of my knowledge (which isn't too much) to set up routing on a linux box requires ip masquerading with the firewall.
Old 03-24-2003, 05:38 PM   #3
Registered: Aug 2001
Posts: 77

Original Poster
Rep: Reputation: 15
Thanks for the reply, but I actually figured it out:

As long as you have two nics with ips in two different subnets then the only other thing you must do is turn on forwarding:

echo 1 > /proc/sys/net/ipv4/ip_forward
(not permanent - use /etc/sysctl.conf to make this permanent)

Then as long as each system in subnet A has a gateway of nic A and each machine in subnet B has a gateway of nic B then you're all set!



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
Routing between internal subnets teamchachi Linux - Networking 2 05-11-2005 08:21 AM
Firewall, Routing and Subnets - is this possible? donoss Linux - Networking 2 10-28-2004 01:34 PM
real routing under nat routing nothingmuch Linux - Networking 4 10-27-2003 04:11 PM
Routing between different subnets ... suvajit Linux - Networking 1 05-15-2003 08:07 AM
SMB, NAT, browse list exchange between subnets J_Szucs Linux - Networking 0 01-08-2003 08:51 PM > Forums > Linux Forums > Linux - Newbie

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