1

My server has multiple /24 subnets added via network-script files ifcfg-eth0-range0

Now one /24 subnet has connection issues and I need to perform a traceroute to see what's wrong.

How can I have my server using one of those IPs as outgoing IP address when doing a traceroute?

maddo7
  • 155
  • 1
  • 2
  • 11

2 Answers2

1

I imagine your subnets are assigned to (virtual) interfaces and that you want the trace to go through one of these.

The traceroute has an option for this. Check out the man page - you just do this to force the trace to proceed through a specific interface:

traceroute -i <interface> <host>

If this doesn't work, out can add a specific route to the host you want to trace via the gateway you want. Do:

route add -host <host> gw <gw>

Then do the traceroute - and don't forget to delete the route (if you don't need it anymore):

route del -host <host> gw <gw>

Hope it helps.

MrMajestyk
  • 1,023
  • 7
  • 9
  • `traceroute -i eth0:749 google.com` gives `setsockopt SO_BINDTODEVICE: No such device` but I can see this interface from `/sbin/ifconfig`, any idea what's wrong? – maddo7 Dec 10 '15 at 12:18
  • Have to admit I have used this on Cisco and it may be that Linux aliased interfaces do not support binding or something. See my coming edit for another suggestion. – MrMajestyk Dec 10 '15 at 12:36
  • When I do `route add -host google.com gw x.x.x.2` traceroute times out and wget says `failed: No route to host.` – maddo7 Dec 10 '15 at 13:28
  • Well that would then suggest that there is no (configured) way to reach google.com via x.x.x.2 - but: how about adding some details to your question: What does the interface list on the server look like? How are the clients on the non-working subnet configured? What is their default GW for instance? What does traceroute look like from the server? From the client? – MrMajestyk Dec 10 '15 at 14:41
  • Actually the question here is related to http://serverfault.com/questions/741246/ip-range-connected-to-my-server-suddenly-times-out the hosting company told me to do a traceroute both sides to see where the problem was. Meanwhile they looked at it and confirmed the problem has to be server related. The strange thing is the subnet stopped working overnight without any server changes being made during that time. So now I'm struggling to find out why the IPs aren't working and only get a timeout. – maddo7 Dec 10 '15 at 15:41
0

I know this is very old but you can accomplish what you need by using:

traceroute -s source_IP (the ip on that specific interface) destination

Bogdan Stoica
  • 363
  • 2
  • 8