Solved

connecting two lans

Posted on 2004-08-23
10
270 Views
Last Modified: 2010-03-17
Hi,
   i have LAN1 with 155.17.0.0 and LAN2 with 155.16.0.0 . A linux setup has 2 NICs with addresses 155.17.16.35 and 155.16.16.36 . i type "ip route" and the shell shows
"155.17.0.0/16 dev eth1  proto kernel  scope link  src 155.17.16.35
155.16.0.0/16 dev eth0  proto kernel  scope link  src 155.16.16.36
default via 155.16.16.100 dev eth0"

No from what i understood
if i insert "ip route append 155.16.0.0/16 via 155.17.16.35" and "ip route append 155.16.0.0/16 via 155.17.16.35" i will  have a simple gateway. But the pings from the LAN1 to LAN2 does not work any ideas?
0
Comment
Question by:ttsenis
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 36

Expert Comment

by:grblades
ID: 11869317
Hi ttsenis,
All you need to do is configure the network cards with their correct address, set a single default gateway if required and then turn on ip forwarding.
The command to turn on ip forwarding is "sysctl -w net.ipv4.ip_forward=1"
If you want to make forwarding permanent you can edit the entry in /etc/sysctl.conf
0
 
LVL 1

Expert Comment

by:ttimonen
ID: 11882666
That sysctl command does the same as
echo 1 > /proc/sys/net/ipv4/ip_forward

Also things to check:
Can you ping all the machines from the junctionpoint machine?
Is your iptables policies for INPUT, FORWARD and OUTPUT set to ACCEPT and the firewall settings are clean?

0
 
LVL 1

Expert Comment

by:ttimonen
ID: 11882822
Just checking that you are aware that you have to set those (not exactly those, but corrected versions of those, and different in different lans) routing lines to the client machines in the different lans to get it working.
0
 

Author Comment

by:ttsenis
ID: 11911450
Well when i decided to bridge those 2 NICs the ip route returned :
155.17.0.0/16 dev eth1 ... src 155.17.16.35
155.16.0.0/16 dev eth0 ... src 155.16.16.36
With these 2 route roules the linux worked perfectly but without the ability to transfer packets between these to LANs.
Then I decided to make these 2 NICs as a bridge for my 2 LANs so i decide to make the gateaway technic that i described it previously. grblades proposed to make ip forwarding. I did set the ipv4.ip_forward flag but now i get back at ping command the message unreachable network. I do not have any kind of firewall. ttimonen please instruct how to see and change the iptables policy. Also any ideas to see if the rules inside the iptables really works. Eventually if i want to route packet from a certain NIC to other what argument do i use for the ip command syntax because  man ip  does not have a relative topic?
   
     Regards,
       teo
0
 
LVL 1

Expert Comment

by:ttimonen
ID: 11917117
to clean up iptables (that is, disable the firewall),
------------------
#Deletes all rules from every built-in chain in default table
iptables --flush
#Deletes all rules from every built-in chain in nat(Network Address Translation) table
iptables -t nat --flush
#Deletes all usermade chains
iptables --delete-chain
#Changes default policies for the filter to accept all traffic.
iptables --policy OUTPUT ACCEPT
iptables --policy INPUT ACCEPT
iptables --policy FORWARD ACCEPT
------------------

That should get rid of a possible firewall problem.

The output of "ip route" looks fine for the gateway.
How the clients are configured?
Assuming that the client in network 17 has one NIC named as eth0, there should be something like
155.16.0.0/16 via 155.17.16.35 dev eth0
in the output of "ip route" besides the normal local routing .
(the above can be archived with command "ip route add 155.16.0.0/16 via 155.17.16.35").

And symmetrically, in network 16 there should be
155.17.0.0/16 via 155.16.16.36 dev eth0
.
Now each machine should know where to send those packages when they are not located in local network.


Alternative way to configure this is to set clients to blindly use default gateway and configure the default gw to work smartly with all packages.


0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 1

Accepted Solution

by:
gn0 earned 50 total points
ID: 11919324
sirs,
"(the above can be archived with command "ip route add 155.16.0.0/16 via 155.17.16.35")."......
this is not possible and will return an error if you try it .....

once you have enabled the routing and cleaned/disabled the firewall thats all that is necessary in the gateway - the routes are learnt automatically since they are part of the nics configs.

2 other things to check -
there are no other firewalls - esp. on the pc you are trying to ping....
the gateways of LAN 1 and LAN 2 pcs are set properly.....
LAN1 pcs should have the gateway set as 155.17.16.35
for LAN2 pcs it should be 155.16.16.36

remember - no route modifcations are necessary - the networks are part of the nics .... and routes will be learnt -- boot the machine clean and do 'ip route' you will notice the routes.....

goodluck....
GN.
0
 

Author Comment

by:ttsenis
ID: 11922192
well,
       i think that the problem is at peripheral w98 machines. I suppose i did not put the proper gateways. I will try it . By the way gn0 reffers to dynamic routing, does my SUSE 7.1 has such a router (is it consider built in.)
0
 
LVL 1

Expert Comment

by:gn0
ID: 11925652
i dont know if u can call it 'dynamic' routing .... another term like 'link' or 'connected' or better yet 'implied' routing might be more appropriate....

GN.
0
 
LVL 1

Expert Comment

by:ttimonen
ID: 11927673
gn0:

It doesn't cause any errors on my config (well, 192.168.1 and 192.168.2 network with those routing settings).

The thing you are suggesting implies that the machine that connects those two networks do work as a default gateway; that is not always the case, possible or wanted. (that was my option two in my previous post, though).
0
 
LVL 1

Expert Comment

by:gn0
ID: 11927999
ttimonen....

aah.... upon carefully re-reading what u said i now see what u were saying.... but since the clients were w98, ur use of 'ip route' threw me off-track.....
i thought that u were doing "ip route add 155.16.0.0/16 via 155.17.16.35" on the gw .... which was directly connected to the '155.16.0.0/16' network ... this would result in "RTNETLINK answers: File exists" ....

ttsenis....
u only said he had the 2 networks - if however u cannot change the gateways on any of the machines u could also add the routes (as ttimonen said)....
on the LAN1 pcs....
route add 155.16.0.0 mask 255.255.0.0 155.17.16.35

on the LAN2 pcs....
route add 155.17.0.0 mask 255.255.0.0 155.16.16.36

(u might need to put this in a '.bat' file and place a shortcut to the '.bat' file in the startup group... or somewhere where it would be run when the machine boots up ..... w98 hasn't the option to make routes permanent (as nt/2k or later))

u can leave the gateway settings to where ever u need default traffic to go....

GN.
0

Featured Post

New! My Passport Wireless Pro Wi-Fi Mobile Storage

Portable wireless storage to offload, edit, and stream anywhere.

High-capacity, wireless mobile storage designed to accompany professional photographers and videographers in the field to easily offload, edit and stream captured photos and high-definition videos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now