Why I can't use wget command in SSH shell?

07
2014-07
  • AndreaNobili

    I have the following problem.

    I am using my RaspBerry (with RaspBian installed) by SSH.

    My problem is that I can't use wget command because it fails.

    For example if I try to execute the following command:

    sudo wget http://dietrofuoritempo.files.wordpress.com/2013/02/bla-bla.jpg
    

    I obtain this error message:

    --2014-05-29 19:39:11--  http://dietrofuoritempo.files.wordpress.com/2013/02/bla-bla.jpg
    Resolving dietrofuoritempo.files.wordpress.com (dietrofuoritempo.files.wordpress.com)... failed: No address associated with hostname.
    wget: unable to resolve host address `dietrofuoritempo.files.wordpress.com'
    pi@raspberrypi ~/driverWireless $ sudo wget http://dietrofuoritempo.files.wordpress.com/2013/02/bla-bla.jpg
    

    The strange thing is that I can ping it:

    pi@raspberrypi ~/driverWireless $ ping dietrofuoritempo.files.wordpress.com
    PING dietrofuoritempo.files.wordpress.com (192.0.80.175) 56(84) bytes of data.
    64 bytes from dietrofuoritempo.files.wordpress.com (192.0.80.175): icmp_req=1 ttl=41 time=164 ms
    64 bytes from dietrofuoritempo.files.wordpress.com (192.0.80.175): icmp_req=2 ttl=41 time=167 ms
    

    Why? What can I do to solve this issue?

    (on my Ubuntu Linux system I have no problem to perform wget command)

  • Answers
  • Tillman32

    It could be your version of wget on the pi. Try forcing IPv4, rather letting it try to use IPv6:

    sudo wget -4 http://dietrofuoritempo.files.wordpress.com/2013/02/bla-bla.jpg
    

    The -4 will restrict it to IPv4.


  • Related Question

    linux - Can't "wget" from my home Debian Lenny server! But the ports are opened!
  • easyyu

    I have a very strange problem for me. In this example dns and IP is hiden for security reason. When I try from putty manager to connect to my Debian and write next command:

        debian:~# wget http://myhost.no-ip.org:1082/archive.tar
    --2011-04-03 03:35:27--  http://myhost.no-ip.org:1082/archive.tar
    Resolving myhost.no-ip.org... xx.10x.66.xxx
    Connecting to myhost.no-ip.org|xx.10x.66.xxx|:1082... failed: Connection timed out.
    Retrying.
    
    --2011-04-03 03:38:42--  (try: 2)  http://myhost.no-ip.org:1082/cccam.tar
    Connecting to myhost.no-ip.org|xx.10x.66.xxx|:1082... failed: Connection timed out.
    Retrying.
    
    --2011-04-03 03:41:53--  (try: 3)  http://myhost.no-ip.org:1082/cccam.tar
    Connecting to myhost.no-ip.org|xx.10x.66.xxx|:1082... failed: Connection timed out.
    Retrying.
    

    ..I can't connect to my Debian server! This message stay till I press ctrl+z.

    But when I try to wget any other site it working! Very strange thing is when I type:

    http://myhost.no-ip.org:1082/archive.tar
    

    command in my firefox web browser the file is reachable and download is strated. So, my port is open. Am I right? What can be the problem? Here is my config from networking :

    debian:~# cat /etc/networking/interfaces
    cat: /etc/networking/interfaces: No such file or directory
    debian:~# cat /etc/network/interfaces
    ### The loopback network interface
    auto lo
    iface lo inet loopback
    
    ###The primary network interface
    allow-hotplug eth1
    auto eth1
    iface eth1 inet static
    address 192.168.50.111
    netmask 255.255.255.0
    broadcast 192.168.50.255
    gateway 192.168.50.99
    debian:~#
    

    The archive.tar file is putted to /vat/www/archive.tar Local port 80 is forwared in my router to external port 1082 My no.ip dns address is vaild and reachable through firefox. Have someone any suggestion what coud be a problem? Thx.

    ..I can't connect to my Debian server! This message stay till I press ctrl+z.

    But when I try to wget any other site it working! Very strange thing is when I type:

    http://myhost.no-ip.org:1082/archive.tar
    

    command in my firefox web browser the file is reachable and download is strated. So, my port is open. Am I right? What can be the problem? Here is my config from networking :

    debian:~# cat /etc/networking/interfaces
    cat: /etc/networking/interfaces: No such file or directory
    debian:~# cat /etc/network/interfaces
    ### The loopback network interface
    auto lo
    iface lo inet loopback
    
    ###The primary network interface
    allow-hotplug eth1
    auto eth1
    iface eth1 inet static
    address 192.168.50.111
    netmask 255.255.255.0
    broadcast 192.168.50.255
    gateway 192.168.50.99
    debian:~#
    

    The archive.tar file is putted to /vat/www/archive.tar Local port 80 is forwared in my router to external port 1082 My no.ip dns address is vaild and reachable through firefox. Have someone any suggestion what coud be a problem? Thx.


  • Related Answers
  • jmtd

    The issue might be that your routing tables, or your ASDL router's, are being too clever, and a LAN-connection attempt to the external address is being re-written or routed to the machine internally. That is, your packets are not visiting the WAN.

    That is an issue, because you are only listening on :1082 on your WAN, not your LAN.

    Try adjusting your apache so that it listens on 1082. If the connection is being routed internal to the LAN, the connection is arriving to your server on port 1082.