Joining two networks

The-One

Well-Known Member
Joined
Dec 28, 2005
Messages
136
Reaction score
0
Location
Durban
I am trying to achieve the following,
I would like to connect my two networks together but the problem is they are on different ip ranges
Network A: 172.16.12.0 Subnet: 255.255.255.0 GW: 172.16.1.1
Network B: 192.168.1.0 Subnet 255.255.255.0 GW: 192.168.1.1
Both networks need to ping each other
Is there way I can install two network cards in Linux and configure the routing rules?
And if so How:confused:

Thanks
 
Much easier and cheaper way than dedicating a PC for the routing would be to just get a router. I prefer mikrotik routers because of the huge feature set, they run RouterOS which works great, with a bit less of a learning curve than maybe a full linux distro.

If you don't want to buy the router, RouterOS also runs on PCs.

Can download it here.
 
xrapidx: I run server 2003 on both networks, would it be pretty easy to do in windows?
 
xrapidx: I run server 2003 on both networks, would it be pretty easy to do in windows?

Yup - if the Windows 2003 machine has two nic's (one on each network) - just select both in Network Connections, right click, and goto Bridge.
 
xrapidx: when going to bridge mode, what ip should i use in the bridge? as systems on the 172.16.12 range looses connection to the server? IE server has no ip
 
You could install something like Firestarter, which would take care of the grunt work for you...

Or, you could install bridge-utils and use the familiar addbr / delbr interface to bridge the networks.

Or, you could use ipchains / iptables to accomplish what you want.
 
Maybe I'm wrong and my rustyness will show, but surely you could just use routing tables for this?
 
xrapidx: I run server 2003 on both networks, would it be pretty easy to do in windows?

You are running Windows 2003, and the best thing to do there is to use Routing and Remote Access. That will let you set up what you want, but graphically, which is a bit easier than playing around with command line settings if you are not too comfortable with that. I haven't played with RRAS in a long time, but there is a wizard that should do the trick.

Bridging the networks like was suggested by xrapidx won't work, as that is simply a way to join 2 network segments of the same range sort of like a switch, or to load balance your network cards.

As for doing it on Linux, there are many ways, and some of the experts here will be able to help you a lot more than I can with that OS.
 
On Linux, surely you just need to enable IP forwarding? Just assign an IP address to each interface on each network and then:

sysctl net.ipv4.ip_forward

If this is 0 then it is not enabled.

To enable on the fly:
sysctl -w net.ipv4.ip_forward=1

to make permanent edit the following file:
/etc/sysctl.conf

Add the line:
net.ipv4.ip_forward = 1

(if you already have the entry, change it to 1)

I'm not sure which distro you are using - for instance in SUSE you can just enable it in YAST.

You might need to add some static routes using the ip command.
 
I am trying to achieve the following,
I would like to connect my two networks together but the problem is they are on different ip ranges
Network A: 172.16.12.0 Subnet: 255.255.255.0 GW: 172.16.1.1
Network B: 192.168.1.0 Subnet 255.255.255.0 GW: 192.168.1.1
Both networks need to ping each other
Is there way I can install two network cards in Linux and configure the routing rules?
And if so How:confused:

Thanks

Yes, this is very simple.

You can either do this with 2 networks, or 1 - it's up to you. Since you want to join 2 seperate IP networks (which probably connects to the same switch), you can easily do it with on NIC.

The main IP of you Linux box is probably 192.168.1.1, right? So, add an alias as follows:

Code:
ifconfig eth0:1 172.16.1.1 netmask 255.255.255.0


Then, enale IP forwarding - which depending on the distro may need to be compiled into the kernel, or just added as an option.

The easiest is normally to use

Code:
echo 1 > /proc/sys/net/ipv4/ip_forward



Lastly, you may need to add static routes to both networks, on the box, as follows:

Code:
 route add default gw 172.16.1.1
 route add default gw 192.168.0.1

P.S. are you sure the IP's and gateways are correct? 172.16.12.0 should have a GW of 172.16.12.1
 
Top
Sign up to the MyBroadband newsletter
X