Click to See Complete Forum and Search --> : connecting two networks, each with own dhcp&internet


rocketpcguy
12-21-2005, 09:20 AM
there are two separate networks, both with 192.168.114.x, but i can change that to make one 114 and one 115. they each have dhcp & internet given by modem-router.

i want to know how to connect these two networks so that all the computers (mix windows+linux) can talk to one linux LAN server in 114 or ping each other etc.

i dont know what exactly to rtfm for, and is it even possible? i think i would have to get a linux computer with two nic cards to connect them, but how?

dkeav
12-21-2005, 09:52 AM
i would take an old computer put 4 nics in it and use openbsd to make a router with load balancing

http://cvs.openbsd.org/faq/pf/pools.html
if you want to combine the networks into one that can use both gateways then you would only need 3 nics, to keep them seperate you would need 4 and have to setup PF to bridge the two together, but it can be done

rocketpcguy
12-21-2005, 10:24 AM
im confused. what would load balancing be used for connecting two networks for? and what is the 4 nics for, where do each of them will connect? and can it be done with linux instead of bsd?

njcajun
12-21-2005, 05:11 PM
ugh. Nothing like making things harder than need be.

Look, in order for these two networks to talk to eachother, you need something to route packets between them. Generally, this is done with a router. If you have a router with 3 ethernet cards in it, then you can assign each network card an address on a different network, and use the linux routing functionality to forward traffic between the networks. I'm sure there's a "routing with iptables" howto somewhere that'll give you the details.

You don't need bsd, you don't need four nics, you don't need load balancing, you don't need obscure software from cvs. Just a spare box to run linux on to use as your router. Heck, if you felt like outfitting your machines with wireless nics, your wireless, off-the-shelf-from-compusa router could probably handle the job.

Vectorman
12-21-2005, 05:13 PM
I have the same type of setup at my house. The fix I used was to have two NICS in the Server. One for the 114.XXX and one for the 115.XXX networks.

Once you do this both networks can connect to the Server at the same time and Get the information that they wanted.

Just my two cents worth.

joel

rocketpcguy
12-21-2005, 05:28 PM
the thing is, each of the network has a modem router to connect to the internet (total 2 adsl routers).
i thought the way networks works was if that if an IP isnt in the same subnet, it would give the ip to the gateway? in this case, there are two gateways, one for connecting to the other network, and the other to the internet. so how does it work?

gtmtnbiker98
12-22-2005, 12:02 AM
Just install a cheap Linksys router! Hey Vectorman, nice to see a fellow jarhead enjoying the wonderful world of Linux. Did my time in the big green machine.

thaddaeus
12-22-2005, 02:11 AM
VPN, you need to use some sort of vpn(virtual private network) software. This will allow you to such a thing. Linksys offers a router with vpn system stuff built in to host your own vpn. This will allow the connectivity you want.

the thing is, each of the network has a modem router to connect to the internet (total 2 adsl routers).
i thought the way networks works was if that if an IP isnt in the same subnet, it would give the ip to the gateway? in this case, there are two gateways, one for connecting to the other network, and the other to the internet. so how does it work?
The IP is given to the router which acts as a gateway to the internet.

I guess my first question should have been this. Are you connecting the 2 networks accross the internet? or wanting to connect 2 networks together and to the internet?

?1 net1 === internet === net2
--or--
?2 net1==
== Internet
net2==

My guess is the first option of connecting the 2 networks useing the internet, which I would then suggest useing a vpn or setting up a static route useing the internet ips of the systems which is insecure

rocketpcguy
12-22-2005, 02:56 AM
no, its two nearby lans, each with their own access to the internet:
net1==internet +
net2 ==internet
its essential that net1 doesnt use up any internet bandwidth of net2.
i need a way in which net1 people can, for example, play LAN games with net2.
if i get a router, would it work, and would each (windows or linux) client need to be set up some way?

jumpedintothefire
12-22-2005, 10:41 AM
Vectorman has the right idea, but you would need to turn forwarding on in "the box". Next you would need to add a static route on each adsl router(if your router has that ability) to point to the other subnet using the ip of "the box" as the gateway. If you can't add the static route at the adsl routers, then you could add a static route to each and every client involved on both networks. If you don't know what I'm speaking of, walk away now, your in over your head.

dkeav: Linux can do that too, with iproute.

dkeav
12-22-2005, 11:18 AM
sure can, i just tend not to think of linux as a very good routing platform but i am biased in those reguards

PF!!! W00T!!

Modorf
12-22-2005, 01:13 PM
One question I have that didn't seem to be answered is are the two lans in close proximity to eachother. ie same building?

I feel setting up a bridging server (router) between the two lans would be the easest



lan 1 ------ \ /---- dsl 1
linux router/firewall
lan 2 ------ / \---- dsl 2



This would allow you routing between the 2 lans, a single firewall and picking the dsl modem to use depending on source lan. Also would allow for fail over if one modem goes down. This is where the 4 nics would be used and load balancing as mentioned by dkeav. This can be done in Linux and FreeBSD as mentioned by dkeav. You will be able to setup DHCP, DNS and PPPoE for all connections.

If the two lans are in different locations, then you will need to use a VPN to connect the two.

jumpedintothefire
12-22-2005, 03:29 PM
If both lans are using 192.168.114.x and none of the addresses overlap, (using dhcp to hand out a different range on each lan) then a simple bridge with 2 nics should do it. The dhcp broadcasts would need to be blocked at the bridge. If both adsl modems have the same ip and you can't change one of them, you'd have to ensure that the arp requests for the gateway ip and don't cross the bridge either.

rocketpcguy
12-23-2005, 05:15 AM
Modorf: yes, one LAN is upstairs, and the other downstairs.

everyone: (almost) all the ideas seem good, but jumpedintothefire's bridge seems the easiest

If both lans are using 192.168.114.x and none of the addresses overlap, (using dhcp to hand out a different range on each lan) then a simple bridge with 2 nics should do it. The dhcp broadcasts would need to be blocked at the bridge. If both adsl modems have the same ip and you can't change one of them, you'd have to ensure that the arp requests for the gateway ip and don't cross the bridge either.


both LAN's modem-routers are 192.168.x.254, so i will try to make one 253. then i will make the upstairs modem routers dhcp give 1-20 and downstairs 21-30.
then i get a dedicated old computer with two NICs, and set up a brige:
ifconfig eth0 0.0.0.0
ifconfig eth1 0.0.0.0
brctl addbr testbrg
brctl addif testbrg eth0
brctl addif testbrg eth1
ifconfig testbrg up

would that work? and how would i block dhcp from being bridged? (doesnt bridgeing act in a lower layer than iptables?)?

jumpedintothefire
12-23-2005, 01:24 PM
how would i block dhcp from being bridged? (doesnt bridgeing act in a lower layer than iptables?)?
At the arp layer using ebtables, see: http://ebtables.sourceforge.net/
Drop traffic bound for the macaddress of the adsl modems.
Hope this helps, have fun.

rocketpcguy
12-24-2005, 09:04 AM
thanks!

i seem to have less control of the network than i thought. i have to wait for the guys to come back. anyway, ive been asking around, as it seems gaming is not the main priority, perhaps if i could just have a file-server with everyones work files, but connected to each network... but i'll put this in another thread