element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Design Challenges
  • Challenges & Projects
  • More
Design Challenges
Forum raspberry pi2 - Internet not connecting through hostname, but connecting through IP
  • Forum
  • Documents
  • Polls
  • Files
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 8 replies
  • Subscribers 8 subscribers
  • Views 974 views
  • Users 0 members are here
  • -
  • raspberry
  • internet
  • but
  • through
  • ip
  • hostname
  • not
  • connecting
  • pi2
Related

raspberry pi2 - Internet not connecting through hostname, but connecting through IP

Former Member
Former Member over 10 years ago

Hi

Thanks in Advance

Am using Rapsberry Pi2 with Raspbian Debian Wheezy OS, configured the network as static with my LAN Connection and accessing pi2 by Putty. I tried to ping google.com, am getting the following response 

pi@raspberrypi ~ $ ping google.com

ping: unknown host google.com


but if ping with IP Address, it is working. I tried with browser in pi2, google.com is not working whereas IP is working in browser.

 

pi@raspberrypi ~ $ ifconfig

eth0      Link encap:Ethernet  HWaddr b8:27:eb:81:d6:48

          inet addr:192.168.1.141  Bcast:192.168.1.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:1542 errors:0 dropped:0 overruns:0 frame:0

          TX packets:529 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:127751 (124.7 KiB)  TX bytes:103054 (100.6 KiB)

lo        Link encap:Local Loopback

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:65536  Metric:1

          RX packets:316 errors:0 dropped:0 overruns:0 frame:0

          TX packets:316 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:25456 (24.8 KiB)  TX bytes:25456 (24.8 KiB)

 

I don't know why the internet connection is not working, when am using hostname, Because of this, i couldn't get apt-get update, apt-get install, wget- ....

Pl Help

  • Sign in to reply
  • Cancel

Top Replies

  • fvan
    fvan over 10 years ago +1
    Can you show the network configuration file ? Did you specify one or more DNS servers ?
Parents
  • clem57
    clem57 over 10 years ago

    Simply your DNS is not resolving. So edit or create /etc/resolv.conf adding: (Google public DNS)

    nameserver 8.8.8.8    

    nameserver 8.8.4.4     

    C

    Edit: element14Dave could you please move this to Raspberry Pi section. Gracias!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 10 years ago in reply to clem57

    Thanks for your reply, i tried to edit the resolv.conf, but after rebooting Pi, that file get reset and shows empty file.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • clem57
    clem57 over 10 years ago in reply to Former Member

    That means you are running a resolvconf. Try adding to network config file above after gateway line:

    dns-nameservers 8.8.8.8 8.8.4.4

    C

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 10 years ago in reply to clem57

    thanks a lot, it is working now !!!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • clem57
    clem57 over 10 years ago in reply to Former Member

    Great please mark correct answer for others to know.

    C

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • clem57
    clem57 over 10 years ago in reply to Former Member

    Great please mark correct answer for others to know.

    C

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube