LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-14-2010, 08:02 AM   #1
laginagesh
Member
 
Registered: Jul 2009
Posts: 42

Rep: Reputation: 16
how to connect two networks using 2 NIC linux pc


hi,
We have two networks,one is 10.0.0.* with mask 255.255.255.0 & the other 20.0.0.* with mask 255.255.255.0 and one linux(RHEL5) PC with two network interface eth0,eth1.(configured as Router)
eth0 is 10.0.0.1 and eth1 is 20.0.0.1
we have enabled IP_Forward using "sysctl w net.ipv4.ip_forward=1"
cat /proc/sys/net/ipv4/ip_forward is 1
but unable to ping from one network to other network.

two networks are connected to Linux PC.(10.0.0.1 & 20.0.0.1)

still wht configuration required to establish the connection between two networks using LINUX PC.

from router(linux PC) both network PC's are pinging but not from one network to other network.


cheers
Nagesh
 
Old 06-14-2010, 08:26 AM   #2
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
Can you ping router (GW) 10.0.0.1 from client box with ip=10.0.0.x? And can you ping router (GW) 20.0.0.1 from client with ip=20.0.0.x?
 
Old 06-14-2010, 08:32 AM   #3
laginagesh
Member
 
Registered: Jul 2009
Posts: 42

Original Poster
Rep: Reputation: 16
i am able to ping router IP 10.0.0.1 from 10.0.0.*
20.0.0.1 from 20.0.0.*
20.0.0.* to 10.0.0.1
10.0.0.* to 20.0.0.1
but unable to ping 10.0.0.* to 20.0.0.*

cheers
Nagesh
 
Old 06-14-2010, 08:40 AM   #4
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
What is output of:
iptables-save
executed on your route?
If possible, please post it here without any confidential information.
 
Old 06-14-2010, 08:56 AM   #5
laginagesh
Member
 
Registered: Jul 2009
Posts: 42

Original Poster
Rep: Reputation: 16
i have executed iptables-save command on router PC
no output.
 
Old 06-14-2010, 09:19 AM   #6
rn_
Member
 
Registered: Jun 2009
Location: Orlando, FL, USA
Distribution: Suse, Redhat
Posts: 127
Blog Entries: 1

Rep: Reputation: 25
sorry didn't read your full post before posting my response, please ignore.

Last edited by rn_; 06-14-2010 at 09:20 AM.
 
Old 06-14-2010, 09:23 AM   #7
rn_
Member
 
Registered: Jun 2009
Location: Orlando, FL, USA
Distribution: Suse, Redhat
Posts: 127
Blog Entries: 1

Rep: Reputation: 25
did you set a route from 10.0.0.x to 20.0.0.x via 20.0.0.1 and the other way round on your box?
 
Old 06-14-2010, 09:57 AM   #8
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
Please, execute on route:
1. lsmod | grep ip
2. chkconfig | grep fire
3. chkconfig | grep ip

Last two need root console.
Post output here, please if will be any.
 
Old 06-15-2010, 12:21 AM   #9
laginagesh
Member
 
Registered: Jul 2009
Posts: 42

Original Poster
Rep: Reputation: 16
Please see the output in the attached file.

Regards
Nagesh
Attached Files
File Type: txt output.txt (1,012 Bytes, 134 views)
 
Old 06-15-2010, 12:40 AM   #10
laginagesh
Member
 
Registered: Jul 2009
Posts: 42

Original Poster
Rep: Reputation: 16
OUTPUT
Quote:
[root@middle sysconfig]# lsmod | grep ip
ib_ipoib 47845 0
ib_sa 24821 5 ib_srp,rdma_cm,ib_cm,ib_local_sa,ib_ipoib
ib_core 50625 14 ib_iser,rdma_ucm,ib_ucm,ib_srp,ib_sdp,rdma_cm,ib_cm,iw_cm,ib_local_sa,ib_ipoib,ib_sa,ib_uverbs,ib_um ad,ib_mad
ipv6 251393 16
dm_multipath 21577 0
dm_mod 58457 2 dm_mirror,dm_multipath

[root@middle sysconfig]# chkconfig --list | grep fire
[root@middle sysconfig]# chkconfig --list | grep ip
hplip 0:off 1:off 2:on 3:on 4:on 5:on 6:off
ip6tables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
ipmi 0:off 1:off 2:off 3:off 4:off 5:off 6:off
iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
multipathd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
ripd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
ripngd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
cheers
Nagesh
 
Old 06-15-2010, 01:33 AM   #11
frandalla
Member
 
Registered: Oct 2003
Location: Tokyo - Japan
Distribution: Slackware
Posts: 348
Blog Entries: 1

Rep: Reputation: 37
I think what you have to do is to create a route saying that if something comes to 10.0.0.* it should go to eth0 and if something comes to 20.0.0.* it should go to eth1.
Imagine you have to groups separated by river. You need a bridge to let the people go from one side to the other. It's the same with your two interfaces.

something like:

route add -net 10.0.0.0 eth0
route add -net 20.0.0.0 eth1
 
Old 06-15-2010, 08:39 AM   #12
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
Code:
[root@middle sysconfig]# chkconfig --list | grep ip
iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Iptables is enabled and works.

Please, on root console type:
iptables
and twice press on TAB button, bash should give you choices among them should be "iptables-save"
Execute it on root console. We need to know all iptable rules, and FORWARD chain as well. Because forward chain will be used to transfer packets between interfaces.

Also please post output WITHOUT any private ip addresses of:
route -n


Thanks.
 
Old 06-16-2010, 06:44 AM   #13
laginagesh
Member
 
Registered: Jul 2009
Posts: 42

Original Poster
Rep: Reputation: 16
Thanks for reply..
problem got solved..i have not added default route in client PC's
After adding default route as
10.0.0.* computers--> route add default 10.0.0.1 netmask 255.0.0.0
20.0.0.* computers--> route add default 20.0.0.1 netmask 255.0.0.0

finally my setup is working...

is there any way to establish connection between networks without adding default route.
dynamic routing.

cheers
Nagesh
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
1 linux box with 2 nic cards connecting 2 different networks vamsi_k Linux - Newbie 4 10-22-2008 05:39 AM
Can see networks, but cannot connect Shaggy1054 Linux - Wireless Networking 2 06-11-2008 12:14 PM
multiple IPs, one NIC, different networks branden_burger Linux - Networking 3 03-15-2005 07:24 AM
Can one linux PC have 2 NIC connect to one Hub ? nhgiang Linux - Networking 5 01-02-2005 07:31 AM
2 Networks for the same NIC?? petecg_76 Linux - Networking 1 04-06-2004 02:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration