Triangle routing is one of the serious attacks to the Internet infrastructure. It can be caused by malicious routers which misroute packets to wrong directions. This kind of attacks creates network problems such as network congestion, denial of service and network partition and results in degrade of network performance. This paper gives a comprehensive study on how the path analysis combats the triangle routing attacks. We discuss the method, implementation and limitation of path analysis to detect triangle routing in IPv4 network. We also discuss the implementation of path analysis in IPv6 by proposing a new extension header, called Record Path Header.