Results 1 to 5 of 5

Thread: ping: Name or service not known

  1. #1

    Question ping: Name or service not known

    Hi all,

    I'm writing a ping sweep script as part of some online training/labs and for some reason, each time I run it I get the error:

    ping: 192.168.1.seq: Name or service not known

    The script is:

    Code:
    #!/bin/bash
    for ip in 'seq 1 254'; do
    ping -c 1 $1.$ip | grep "64 bytes" | cut -d " " -f 4 | tr -d ":" &
    done
    As I am sure you can see; all it does is ping an inputted address range from 1 - 254 (and removes a few characters and spaces from the results)

    e.g:
    Code:
    ./ipsweep.sh 192.168.1


    I'm pretty sure the script is fine as it works on other Kali deployments, just not mine!

    I've trawled hours of search engine results and still cannot get this working, so reaching out to the experts! - Help!

    Thanks in advance.

    Rob.

  2. EDIT

    I gave away too much.

    I'll say this, ' != `

  3. #3
    Join Date
    2020-Jan
    Posts
    1
    Try:
    for ip in $(seq 1 254); do

    If it still doesn't work, look at your sources.list file

    Then do apt-get upgrade && apt-get update
    Last edited by JungleJim45; 2020-02-02 at 19:24.

  4. #4
    That is because your command substitution is incorrect, ie you're using apostrophe instead of backtick. You can try JungleJim45's suggestion or

    `seq 1 254`

    instead

  5. #5
    Join Date
    2016-Dec
    Posts
    806
    It was because you use single quotes. It should be backticks, `, or as JumgleJim45 mentions, enclosed in $()

Similar Threads

  1. Replies: 2
    Last Post: 2022-10-11, 11:24
  2. Ping was ok and no need sudo ping
    By cyberjc in forum General Archive
    Replies: 4
    Last Post: 2022-08-23, 12:16
  3. Can't ping using domain name
    By graytips in forum TroubleShooting Archive
    Replies: 1
    Last Post: 2014-08-07, 21:36

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •