I am working on Linux.
I added a route to a virtual IP say:
126.96.36.199 by running the command:
route -n add 188.8.131.52 gw 127.0.0.1
It has been redirected to my local loopback. I checked the kernel IP table and it has the path setup correctly. Now, I run a script that binds on the same IP and then try to ping the IP from my machine, it gets the ping reply correctly.
But another computer on the same network cannot ping this virtual IP address. I checked up on the Internet and it does say that I can have multiple IPs on my local loopback and they can be viewed from the peers on the same network.
I tried adding a path on the eth0 interface by replacing the
127.0.0.1 by my
eth0 IP address. The information was added to the route table correctly, but then the same thing happened: I was able to ping from my own machine but the peer couldn't.
I Googled up the same thing but none of the solutions helped me out.
The script (it send back ICMP packet replies) is correct (I am sure of that) since I get ping replies from my own machine for the IP which I set up the route for.
Where am I going wrong? Or am I missing out on some configuration?
Any help is much appreciated!
This is the route table
Destination Gateway Genmask Flags Metric Ref Use Iface 184.108.40.206 localhost.local 255.255.255.255 UGH 0 0 0 lo 192.168.1.0 * 255.255.255.0 U 1 0 0 eth0 link-local * 255.255.0.0 U 1000 0 0 eth0 default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
and interface config:
eth0 Link encap:Ethernet HWaddr 00:22:19:ec:ee:50 inet addr:192.168.1.2 Bcast:10.200.200.255 Mask:255.255.255.0 inet6 addr: fe80::222:19ff:feec:ee50/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1