Tag Info

Hot answers tagged

23

When you run: ping -q -c 1 google.com > /dev/null && echo online || echo offline You are essentially only redirecting the output of Stream 1 (i.e. stdout) to /dev/null. This is fine when you want to redirect the output that is produced by the normal execution of a program. However, in case you also wish to redirect the output caused by all the ...


16

Sending a single packet and waiting for a response is going to be one of the fastest possible ways, and ping is a fine way to do that. In fact, depending on your use case, I'd argue that it's too fast, since it doesn't really tell you if the system is actually doing anything useful, just that the kernel's network subsystem is alive and configured. But ...


11

What the RFC says is actually immaterial here. The RFC specifies what goes on at the DNS level, but that's moot if ping doesn't make a DNS query in the first place. When ping receives an all-numeric argument, it interprets it as an IP address. IPv4 addresses are technically 32-bit numbers. They are almost always written in dot-decimal notation, so-called ...


10

The hostname command outputs the hostname of the system from the systems local hostname configuration (could be /etc/hostname or /proc/sys/kernel/hostname or other depending on OS). The command ping -c 1 <hostname> is going to perform a lookup through the libc resolver (which may or may not be DNS. e.g., /etc/hosts is not DNS) of the <hostname> ...


9

DUP means duplicate packet. From man ping: Duplicate and Damaged Packets ping will report duplicate and damaged packets. Duplicate packets should never occur, and seem to be caused by inappropriate link-level retransmissions. Duplicates may occur in many situations and are rarely (if ever) a good sign, although the presence of low ...


9

ping needs root so it can open a socket in raw mode. That's literally the first thing it does when it starts up: icmp_sock = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP); socket_errno = errno; That's the only thing it needs root for, so like many programs, it immediately drops its privilege level back to your normal user account: uid = getuid(); if ...


8

You might have better luck using the tool arping instead. The tool ping works at the layer 3 level of the OSI model, whereas arping works at layer 2. You still need to know the IP of the system however with this tool. There are 2 versions of it, the standard one included with most Unixes (Alexey Kuznetsov's) is the version that can only deal with IP ...


8

That's how the ping command works. You can control it using the count switch, -c. Example $ ping -c 2 skinner PING skinner.bubba.net (192.168.1.3) 56(84) bytes of data. 64 bytes from skinner.bubba.net (192.168.1.3): icmp_req=1 ttl=64 time=1.00 ms 64 bytes from skinner.bubba.net (192.168.1.3): icmp_req=2 ttl=64 time=1.13 ms --- skinner.bubba.net ping ...


7

Like this: nc -z hostname 22 > /dev/null echo $? If it's 0 then it's available. If it's 1 then it's not.


7

It means the reply packet is a duplicate. Each ICMP packet sent out to pint a host has a sequence number that is returned with the response. Sometimes you'll actually get more than one reply. This is usually caused by faulty networks. Wireless networks often rely on re-sending packets if they don't get proper verification, and if the first one actually ...


7

You need to redirect both standard output (> or 1>) and standard error (2>): ping -q -c 1 google.com > /dev/null 2>/dev/null && echo online || echo offline or, redirect one to the other: ping -q -c 1 google.com > /dev/null 2>&1 && echo online || echo offline


7

$ ping -q -c 1 google.com > /dev/null 2>&1 && echo online || echo offline Examples $ ping -q -c 1 google.com > /dev/null 2>&1 && echo online || echo offline online $ ping -q -c 1 googleadf.com > /dev/null 2>&1 && echo online || echo offline offline Speeding up ping Depending on your ping ...


5

I believe it depends on how fast you ping the server: If it's one ping per second (or even slightly faster), they will most likely not care. If it's much faster, they may consider it a DDOS attack by ping flood. It's especially the case if you don't wait for the previous answer before sending the next ping. It reminds me of the kids who brought Yahoo!, ...


5

while ! ping -W 1 -c 4 www.google.com >& /dev/null || ! ping -W 1 -c 4 www.yahoo.com >& /dev/null; do sleep 600 done Though I'd just test connectivity to an IP address; 8.8.8.8 is Google's public DNS server (it has very high availability). Testing whether DNS works is unreliable anyway because the entry may be in the cache. while ! ...


5

Use netcat: nc -z localhost 22 From the manpage -z Specifies that nc should just scan for listening daemons, without sending any data to them.


5

echo 0 >/proc/sys/net/ipv4/icmp_echo_ignore_broadcasts - as root. You may need to also use the -b option with ping and it will most likely require root permissions.


5

According to the Solaris 11 network interfaces manual in chapter 8 “Configuring an IP Interface”: ipadm create-addr -T static -a 10.0.11.10/24 eth0/staticip eth0 is the name of the Ethernet interface (listed by ipadm show-if). staticip is a name that you can choose.


4

Broadcast amplification was used to mount DOS (Denial of Service) attacks. As a result most IP stacks now turn off echo responses to broadcast ping. This is normal behavior now.


4

Well, not exactly... What Wikipedia, and in turn the RFCs say is that since the original RFC 952, which didn't allow leading numerics, you can now have them. ( Per RFC 1123 ) You still can't have all numeric though, which is your problem. Your '6952' isn't a valid hostname, while '6952x' should be fine. But, RFCs aside, I've had problems within the last ...


4

This is what fping was designed for. http://fping.sourceforge.net/ You need to parse the output afterwards instead of relying on a return code, but it is much faster than doing normal ping.


4

Is there a chance that your IP is duplicated on the network? Given that you have done all of this testing the next step would be to use an intermediate hop in between and go to the website from your computer. Use a free proxy online. There are several available. I have seen this issue before and it turned out that the IP was being blacklisted blackholed by ...


4

Generally, in Linux, and Unix, traceroute and ping would both use a call to gethostbyname() to lookup the name of a system. gethostbyname() in turn uses the system configuration files to determine the order in which to query the naming databases, ie: /etc/hosts, and DNS. In Linux, the default action is (or maybe used to be) to query DNS first, and then ...


4

So here are in one answer a summary of my comments. You have 3 solutions depending on your environment: A. Your Windows host is connected to a network 1- Use "Bridge networking" And select the Windows network interface that is configured under Windows to have network access. Make sure you have no firewall on Ubuntu: sudo iptables -L should give you no ...


4

I dont' think that it's related to ping problem, but if you want to put selinux temporary off, you have this option: setenforce 0 it put selinux from enforcing to permissive mode, to check its condition run sestatus to diable selinux permanently you can use system-config-securitylevel or edit with nano or vi /etc/selinux/config and change the parameter ...


4

What about trying a simple OR from your shell? ssh username@franklin.local || ssh -p 22 remote.address.of.franklin I am not really familiar with ZSH, but I guess the evaluation logic would still be lazy, meaning that the second part is only evaluated if the first part fails. Of course the first command may stall for some time trying to figure out if ...


4

First try to ping your gateway 77.68.108.1. If you are able to do so, then I think /etc/resolv.conf is not properly configured. Just open /etc/resolv.conf file . At the top of that file, add a line like this: nameserver 8.8.8.8 This is the resolver to which all DNS resolution requests will be directed to. 8.8.8.8 and 8.8.4.4 are the two open-resolvers ...


4

If you're talking about duplicates described in the man page: Duplicate packets should never occur, and seem to be caused by inappropriate link-level retransmissions. Duplicates may occur in many situations and are rarely (if ever) a good sign, although the presence of low levels of duplicates may not always be cause for alarm. It will produce output ...


4

From ping's manpage: -l preload If preload is specified, ping sends that many packets not waiting for reply. Only the super-user may select preload more than 3. -p pattern You may specify up to 16 ``pad'' bytes to fill out the packet you send. This is useful for diagnosing data-dependent problems in a network. For ...


4

The ether-wake command will work by mac address, so surely you a) wont need an IP address and b) can send the command without harm (if it's already awake, waking it will have no impact?) You can see the list of your existing arp cache by using arp -an and grepping for your MAC to get the IP of the target host. However, because arp is a cache it may have ...


4

The asterisks you're seeing are servers that your packets are being routed through whom are timing out (5.0+ seconds) and so traceroute defaults to printing the *. NOTE: There's even a warning about this in the traceroute man page. excerpt In the modern network environment the traditional traceroute methods can not be always applicable, because of ...



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