AOA, Hello, I have a device on which Ubuntu-server is installed. I have two ports, connected to LAN and device respectively. When I ping to some IP address it listens through the port not wanted by me to listen through it, rather I want to ping the IP address through other port of the same device. What should I do.
Asked
Active
Viewed 3,859 times
1 Answers
1
Normally ping sends packets wherever the routing table tells it to. For example, if eth0 is configured for 192.168.1.x/24 and eth1 is configured for 192.168.7.x/24, and you're trying to reach 192.168.7.y, the routing table alone should be enough to ensure that it goes through eth1.
So if that's not happening, you might want to use ip route add to define the correct routes and gateways (after making sure you have the correct address configuration).
In some cases, you can use ping's -I option (as in ping -I eth0) to force packets to be sent through a specific interface. Note that this works only for directly-connected devices (i.e. only for addresses which are in your local subnet), as it completely bypasses any gateway lookup.
grawity
- 501,077