Linux не пингуется google

ping 8.8.8.8 works but ping www.google.com doesn’t

I have tried every «fix» I can find in Ubuntu forums and all over the rest of the internet world and nothing works. The resolv.conf is empty, ifconfig shows nic is functioning, firewall is off, and I threw away the hammer just in case. Unfortunately, I am typing this on another computer on the same network but can’t attach text from the various outputs to show whats going on. Need help on this please.

The resolv.conf file contains these lines:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN search 8.8.8.8 8.8.4.4 

The last line is placed their by the interfaces file when you reboot the system. This is new for 16.04LTS. I’m thinking Windows NT4 wasn’t so bad and neither was Ubuntu Server 12.

How is your system getting it’s IP address? Is it coming from a DHCP server? It is a static IP? Being able to ping the IP address will work without a DNS server IP setup. But it sounds like you don’t have a DNS address setup or your DHCP is not supplying it.

Look at askubuntu.com/questions/143819/… and add your DNS entry for like the Google DNS Servers at 8.8.8.8 and 8.8.4.4

I did all that. My static ip is coming from at&t vdsl box. Im using their dns name-servers and dns-search ip’s. Only thing I can deduce is that at&t is blocking the dns querys.

Interesting. Maybe you might want to contact AT&T and see if they are blocking it in anyway. I guess you could try replacing their DNS servers with the Google DNS servers and see if that works.

7 Answers 7

You need a Name Server in your /etc/resolv.conf file. Edit your /etc/resolv.conf and add a working Name Server. Google provides a free one, 8.8.8.8 .

Place this as the first non-commented line:

You can verify this functionality with:

You can make this change permanent by adding the line to this file your /etc/resolvconf/resolv.conf.d/head file.

Whoopie! Success! excuse me, 36 straight hours banging on this box. It worked. I even put in the at&t ip’s and it worked. Thanks to all you guys for your help and quickness. (Mr. Moderator, these guys needed a pat on the back so ease up on the whole emotionless junk)

Thanks a lot! I couldn’t ping www.google.com after chroot-ing into my ubuntu. Thanks to your solution, now I can do installations etc in the chroot-ed partition.

The marked answer actually doesn’t work on Ubuntu 18.04.01. To fix this issue, here’s what I did:

  • Execute sudo gedit /usr/lib/systemd/resolv.conf
  • Paste nameserver 8.8.8.8 (and/or any other nameserver(s) you want), then save and exit.
  • Add a symlink by executing sudo ln -sf /usr/lib/systemd/resolv.conf /etc/resolv.conf
Читайте также:  Astra linux поменять разрешение экрана

Could you post a link to the page that told you that file resolv.conf should be empty? My guess is that it is misleading at best.

Edit that file with command sudo nano /etc/resolv.conf and put there a single line:

That should fix your name resolution and the various programs that use it — ping, apt-get, etc.

You also ought to investigate why resolv.conf is empty. Perhaps your DHCP server isn’t configured properly.

This is what the file contains: # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND — YOUR CHANGES WILL BE OVERWRITTEN search 8.8.8.8 8.8.4.4 The last line is placed their by the interfaces file when you reboot the system.

I had the same problem, until I edited with the following values the file 50-cloud-init.yaml

 network: ethernets: eno2: addresses: - 192.168.0.50/24 (my static ip address) dhcp4: false gateway4: 192.168.0.42 nameservers: addresses: [208.67.222.222,208.67.220.220] search: [208.67.222.222] 

hope it works for you too

If is using netplan and Google DNS servers would be addresses: [8.8.8.8,8.8.4.4] (maybe better use Cloudflare’s 1.1.1.1) on /etc/netplan/50-cloud-init.yaml and then sudo netplan —debug apply .

You are facing a problem related to DNS Server that you have specified for you system. Check your nameserver entry in /etc/resolv.conf.

The problem is , ping command is not able to identify what is «www.google.com» because your DNS server is not able to resolve it and provide google actual IP address(every server can only be accessed by its IP address)

Solution

Edit the entry in /etc/resolv.conf . Either provide a correct DNS server of a choice in /etc/resolve.conf that can resolve «www.google.com»

or yYou can specify your local system resolver whose IP address is 127.0.0.53 by adding line

or provide Google’s DNS server IP (any one of them): 8.8.8.8 or 8.8.4.4

P.S You can understand better how DNS works here

Not an good idea on Ubuntu 16.04.x just overwriting /etc/resolv.conf . The OS will overwrite it for its own most likely.

The file /etc/resolv.conf is usually a symbolic link to another file:

ls -lisa /etc/resolv.conf 1310924 0 lrwxrwxrwx 1 root root 29 Jul 13 2016 /etc/resolv.conf -> ../run/resolvconf/resolv.conf 

which means it is correct and you can edit it, but most likely another program is going to overwrite it. I’m going to guess you have NetworkManager installed. To my knowledge this service manages the content of your resolve. So you really should try to setup that one. (On other Hand NetworkManager could be disabled on you system. You might have to tell me.)

Try nmtui and add there the correct DNS Server. I also would use 8.8.8.8 only as secondary DNS. Your primary DNS should be a machine or router nearby your local network or whatever you have there.

Читайте также:  Linux перезапуск службы samba

No network-manager. Its a server with no gui. I did get dnsutils installed before it quit connecting to the repositories.

@Gary Mercer: how do you bring the network interface then? (ifup and ifdown?) The Network Managers GUI is an optional component. nmtui is the text-based of that one.

I bring the nic up by rebooting the system. Since its a server, it never gets turned «off.» I have found that using restart services doesn’t always work because of the other inter-related components that make up all the services that use the interface. Its just easier and most efficient to restart all the services with a simple reboot command.

By rebooting your system something «a manager» has to bring your devices. In which did you configure the static IP Addresses?

The issue we addressed here is one that boiled down to resolving domain names to an ip address internally. Since version 15 of Ubuntu server, i believe, uses a system of dynamic configuration files that change every time the service or system is restarted or rebooted. If the administrator makes a change to resolv.conf file, those changes are deleted when the resolver service is restarted.

To make changes permanent, Ubuntu has made a way to make user changes permanent without affecting the dynamic configuration of the config files. The suggestion from L.D. James (above) was to add the changes I needed to make to the /etc/resolvconf/resolv.conf.d/head file.

This made the changes permanent and solved the problem of resolving domain names error message host not found . It is the solution to setting the dns nameserver in the interfaces file and then getting it to the resolver as well. Thank you all for your supreme efforts in solving this puzzle.

Источник

Не могу пинговать гугл используя прокси

Я попытался с IP-адресом также. там говорится, что хост назначения недоступен.

пожалуйста помоги. Заранее спасибо.

2 ответа

Для команд bash вы должны установить прокси отдельно. Для этого вам нужно установить переменную окружения, например:

ping google.com # can't resolve, no proxy set export http_proxy=proxy.example.com:1234 ping google.com # works, proxy set for this bash session. 

Замените адрес и порт вашей конфигурацией прокси. Если вы всегда находитесь за этим прокси, добавьте export http_proxy. командовать ~/.bashrc поэтому он выполняется каждый раз, когда вы начинаете новый сеанс bash.

Или для выполнения одной команды с настройками прокси и без установки переменных среды используйте env Например:

env http_proxy=proxy.example.com:1234 ping google.com sudo env http_proxy=proxy.example.com:1234 apt-get install cowsay 

Чтобы использовать другие сервисы, например HTTPS или FTP, вы должны установить другие переменные:

export https_proxy=proxy.example.com:1234 export ftp_proxy=proxy.example.com:1234 

ping не работает через прокси.

Читайте также:  Подключить ftp как диск linux

Но вы можете использовать утилиту httping для этого. Он отправляет запрос HEAD (по умолчанию) на веб-сервер и измеряет время, необходимое для получения ответа.

httping -x 192.68.1.12:1080 -g http://google.com 
➜ ~ httping -x localhost:1080 -g http://google.com -c 3 PING google.com:80 (/): connected to 64.233.165.113:80 (313 bytes), seq=0 time= 38.49 ms connected to 64.233.165.101:80 (313 bytes), seq=1 time= 66.94 ms connected to 64.233.165.100:80 (313 bytes), seq=2 time= 40.79 ms --- http://google.com/ ping statistics --- 3 connects, 3 ok, 0.00% failed, time 3162ms round-trip min/avg/max = 38.5/48.7/66.9 ms 

    -5 — Используйте SOCKS5. Следует поставить после -x вариант, то есть:

httping -x localhost:1080 -5 -g http://google.com 

Обратите внимание, что измеренное время также включает задержку, вносимую самим прокси-сервером.

Утилита доступна в нескольких репозиториях для разных ОС и дистрибутивов Linux:

Вот ссылка на сайт автора:

Источник

Cannot ping google.com from Ubuntu terminal behind a proxy server

I am connected to the internet through a proxy server. I am using an Ubuntu installation and have made the appropriate network setting changes including in the files /etc/bash.bashrc and /etc/apt/apt.conf files. After these proxy changes that I have made, I am able to download from Ubuntu repositories on the internet. The problem that I want to understand and solve is this : From the terminal, I am able to ping addresses that I am connected to on my intranet. However, I am not able to ping addresses on the internet! Why might this be? A technical explanation would be really appreciated. And how can I get around this and use commands like wget, ping etc (neither of which work right now) like on any other direct internet connection? Note : I have tried export http_proxy variable with the appropriate username and password for my proxy server as shown here but ping still does not work.

2 Answers 2

The usual reason for a proxy server is to isolate internal machines, and force them out through a central point in order to manage bandwidth, content and/or security concerns. Organizations who employ this mechanism will often disable routes from internal machines directly outside.

In this configuration, you are not truly connected to the internet, just the intranet which includes a server that proxies data from the internet to the intranet.

wget can work, if you set up the http_proxy environment variable, and perhaps add the —proxy-user and —proxy-password parameters. It is, in fact, a royal PITA.

ping will not work, if your network admin has disabled direct access to the larger network. To get ping working, you’ll have to petition to have an exception for your workstation/server to be granted a direct route to the internet.

A technical explanation would be really appreciated.

Your network admin has disabled direct access to the internet, probably by dropping packets that are headed outside the intranet.

Источник

Оцените статью
Adblock
detector