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?

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

Improve company productivity with a Business Account.Sign Up

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 netmask dev ppp0

and your routing table would then have a line ppp0

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 -d
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  The samba server would be, 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      * eth0

But after, it's      * 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 netmask dev eth0

at startup.  Then since this is no longer the magic 'default' route of, 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 netmask 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.  
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.  =)
mistyblue1Author Commented:
Samba Server
destination        gateway genmask               iface  eth0      eth0  ppp0              lo

Dial up Server
destination        gateway genmask               iface  eth0      eth0  ppp0              lo

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

I did try adding in ipchains -A forward -s -d -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?
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.
mistyblue1Author Commented:
Both machines contain 1 in ip_forward.
mistyblue1Author Commented:
Adjusted points from 200 to 275
mistyblue1Author Commented:
I added route add -net netmask dev ppp0 to the Linux dial up.
And route add -net 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.

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.