Connecting two lans

I have a samba server with dial-in access and another linux box that dials up to it.  The samba box works great, it has 2 workstations connected to it and samba talks to it with no problems over the hub.

The second linux box has 2 workstations connected to it.  Each Lan can ping everything connected to it.  When I connect to the samba server via ppp I am only able to ping the samba server and the samba server is only able to ping the dial up linux box.  How can I get everything to ping one another?

----   ----   ----
|  |---|  |---|  |  <-192.168.1.200
----   ----   ----    Samba Server
 .67    .68   |      
              |  <-- Modem Connection
              |
----   ----   ----
|  |---|  |---|  |  <-192.168.1.85
----   ----   ----    Dial-up Linux Box
 .75   .76
mistyblue1Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
kiffneyConnect With a Mentor Commented:
The output of your routing tables indicates no default route at all.  So you need to either add a default route through ppp0, OR add a specific net route to the other net through ppp0.  I don't know what ipchains -MASQ might be doing, it does not appear to me that you need that at all and it might be confusing the issue - I'd disable all that and get this running with straight routing tables first.  If you did a specific net route for your samba server, you'd say

route add -net 192.68.2.0 netmask 255.255.255.0 dev ppp0

and your routing table would then have a line

192.68.2.0 0.0.0.0 255.255.255.0 ppp0

0
 
rbrCommented:
Pls post the output of the route command on both Linux pcs after the PPP connection is established. In general the ppp makes the route correctly but there could be some problems to.
After this
use the following command on both.

ipchains -A forward -j MASQ 192.168.1.0/24 -d 0.0.0.0/0
0
 
kiffneyCommented:
There's two problems - one is that you have two networks using the same IP address range, and also that ppp is changing your default routes which effectively disables your eth0 devices and thus your lan connections.

Since these are your own networks, the simplest thing would be to renumber one network.  Say, put the samba network on 192.168.2.xxx.  The samba server would be 192.168.2.200, and the other machines would have their ip addresses changed to use 2 in the third 'octet'.  That will make the routing simpler, since you really have two nets and should number them accordingly.  

The second problem is how ppp works.  The ppp connection usually has the 'defaultroute' option set, which means that if you have a working eth0 interface set as the default route (to your LAN), once ppp connects it changes your routing tables and makes ppp0 the default route, thus erasing the route path to your lan.  Like this - before ppp starts, the output of 'route -n' on your Linux box probably looks like this:
destination  gateway genmask iface
0.0.0.0      *       0.0.0.0 eth0

But after, it's
0.0.0.0      *       0.0.0.0 ppp0

See, you lost your route to the eth0 device so you can only ping things visible to ppp0.

I think the best way to do this is to not make the route to eth0 a default route.  Instead, specifically make a route to your network through eth0 - then ppp won't affect it.  Using linuxconf, or by editing /etc/rc.d/rc.local, you want to (on the linux box dialing in) do

route add -net 192.168.1.0 netmask 255.255.255.0 dev eth0

at startup.  Then since this is no longer the magic 'default' route of 0.0.0.0, ppp will leave it alone.  (there's other ways to do this, but this is the simplest, I think).

You might not need netmask, I do it anyway because I can never remember how the network classes work.  Then when ppp starts, you will still be able to ping the other machines on your local lan.

To make it so you can see other machines on the other side of the ppp connection, you need to similarly alter the routing table on  the machine you are dialing into. First make a direct route to the samba lan at startup with

route add -net 192.168.2.0 netmask 255.255.255.0 dev eth0

Then when ppp makes a default route through ppp0 it won't alter the route through your eth0 to the local network.

Also, of course the other boxes on your lan that AREN'T part of the modem connection need to have the samba box and the linux box set up as their gateways - which you probably already have done.  
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
mistyblue1Author Commented:
I will try it this evening and let you know how it went.
Thanks.  =)
0
 
mistyblue1Author Commented:
Samba Server
destination        gateway genmask               iface
 192.168.1.200  0.0.0.0    255.255.255.255  eth0
 192.168.1.0      0.0.0.0    255.255.255.0      eth0
 192.168.2.85    0.0.0.0    255.255.255.255  ppp0
 127.0.0.0          0.0.0.0    255.0.0.0              lo

Dial up Server
destination        gateway genmask               iface
 192.168.2.85    0.0.0.0    255.255.255.255  eth0
 192.168.2.0      0.0.0.0    255.255.255.0      eth0
 192.168.1.200  0.0.0.0    255.255.255.255  ppp0
 127.0.0.0          0.0.0.0    255.0.0.0              lo

I am able to ping 192.168.1.200 from machine 192.168.2.67, however I can't ping 192.168.2.67 from 192.168.1.200

I did try adding in ipchains -A forward -s 192.168.1.0/24 -d 0.0.0.0/0 -j MASQ on the samba server after doing ipchains -P forward MASQ but neither worked.  I checked to make sure ipchains was enabled and it was.

I was able to add  both ipchain commands to the dial up box with no problem.  Suggestions?
0
 
kiffneyCommented:
Check the contents of /proc/sys/net/ipv4/ip_forward on both machines (esp the 2.200 machine).  It should be 1.  If it's 0, do

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

and see if that helps.  I don't think you should need any ipchains stuff at all at this point and kind of confuses the issue.
0
 
mistyblue1Author Commented:
Both machines contain 1 in ip_forward.
0
 
mistyblue1Author Commented:
Adjusted points from 200 to 275
0
 
mistyblue1Author Commented:
I added route add -net 192.168.1.0 netmask 255.255.255.0 dev ppp0 to the Linux dial up.
And route add -net 192.168.2.0 to the Samba server.

Was able to set Samba as a Wins server and everything worked great!  Now both sides are able to ping back and forth and see everything.

Thanks!!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.