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 06-26-2010, 04:21 AM   #1
Lord_Devi
LQ Newbie
 
Registered: Jun 2004
Posts: 12

Rep: Reputation: 0
Routing two Subnets


I have two subnets which I am interested in connecting. I've read from beginning to the Linux Networking HOWTO, a few guides here on nixCraft, many forums posts, but have so far succeeded only in confusing myself.

Some basic network details:

Subnet A:
Network Range: 192.168.1.0/24
Gateway 1A: 192.168.1.1/255.255.255.0
Gateway Interfaces:
br0: 192.168.1.1/255.255.255.0
vlan1: 70.76.84.224/255.255.252.0
LAN Domain: tec.lan
Example Host 1A: perpetrator.tec.lan - 192.168.1.10/255.255.255.0
Example Host 2A: rapine.tec.lan - 192.168.1.11/255.255.255/0

Subnet B:
Network Range: 192.168.2.0/24
Gateway 1B: 192.168.2.1/255.255.255.0
Gateway Interfaces:
eth0: 192.168.1.145/255.255.255.0
eth1: 192.168.2.1/255.255.255.0
LAN Domain: tec.lan
Example Host 1B: ubuntu-01.tec.lan - 192.168.2.10/255.255.255.0
Example Host 2B: ubuntu-02.tec.lan - 192.168.2.11/255.255.255.0


I am trying to think of any further relevant details, but that seems to be it to me. If I forgot anything, please tell me.

Ok the question. WHAT do I type? (Explicitly!) And WHERE do I type it? In order to reach ubuntu-01.tec.lan, or ubuntu-02.tec.lan from perpetrator.tec.lan or rapine.tec.lan?

Note: I'm interested in using actuall ROUTES. I can already achieve results similair to this with either a NAT firewall, or with VPN.. but that's not what I am interested in.

Thank you very much for your reads and help in advance! This seems like it should be a simple thing, but I am having incredible difficulty with this..

From what I have found out so far, I should need something like the following:

On Gateway 1B:
Code:
route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.2.1 dev eth1
And on Gateway 1A:
Code:
route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.1 dev br0
Any help would be appreciated!
 
Old 06-26-2010, 05:32 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
your "subnets" make no sense at all. Since when did a subnet contain NIC's???

If you want to networks to be able to communicate then you need a common device on that network, and for all nodes to know to use that intermediate device to get there. You do not need to change any routes on the "gateway" device as that is already fully aware of both subnets by virtue of being connected to them, so it is all the clients that need to be told. That is unless this connecting gateway is already the default gateway in which case it's implicit. You then would need to ensure that the gateway device is configured to route the traffic, under linux this is just a case of running "echo 1 > /proc/sys/net/ipv4/ip_forward"
 
Old 06-29-2010, 07:24 PM   #3
Lord_Devi
LQ Newbie
 
Registered: Jun 2004
Posts: 12

Original Poster
Rep: Reputation: 0
Ok, perhaps I should have labeled them Network A and Network B then. Sorry for the improper terminology

To clarify what it is I am trying to do here a bit.. I have a standard network (192.168.1.0/24) consisting of multiple computers and a DD-WRT router. Then in addition to these normal resources, I have a Host-Only Virtual network running a series of virtual machines. Those virtual machines are on the 192.168.2.0/24 ip range. I simply wish to be able to make my virtual machines aware of the normal, non-virtual network without resorting to Network Address Translation or any kind of VPN solution.

That said, your (acid_kewpie) reply has not been of any help. Could you perhaps try to clarify a bit more now that my intent is hopefully more clear?

Thanks for the reply though Acid, I really appreciate it!
 
Old 06-29-2010, 08:33 PM   #4
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,196

Rep: Reputation: 1044Reputation: 1044Reputation: 1044Reputation: 1044Reputation: 1044Reputation: 1044Reputation: 1044Reputation: 1044
This post http://www.linuxquestions.org/questi...ml#post3877086 might be useful to you. As a matter of fact I am routing 3 subnets or so, you have to skip things which are related to the 3rd subnet only.

jlinkels
 
1 members found this post helpful.
Old 06-30-2010, 01:48 AM   #5
Lord_Devi
LQ Newbie
 
Registered: Jun 2004
Posts: 12

Original Poster
Rep: Reputation: 0
Oh that looks very usefull! Diagrams and everything! Those help SO much! *grins* thanks jlinkels. Wish me luck! I'll post success or failure here later. That looks like some quality instructions and clarifications, thanks a bunch for the help.
 
Old 07-10-2010, 03:54 PM   #6
Lord_Devi
LQ Newbie
 
Registered: Jun 2004
Posts: 12

Original Poster
Rep: Reputation: 0
Just an update.. I have it all working perfectly now. The correct answer was:

1. Tell the machines on Subnet B to use 192.168.2.1 as their gateway, and:

2. On Gateway 1A, configure a static route telling packets trying to reach 192.168.2.0/24 to use 192.168.1.145 as their gateway.

Code:
route add -net 192.168.2.0/24 gw 192.168.1.145
Thank you for your time.

Last edited by Lord_Devi; 07-10-2010 at 04:00 PM.
 
  


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
subnets and routing evilted Linux - Networking 19 08-20-2009 06:16 AM
subnets configuration and routing manolo_caracol Linux - Networking 4 03-17-2008 09:39 AM
Routing between two subnets ScottReed Linux - Networking 22 10-24-2006 11:32 PM
Routing problem with subnets G-Fox Linux - Networking 3 01-24-2006 06:20 AM
Routing between different subnets ... suvajit Linux - Networking 1 05-15-2003 08:07 AM

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

All times are GMT -5. The time now is 03:03 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
Open Source Consulting | Domain Registration