How to set static routes for packets, within the same Network?

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat How to set static routes for packets, within the same Network?
# 1  
Old 03-30-2017
How to set static routes for packets, within the same Network?

I have three systems A,B,C. I want to configure A in such a way that all packets from A to C goes via B.

I tried:
1. ip route add 'ip of C' via 'ip of B'
2. route add -net 'net address' netmask gw 'ip of B'

These commands work initially when I try a ping or traceroute and expire after attempting ping twice or thrice.

A's IP Address: 192.168.0.130
B's IP Address: 192.168.0.150
C's IP Address: 192.168.0.140

In Windows systems we achieve routing A's and B's traffic via C by running the following commands in A and C:
route delete 192.168.0.0
route add 192.168.0.0 mask 255.255.255.0 192.168.0.150

After executing the above commands, all network traffic from A and C will be routed via B.

I am looking for a linux equivalent of the same.
# 2  
Old 03-30-2017
It looks as the three hosts are on the same subnet. In this case you cannot use "static routes" because any route - static or else - just defines a way to get from one subnet to another, not to get somewhere on the same subnet.

You may want to define a "proxy" server, but you will have to install additional software (which one depends on which protocols you want to be affected by the proxy) on at least the B-server where you want to route the traffic through.

Another possibility is to put the systems on different subnets: A goes to one subnet, C goes to another subnet and B has one interface in in both these networks AND has "IP-forwarding" enabled. This way you can enforce all packets between A and C to go through B and - using a firewall software, you can even apply additional rules for which packets to allow and which to drop (forbid).

I hope this helps.

bakunin
# 3  
Old 04-01-2017
Hi,

I was able to solve the problem by performing the following steps:

1. Static IP address was set.
2. Gateway IP was set to the IP of system B.
2. Automatic DNS was turned off.
3. Network was restarted.
4. Default route entry of the Network Address has to be deleted.

After doing these steps in Systems A and C all packets were getting routed via B.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Centos-quick way to check if static routes are persistent

Hi All, Is there a quick way to check whether the current routes on my centos are persistent or not before rebooting ? i can take a route -n output but i may completely lost access to my server if the routes are gone. thanks. (1 Reply)
Discussion started by: coolatt
1 Replies

2. SCO

Static routes in SCO

Hi, Just a question of thought. Why one needs to add static routes on Unix servers ? If I had ethernet card, it already has the settings for gateway for incoming and outgoing requests. We donot have to explicitly set the route it should take. Then what is the use... (3 Replies)
Discussion started by: dextergenious
3 Replies

3. IP Networking

Unix Network Routes

I would really appreciate some help with HP UX's Network Routes. Basically, what I want to do is, I would want a system with global ip (eg: 202.144.138.122) to ping/access my HP-UX server which is with private IP address (192.168.1.23). I have all the routers/switches in between properly route... (2 Replies)
Discussion started by: damchey
2 Replies

4. IP Networking

I need HELP to Set up Coyote Linux router with 1 static IP & 64 internal static IP

hello, i need help on setting my coyote linux, i've working on this for last 5 days, can't get it to work. I've been posting this message to coyote forum, and other linux forum, but haven't get any answer yet. Hope someone here can help me...... please see my attached picture first. ... (0 Replies)
Discussion started by: dlwoaud
0 Replies

5. Solaris

Add Static Routes to new physical address

Hi, I need help to add new route: 10.252.0.138, GW 10.252.0.129 to e1000g1 and 10.252.0.10, GW 10.252.0.1 to e1000g2 tnx (4 Replies)
Discussion started by: mehrdad68
4 Replies

6. AIX

Capture Network Packets from AIX

Hi, I am using smitty to create and configure a print queue. I am giving a print of a text file to the print queue created. I am using this in network. How to capture network packets of the print from AIX to the printer and printer to AIX. I tried Wireshark to capture network packets. I am... (16 Replies)
Discussion started by: meeraramanathan
16 Replies

7. Ubuntu

How to set guest static IP

Hi folks, Ubuntu 8.04 server amd64 - host Ubuntu 6.06 server amd64 - guest KVM I referred; The Kernel Virtual Machine https://help.ubuntu.com/community/KVM and couldn't figure out how to set guest static IP address Host; /etc/network/interfaces # This file describes the... (3 Replies)
Discussion started by: satimis
3 Replies

8. AIX

Static Routes question

I added a static route through smit using: Communications applications and Services ==> TCIP/IP ==> Further Configuration ==> Static Routes ==> Add a Static Route ==> Route Type of host Filled in Destination Address, Default Gateway Address and Network Interface of en0. This... (2 Replies)
Discussion started by: jyoung
2 Replies

9. UNIX for Dummies Questions & Answers

are dropped packets a sign of network problem?

in a xen environment , i see a lot op dropped packets via netstat -i Is this a sign of network problems, or is it normal to see this kind of numbers? i'm not sure how to interprete the data. is this normal, bad, critical. What are your stats on this? I guess i have a xen issue of some sort,... (1 Reply)
Discussion started by: progressdll
1 Replies

10. UNIX for Dummies Questions & Answers

Dumping network packets

Hi, My Solaris Workstation has got 4 NICS, out of which one of them(bge3) is unplugged from the rest of the external network & connected to other interface(bge1). The isolated NIC serves as a simulated Ethernet Interface for my application under development. Now, I'd like to capture RAW... (1 Reply)
Discussion started by: smanu
1 Replies
Login or Register to Ask a Question