Solved

Another routing problem

Posted on 2004-03-22
14
275 Views
Last Modified: 2011-09-20
I have 3 Linux machines(Debian woody) A,B,C.
A and B are in same network.
C is in diffrent network.
I want to use B as the gateway for A for connecting to the C network.
 -------------------------------------------------
A and B are in 192.168.1.0 network
A    IPaddress -   192.168.1.2
       Netmask 255.255.255.0

B     IP address 192.168.1.1
       Netmask 255.255.255.0


C is in 192.168.0.0 network
     IP address -192.168.0.1
     Netmask      255.255.255.0

Now I want  to connect from   192.168.1.0 network to 192.168.0.0 network and vice versa.

For this In machine B I did a routing.
      route add -net 192.168.0.0 netmask 255.255.255.0  dev eth0
and in Machine C
   route add -net 192.168.1.0 netmask 255.255.255.0  dev eth0
 
  done.Now i am able to ping from machine B to C.

 No  I want to use my Machine B as Gateway for A to access the other network.
 For this In Machine A in the routing entry I added

     route add -net 192.168.0.0 netmask 255.255.255.0 gateway 192.168.1.1 dev eth0.
                     But I cud not ping or ssh to C from A .From C also I cud not ping to A .But I can access Machine B  .
Why?.Am i did anything wrong?.            
0
Comment
Question by:palanisaravanan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
  • 3
14 Comments
 
LVL 4

Expert Comment

by:Jivko
ID: 10656875

Why just not add a secondary IP address 192.168.0.254 for machine B?
ifconfig eth0:1 192.168.0.254 netmask 255.255.255.0

Then you can use machine B for a default GW in both networks
0
 
LVL 4

Expert Comment

by:Jivko
ID: 10656894
And also enable IP Forwarding and Proxy Arp

echo 1 > /proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/net/ipv4/conf/eth0/proxy_arp
0
 
LVL 8

Expert Comment

by:da99rmd
ID: 10656913
You must enable ip forwarding with
echo "1" > /proc/sys/net/ipv4/ip_forward
and add the ipmasq config with
/sbin/iptables -t nat -A POSTROUTING -o (ougoing interface name) -j MASQUERAD

all this is made on the GW machine

/Rob
0
Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

 
LVL 8

Expert Comment

by:da99rmd
ID: 10656931
jviko,
what does the  
echo 1 > /proc/sys/net/ipv4/conf/eth0/proxy_arp
command ?
0
 

Author Comment

by:palanisaravanan
ID: 10657108
Jviko
 I don't want to use machine B as gateway for both the networks.
MY situation is
Machine B should be the gateway for all the outgoing packets sent from
Machine A to the other network i.e Machine C .
I know it is possible.It involves a bit of route command.There only I am struggling.
 
0
 
LVL 4

Accepted Solution

by:
Jivko earned 150 total points
ID: 10665112
da99rmd ,
There is no need of Masquerading or NAT in this situation.

echo 1 > /proc/sys/net/ipv4/conf/eth0/proxy_arp
 Enables proxy arp.

palanisaravanan ,
 Adding a two static routes on machine C :

route add 192.168.1.1 dev eth0
route add -net 192.168.1.0/24 gw 192.168.1.1

And on machine A:

route add -net 192.168.0.0/24 gw 192.168.1.1


Of cource enabling IP Forwarding on machine B is a MUST. :

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



Regards



0
 
LVL 8

Expert Comment

by:da99rmd
ID: 10665235
Yes thats true,
didnt se he was trying to route between 2 private nets :/

/Rob
0
 
LVL 8

Expert Comment

by:da99rmd
ID: 10665242
Yes,
thats true aboute the NAT, i didnt se that he was trying to route between 2 private nets. :/

/Rob
0
 
LVL 8

Expert Comment

by:da99rmd
ID: 10665244
:)
0
 

Author Comment

by:palanisaravanan
ID: 10665356
yes!Every thing is in my private net.

Jivco!
  Thanks.But it is not working
0
 

Author Comment

by:palanisaravanan
ID: 10665384
As Jivko said there is no need for NAT in my case
0
 
LVL 8

Expert Comment

by:da99rmd
ID: 10665442
Try finding out what stops the communication beacuse it should work with the configuration jivco posted.

You dont have some kind of firewall stoping the communication.

Try running a tcpdump on each interface of the B machine and sort out the nessesary trafic perhaps with:

tcpdump -i eth(0 or 1) 'src (ip adress)'

/Rob
0
 

Author Comment

by:palanisaravanan
ID: 10665547
Yeah!It is working now.I didn't do any new thing .Just i restarted my netwoking interfaces.And again start the routing configuration.It started working.Thank you guys
0
 
LVL 8

Expert Comment

by:da99rmd
ID: 10665588
You are welcome
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…

733 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