Python find first network hop
问题 I need to find the first network hop is in a python program on Linux. I can't just depend on the default gateway being the first hop, because some of the network software on the box may (or may not) insert catch all routes: 0.0.0.0/1 128.0.0.0/1 I've thought about popen'ing a tracepath -m 1 <some ip> and parsing the output, but I dislike depending on the format of the output of another program. Reading the routing table from /proc and applying routing logic to it I think is a little beyond my