39 votes

Shell Scripting: Proper way to check for internet connectivity?

I highly recommend against using ping to determine connectivity. There are too many network admins that disable ICMP (the protocol it uses) due to worries about ping flood attacks originating from ...
  • 3,560
38 votes

Create wireless access point and share internet connection with nmcli

You can create a hotspot with: nmcli dev wifi hotspot ifname wlp4s0 ssid test password "test1234" where wlp4s0 is the name of your Wifi interface.
  • 1,758
35 votes

Shell Scripting: Proper way to check for internet connectivity?

Testing IPv4 connectivity If your network lets pings through, try pinging 8.8.8.8 (a server run by Google). if ping -q -c 1 -W 1 8.8.8.8 >/dev/null; then echo "IPv4 is up" else echo "IPv4 is ...
33 votes
Accepted

ping displays "Name or service not known"

Although I've never had problem with my other x86_64 PC all running Arch Linux, this frequently happens till date with Arch Linux ARM when running NetworkManager. The problem is like you are connected ...
  • 1,724
18 votes

Get my country by IP in bash

ipinfo.io has nice JSON API for using from command line: $ curl ipinfo.io { "ip": "X.X.X.X", "hostname": "No Hostname", "city": "Hanoi", "region": "Ha Noi", "country": "VN", "loc": "21....
  • 147k
13 votes
Accepted

No Internet connection for new installation

I found that eth0 was not the name of my interface. systemctl enable dhcpcd@enp0s3.service solved the problem. Thank you very much.
11 votes

Shell Scripting: Proper way to check for internet connectivity?

I made a script that uses multiple ways to check internet connection (ping, nc, and curl, thanks to Adam Katz, Gilles, and Archemar). I hope someone finds this useful. Feel free to edit it to your ...
11 votes
Accepted

Ping doesn't work, but I can browse through the internet

Outgoing ICMP (ping) is probably blocked by your firewall or gateway. That you are able to browse the Internet does not need ICMP (ping) to be working. You also might have a proxy configured which ...
  • 12.2k
11 votes

Create wireless access point and share internet connection with nmcli

On a Centos 7 it looks like this. Check if AP is possible at all: iw list | less and search for "AP" among supported interface modes. Browse your devices to find the name: nmcli d And setup and ...
11 votes

No DNS resolution after upgrade from ubuntu 14.04 to 16.04

I solve the problem by using Amrish instructions at Ask Ubuntu Stack Exchange, i.e. by using the following code: sudo rm /etc/resolv.conf sudo ln -s ../run/resolvconf/resolv.conf /etc/resolv.conf ...
  • 343
9 votes

Hotspot and Internet access together — why not?

it is very possible to use hotspot and browse the internet with the same wifi card at the same time (simultaneously).i have been using it for sometime now.ideapad 100s 141br with card intel dualband ...
9 votes

tcpdump won't capture entire packet

The guidance on the Wireshark documentation suggests capturing the entire contents of the packet using this command: $ tcpdump -i <interface> -s 65535 -w <some-file> Looking at the man ...
  • 353k
8 votes

No longer able to reach the Internet on Kali Linux

SOLVED this issue on for myself on my macbook running Kali Linux. Go back into the network settings on virtual box, make sure it says 'Nat' and below that click advanced settings. Make sure "cable ...
8 votes

No longer able to reach the Internet on Kali Linux

You have posted three problems. $ ping www.google.com ping: unkown host google.com Your DNS servers aren't reachable (or likely aren't set at all). $ ping 8.8.8.8 connect: network is unreachable ...
  • 3,781
8 votes
Accepted

Create wireless access point and share internet connection with nmcli

I created a Hotspot with the GNOME Network-Manager. The problem was, that I can not configure the SSID and password in GUI. If you create the Hotspot with the Network-Manager GUI, it creates the file /...
  • 1,753
8 votes
Accepted

How to run a script every 5 seconds only when connected to internet

Add Restart=always to the service unit, so systemd will keep bringing up the service if it crashes. On a side note you should use OnUnitInactiveSec instead of OnUnitActiveSec. OnUnitInactiveSec=10s ...
  • 1,343
7 votes

Arch Linux on Virtualbox Internet Connection Issue on VirtualBox

I just ran into the same problem. Solution turned out simple: systemctl start dhcpcd.service Everything (ping, pacman, etc.) started working after that. BTW: # systemctl enable dhcpcd@enp3s0....
  • 443
7 votes

Block all internet connections unless connected to OpenVPN server

First Allow your local connection and your RELATED, ESTABLISHED connections protocols. $ sudo iptables -A INPUT -p tcp -s 127.0.0.1 -j ACCEPT $ sudo iptables -A INPUT -p tcp -m state --state RELATED,...
  • 6,922
7 votes

No DNS resolution after upgrade from ubuntu 14.04 to 16.04

I had a similar issue and used the solution from here. Below is the method and another link to where they found the info - DNS behavior during OpenVPN connection improved immediately when I followed ...
  • 71
6 votes
Accepted

no internet connection for a kvm guest. what could be wrong?

So to get internet connection to the guest I had to add the following nat table -A POSTROUTING -s 192.168.122.0/24 ! -d 192.168.122.0/24 -p tcp -j MASQUERADE --to-ports 1024-65535 -A POSTROUTING -...
  • 1,428
6 votes

Create wireless access point and share internet connection with nmcli

I know this is an old question, but thought I would add my comments as this may help someone in the future. The whole process is just three commands as @Dzik has correctly mentioned. nmcli ...
  • 499
6 votes

Ubuntu - block internet access to all applications except chosen few

gufw and other default-shipped firewalls aren't designed to filter by application - gufw is an uncomplicated GUI frontend to ufw, and isn't designed to filter on the application level, it's simply an ...
  • 2,420
6 votes

ping displays "Name or service not known"

I've just had problem with same effects. Check if time is set properly. DNSSEC seems to be enabled by default and blocking requests due to "expired" certificates. Some other problems related to this ...
  • 61
5 votes
Accepted

Can't change the default gateway with static IP

Your broadcast address should be 192.168.1.255, not 192.168.1.1.
5 votes

Why am I getting "Curl (6) Could not resolve host" after I did a "yum -y update"?

Try running the command dhclient. I tried it and it worked for me.
  • 61
5 votes

Configure wireless interface for multiple locations

To address multiple wifi configs/ssids, you would better work at the wpa_supplicant level. Just leave your interface as: auto ra0 iface ra0 inet dhcp Install wpa_supplicant with: apt get install ...
5 votes
Accepted

Devuan... Reduce time to wait while internet interfaces being configured during boot

Maybe the udev equivalent (eudev or mdev according to Devuan) isn't behaving 100% the same with regard to hotplug events. It's also possible if you're using a switch that the switch has a very long ...
  • 26.9k
5 votes

ping displays "Name or service not known"

I had this issue on Raspberry Pi 4 running Arch Linux. The symptoms were that there was no DNS, producing the ping error message. I observed by calling date that the time was severely off, about two ...
4 votes

Blocking Websites with /etc/hosts

You need to flush your DNS cache. According to this article, you can do that by restarting the following services: nscd dnsmasq named
  • 169

Only top scored, non community-wiki answers of a minimum length are eligible