networking - traceroute on Linux displays '* * *'

06
2014-04
  • BenjiWiebe

    What is going on? If I run traceroute google.com it outputs 192.168.0.1 for the first router (which is correct) and threee *'s for the rest. I have tried disabling the FireWall on the router (192.168.0.1) but that does not help. Any ideas?

    And yes, I know there is an almost duplicate, and no, it did not help me.

  • Answers
  • mnmnc

    The device after your router - most likely ISP device - is blocking ICMP protocol packets which means traceroute and ping packets.

    This is the reason for * * * istead of response times

    There are tools that could potentialy give the same result to you but they do not use ICMP - they use TCP. The example one is tcptraceroute. Check if this satisfy your requirements.


  • Related Question

    Linux traceroute Countries
  • megaflux

    Okay I was searching now for quite some time and I can't believe it. Is there no traceroute that shows me the hops on a world map? And maybe in a 64bit version

    I found xtraceroute, grace, GTrace... but they are all a little bit rusty.

    Maybe I'm just too stupid

    Anybody knows something


  • Related Answers
  • vtest

    Assuming there are freely downloadable GeoIP databases, free bindings for such databases for almost any programming language and libraries that allow to plot dots on a world map, you could try to implement your own visual traceroute. This is a great idea for a small project.

    Edit: while this answer is more suitable for StackOverflow, here's a very raw visual traceroute app written in Python. While it works for me on Linux, it won't work for everyone, because it has a lot of drawbacks:

    • it uses quite a few third-party Python libraries, which need to be installed. You'll get Import Error if you don't have them
    • it doesn't bundle the world map image it uses [ I grabbed a free image from wikipedia :) ]
    • it doesn't bundle the geoip database it uses [ I'm using the free one from maxmind.com ]
    • it it is supposed to be run on Linux which has mtr installed
    • it uses hardcoded filenames for temporary files

    Here is the code:

    #!/usr/bin/env python
    
    """visual traceroute"""
    
    import subprocess
    import sys
    import time
    
    from PyQt4.QtCore import *
    from PyQt4.QtGui import *
    
    import pygeoip
    
    import wugeo
    
    GEOIPDB = "GeoLiteCity.dat"
    
    class MyForm(QDialog):
    
        """Main app window"""
    
        def __init__(self, parent = None):
    
            """doc"""
    
            super(MyForm, self).__init__(parent)
            self.setWindowTitle("Visual Route")
            self.image_label = QLabel(self)
            self.image_label.setMinimumSize(800, 600)
            self.image_label.setAlignment(Qt.AlignCenter)
            self.load_image("map.jpg")
            self.ip_edit = QLineEdit(self)
            self.tr_button = QPushButton("Traceroute", parent=self)
            layout = QVBoxLayout()
            layout.addWidget(self.image_label)
            layout.addWidget(self.ip_edit)
            layout.addWidget(self.tr_button)
            self.setLayout(layout)
    
            self.connect(self.tr_button, SIGNAL("clicked()"), self.traceroute)
    
        def load_image(self, file_name):
    
            """Loads an image"""
    
            image = QImage(file_name)
            self.image_label.setPixmap(QPixmap.fromImage(image))
            self.repaint()
    
        def traceroute(self):
    
            """Do the traceroute thing"""
    
            self.tr_button.setEnabled(False)
            ip = self.ip_edit.text()
            p = subprocess.Popen(["sudo", "/usr/sbin/mtr", "-n", "-c", "1",
                "--raw", ip], stdout=subprocess.PIPE)
            output = p.communicate()[0]
            lines = output.split("\n")
            ip_lines = lines[::2][:-1] # filter odds, skip last
            ips = [x.split()[2] for x in ip_lines]
            coords = self.get_coords(ips)
            self.draw_dots(coords)
            self.tr_button.setEnabled(True)
    
        @staticmethod
        def get_coords(ips):
    
            """Get coords using pygeoip"""
    
            coords = []
            geoip = pygeoip.GeoIP(GEOIPDB, pygeoip.MMAP_CACHE)
            for ip in ips:
                record = geoip.record_by_addr(ip)
                latitude = record["latitude"]
                longitude = record["longitude"]
                location = (latitude, longitude, 1, "red")
                coords.append(location)
    
            return coords
    
        def draw_dots(self, coords):
    
            """Draws dots on the world map
               Uses temporary files (ugly!)"""
    
            infile = "map.jpg"
            outfile = "/tmp/outmap.jpg"
            for coord in coords:
                wugeo.geo_marker([coord], infile, outfile)
                self.load_image(outfile)
                time.sleep(1)
                infile = outfile
    
    def main():
    
        """Main function"""
    
        app = QApplication(sys.argv)
        form = MyForm()
        form.show()
        app.exec_()
    
    if __name__ == "__main__":
        main()
    
  • Sirex

    visualroute may have a linux version ? Not sure, google seems to say yes, their site seems like no. - Its shareware anyhow though.