ip address / conky

Questions about networking.
In the Original Post please also include the output of inxi -FNzxx
User avatar
amnesix
Posts: 117
Joined: 09 Nov 2013 12:46
Location: Berlin (Allemagne)
Contact:

ip address / conky

Postby amnesix » 27 May 2016 10:17

First, I apologize if I post this in the wrong category.

My problem : I use Conky to follow the eventual difference between :
  • my public IP address (from my provider)
    my VPN-generated IP address
I use(d) for this purpose in conky the following lines (in .conkyrc) :

Code: Select all

${color orange}${alignr}${texeci 68400 wget -O - http://ip.tupeux.com | tail}
${color grey}external IP VPN:  ${color red}${alignr}${texeci 60 wget -O - http://ip.tupeux.com | tail}
and, of course, now, it just doesn't work anymore.

It seems to me that the problem lies by the server (ip.tupeux.com), which just doesn't answer (I can't ping it...), and of course it could be temporary.

But just in case, I'd like to have an other way to display my IP addresses through conky. So maybe there are other servers which serve the problem, which I could use the way I use ip.tupeux.com, or maybe there is another way.

If anyone has an idea, i'd love to hear it !

Thank you !

User avatar
ilu
Posts: 2074
Joined: 09 Oct 2013 12:45

Re: ip address / conky

Postby ilu » 27 May 2016 14:24

No idea about conky or your problem, sorry, but https://isitup.org/check.php?domain=tupeux.com shows that that domain is down.
For inquiries like that I usually use http://whatismyip.org. Don't know whether that works with conky though.

Cehio
Posts: 1
Joined: 13 Oct 2016 07:20

Re: ip address / conky

Postby Cehio » 13 Oct 2016 07:22

Got myself something similar, it too stopped working correctly. Could this be due to the fact that I use proxy server? Here is the address of my ISP, if that matters.

User avatar
Zill
Posts: 1850
Joined: 13 Aug 2013 14:28
Location: Lincolnshire, UK

Re: ip address / conky

Postby Zill » 13 Oct 2016 09:37

The following command returns the current IP address:

Code: Select all

dig +short myip.opendns.com @resolver1.opendns.com
As this command simply produces an output to stdout, hopefully you will be able to use it with conky.

p.s. My thanks go to "Krinkle" for publishing this command.

User avatar
Arjen Balfoort
Site Admin
Posts: 8888
Joined: 26 Jan 2013 19:36
Location: Netherlands
Contact:

Re: ip address / conky

Postby Arjen Balfoort » 13 Oct 2016 09:52

solydxk-conky uses this bash:

Code: Select all

#!/bin/bash

# Reference: http://www.linuxjournal.com/content/validating-ip-address-bash-script
#
# Test an IP address for validity:
# Usage:
#      valid_ip IP_ADDRESS
#      if [[ $? -eq 0 ]]; then echo good; else echo bad; fi
#   OR
#      if valid_ip IP_ADDRESS; then echo good; else echo bad; fi
#
function valid_ip()
{
    local  ip=$1
    local  stat=1

    if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
        OIFS=$IFS
        IFS='.'
        ip=($ip)
        IFS=$OIFS
        [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 \
            && ${ip[2]} -le 255 && ${ip[3]} -le 255 ]]
        stat=$?
    fi
    return $stat
}

# Try three different sources
IP=$(curl -f solydxk.com/ip.php)
if valid_ip "$IP"; then
  echo "$IP"
  exit
fi

sleep 10
IP=$(curl -f ident.me)
if valid_ip "$IP"; then
  echo "$IP"
  exit
fi

sleep 10
IP=$(curl -f checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//')
if valid_ip "$IP"; then
  echo "$IP"
fi


SolydXK needs you!
Development | Testing | Translations

mhwelsh
Posts: 245
Joined: 15 Apr 2013 18:48

Re: ip address / conky

Postby mhwelsh » 13 Oct 2016 13:15

Code: Select all

dig +short myip.opendns.com @resolver1.opendns.com
This requires dnsutils to be installed it was not present in my installation.
It is now and it works a treat.

martin welsh


Return to “Networking”

Who is online

Users browsing this forum: No registered users and 2 guests