I asked this question at Stack Overflow and then thought this may be the better place to ask.
Given the following situation:
PC --- |aa RTR1 bb| --- |aa RTR2 bb| --- |aa RTR3 bb| etc
Each of the |aa rtr bb| is meant to be a router with two ports aa and bb.
My question is this. When you do a trace route from PC which router port address should respond with time to live exceeded in transit message?
I seem to remember being taught to think of the router as being in as many parts as ports, so that in my scenario when aa is forwarding the packet to bb and decrements the ttl to 0, it will be the address of the aa port in the failure message. I am trying to find the definitive answer.
Thanks.
Without going too far into how routing works. You will only every see responses from the interface that is "facing" you machine.
So you in your example, the TTL Exceeded message would always come from one of the 'aa' interfaces. Basically the logic that processes the packet happens in between the two interfaces, and then any response or forward is sent out the correct interface. In you case a TTL exceeded message would be sent out of 'aa' because that is the only way to get back to your machine.
Definitive response, maybe not, but it is the case in all the tests I do. I think the router can not route as the TTL is null, so before routing, the ICMP packet is sent. So it is the first IP found in the path.
«will RTR1 respond with port aa's address or port bb's address»
It is totally arbitrary and a somewhat silly question.
Consider the case where the ICMP is coming in by way of port 'aa' but it is actually targeted the the address of port 'bb': which one should be the source address in the ICM reply? 'aa'? 'bb'? or whatever other address the router has got?
»think of the router as being in as many parts as ports»
Nodes (touter's or computers) don't have addresses in the TCP design, only interfaces have addresses but ICMP is done by nodes not interfaces. This opens up a fair amount of ambiguities. They are in effect intentional. Note that the Linux TCP/IP stack has a somewhat different design, but it is deviant.
As the others pointed out, most of the time routers will answer from the 'aa' interface. Since I can't post comments yet, I will complement the previous answers here. It is also possible to have unnumbered interfaces on point-to-point links between routers, if you want to save some IP addresses, and you are not interested in pinging interfaces seprately. In this case you can access the router by the IP address assigned to the loopback interface, and this address will be the one you will also see in traceroutes.
This however is an exceptional case, and not a particulary good operational practice.