LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 02-02-2012, 05:31 PM   #1
crazy4nix
LQ Newbie
 
Registered: Sep 2011
Posts: 6

Rep: Reputation: Disabled
Network routing question


I'm on a PC with ip 192.168.53.107 (192.168.53.0/24 network). My default gateway is a machine called GATEWAY-MACHINE with ip 192.168.53.1 on its eth0 interface. Now GATEWAY-MACHINE has another interface (eth1) which has an IP of 10.10.0.52 (10.10.0.0/24). Cat5e cable from this eth1 interface goes to a switch. Connected to this switch is a SERVER with ip 10.10.0.200 (10.10.0.0/24).

Now my question is: To be able to communicate with the SERVER (10.10.0.200) from my PC (192.168.53.107), do I need to create (add) a static route on GATEWAY-MACHINE?

Thanks guys!
 
Old 02-02-2012, 05:43 PM   #2
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,246

Rep: Reputation: 309Reputation: 309Reputation: 309Reputation: 309
You should already have one, but if not then yes, you need a route to 10.10.0.0/24 network through eth1 to be able communicate with SERVER.
 
Old 02-02-2012, 05:45 PM   #3
crazy4nix
LQ Newbie
 
Registered: Sep 2011
Posts: 6

Original Poster
Rep: Reputation: Disabled
Yeah I thought that too.. GATEWAY-MACHINE should be aware of both interfaces and shouldn't need a route be entered by an admin.
 
Old 02-03-2012, 11:14 AM   #4
devilboy09
Member
 
Registered: Nov 2011
Location: Iran
Distribution: Debian, CentOS, LFS
Posts: 351

Rep: Reputation: 7
No.there is no need to add a route.your gateway machine knows about both networks, so the routing will be done automatically
 
1 members found this post helpful.
Old 02-03-2012, 11:27 AM   #5
crazy4nix
LQ Newbie
 
Registered: Sep 2011
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by devilboy09 View Post
No.there is no need to add a route.your gateway machine knows about both networks, so the routing will be done automatically
Thank you for the confirmation.
 
Old 02-03-2012, 12:53 PM   #6
crazy4nix
LQ Newbie
 
Registered: Sep 2011
Posts: 6

Original Poster
Rep: Reputation: Disabled
So I applied the above into practice but I've run into a problem. Here is the situation.
I've turned server ns1 (a dual-homed linux box) into a router by enabling ip_forwarding on it (echo 1 > /proc/sys/net/ipv4/ip_forward)

Server ns1:

eth0: 10.10.0.200/24 (default gw: 10.10.0.51)
eth1: 192.168.53.198/24 (I've not set any default gw for this interface)

Routing table on server ns1:
----------------------------
Code:
[root@ns1 ~]# netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.53.0    0.0.0.0         255.255.255.0   U         0 0          0 eth1
10.10.0.0       0.0.0.0         255.255.255.0   U         0 0          0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth1
0.0.0.0         10.10.0.51      0.0.0.0         UG        0 0          0 eth0

I'm trying to ping a webserver (having an ip of 10.10.0.54) from a workstation BUT NOT SUCCEEDING. The properties of workstation are:

eth0: 192.168.53.150/24
default gateway: 192.168.53.198

Here is the routing table on my workstation:
--------------------------------------------
Code:
root@workpc:~# netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.53.0    0.0.0.0         255.255.255.0   U         0 0          0 eth0
0.0.0.0         192.168.53.198  0.0.0.0         UG        0 0          0 eth0

Why is my workstation not able to reach 10.10.0.54? I believe I've setup everything correctly. Please help. Thank you.

Last edited by crazy4nix; 02-03-2012 at 02:11 PM.
 
Old 02-03-2012, 05:58 PM   #7
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,246

Rep: Reputation: 309Reputation: 309Reputation: 309Reputation: 309
Show
Code:
tracepath -n 10.10.0.54
from your workstation, and
Code:
iptables -nL
on its gateway 192.168.53.198 (you can asterisk public IPs).
 
1 members found this post helpful.
Old 02-04-2012, 05:58 AM   #8
devilboy09
Member
 
Registered: Nov 2011
Location: Iran
Distribution: Debian, CentOS, LFS
Posts: 351

Rep: Reputation: 7
i think the problem is with the reply.what message do u get?
i think it's probably time out.so i guess you should have a route from your web server to the workstation too.check your routing table on web server.i think you will find your problem there
 
1 members found this post helpful.
Old 02-04-2012, 07:24 AM   #9
amilo
Member
 
Registered: Oct 2011
Location: Nederland
Distribution: Debian, Centos, Ubuntu
Posts: 65

Rep: Reputation: Disabled
Probely Gateway 10.10.0.51 does not now where network 192.168.53/24 lives. So add a router entry with network 192.168.53.0/24 with gateway 10.10.0.52 on router 10.10.0.51

When 10.10.0.54 recieves a packet from 192.168.53.107 it will send it back to his default gw eg 10.10.0.51. This router wil send back an icmp redirect to 10.10.0.54 with the information "send it back to 10.10.0.52.

Last edited by amilo; 02-04-2012 at 07:29 AM.
 
1 members found this post helpful.
Old 02-04-2012, 10:25 AM   #10
baldy3105
Member
 
Registered: Jan 2003
Location: Cambridgeshire, UK
Distribution: Mint (Desktop), Debian (Server)
Posts: 876

Rep: Reputation: 184Reputation: 184
There are 2 types of route, direct (or connected) and indirect. Direct routes are know about by a host or router (gateway means the same thing as router in IPv4 speak) because they have configured interfaces in those networks. So for PC 192.168.53.0/24 is a direct route. It knows the route without being told as it is connected to the network.

For PC 10.10.0.0/24 is an indirect route. PC only knows about this network if it is told about it by being given an indirect route. This indirect route can be static or dynamic. If the route is configured by the PC administrator then its a static route. If the PC is learning about the route via RIP, OSPF etc then the route is a dynamic route, but this is usually only gateways do this..

For GATEWAY 192.168.53.0/24 and 10.10.0.0/24 are both direct routes so should not need static routes configuring for either.

For SERVER 10.10.0.0/24 is a direct route so should not need to be configured, but 192.168.53.0/24 is indirect so it needs to be given an indirect route to get to it via GATEWAY.

The reason I say "should" above is that there are exception. I have seen Linux distro's that even though configured with 10.10.0.1/24 on an interface will have the host specific interface route "10.10.0.1 255.255.255.255 via eth0" in the route table but will not generate the associated direct network route that is implied by the config. To make this work as it should I had to add a static 10.10.0.0 255.255.255.0 via eth0.

Last edited by baldy3105; 02-04-2012 at 10:27 AM.
 
1 members found this post helpful.
Old 02-04-2012, 12:33 PM   #11
crazy4nix
LQ Newbie
 
Registered: Sep 2011
Posts: 6

Original Poster
Rep: Reputation: Disabled
Solved

thank you eSelix, devilboy09, amilo and baldy3105. All your suggestions were spot on and very helpful in figuring out the problem.

Quote:
i think it's probably time out.so i guess you should have a route from your web server to the workstation too.check your routing table on web server.i think you will find your problem there
You are right. The webserver (10.10.0.54) indeed did not know how to reach the 192.168.53.0 network. Adding a static route there solved the problem. Thanks again to all of you
 
  


Reply

Tags
networking, route


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Routing to internet through one network, and to local ips in another network IceDane Linux - Networking 6 04-02-2009 02:21 AM
Network routing question uncle-c Linux - Newbie 4 02-15-2008 11:22 AM
Routing between two network satishap Linux - Networking 1 12-12-2007 02:14 AM
Network Routing omid1979 Linux - Networking 0 11-15-2004 10:26 AM
2 network cards, 2 network connections - routing problem tvojvodi Linux - Networking 4 02-24-2004 04:26 PM


All times are GMT -5. The time now is 07:12 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration