HowTo!!! Verify that your VPN is hooking you up correctly

How to do things, solutions, recipes, tutorials
Message
Author
gabtech
Posts: 107
Joined: Sun 14 Apr 2013, 11:42

New netinfo.yad

#21 Post by gabtech »

Hi yafadmin

The new netinfo script does not work correctly in stretchdog 32. The old one works correctly. The new scripts produces a No network status while the old script gives me the public ip.

jafadmin
Posts: 1249
Joined: Thu 19 Mar 2009, 15:10

Re: New netinfo.yad

#22 Post by jafadmin »

gabtech wrote:Hi yafadmin

The new netinfo script does not work correctly in stretchdog 32. The old one works correctly. The new scripts produces a No network status while the old script gives me the public ip.
There is some kind of difference in the output of the network tools between various versions of Linux.

either the phrase "MULTICAST,UP" or "state UP" should work for the line:

Code: Select all

UpLink=$(ip address show | grep "state UP" -A2 | grep inet|xargs )
UpLink=$(ip address show | grep "MULTICAST,UP" -A2 | grep inet|xargs ) 
Just use whichever works with your version.

Naturally, this has not been tested with ALL versions of puppy linux. That level of testing is beyond my time and resources ..

enrique
Posts: 595
Joined: Sun 10 Nov 2019, 00:10
Location: Planet Earth

#23 Post by enrique »

As a report, I did try it on Buterdog64 and bionic32. For mi "MULTICAST,UP" does the job.

gabtech Can you post your result in stretchdog 32 to just

Code: Select all

ip address show
Last edited by enrique on Wed 01 Jan 2020, 23:35, edited 1 time in total.

User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#24 Post by fredx181 »

either the phrase "MULTICAST,UP" or "state UP" should work for the line:
Code:
UpLink=$(ip address show | grep "state UP" -A2 | grep inet|xargs )
UpLink=$(ip address show | grep "MULTICAST,UP" -A2 | grep inet|xargs )
On my Stretchdog 32 system:
With ethernet cable plugged in (same output for both):

Code: Select all

root@live:~# ip address show | grep "state UP" -A2 | grep inet|xargs
inet 192.168.1.4/24 brd 192.168.1.255 scope global eth0
root@live:~# ip address show | grep "MULTICAST,UP" -A2 | grep inet|xargs
inet 192.168.1.4/24 brd 192.168.1.255 scope global eth0
root@live:~# 
With cable unplugged (first command output is empty):

Code: Select all

root@live:~# ip address show | grep "state UP" -A2 | grep inet|xargs

root@live:~# ip address show | grep "MULTICAST,UP" -A2 | grep inet|xargs
inet6 fe80::222:64ff:fe4d:6c17/64 scope link
root@live:~# 
EDIT: With cable plugged in, full output of ip address show

Code: Select all

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:22:64:4d:6c:17 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.4/24 brd 192.168.1.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::222:64ff:fe4d:6c17/64 scope link 
       valid_lft forever preferred_lft forever
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 00:1b:77:16:3a:10 brd ff:ff:ff:ff:ff:ff
With cable unplugged:

Code: Select all

root@live:~# ip address show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 00:22:64:4d:6c:17 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::222:64ff:fe4d:6c17/64 scope link 
       valid_lft forever preferred_lft forever
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 00:1b:77:16:3a:10 brd ff:ff:ff:ff:ff:ff
Fred

User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#25 Post by fredx181 »

Following up on previous post, IMO, the best way (and portable between different OS's) to check for network connection is to use curl "<some common website>" in this case using "https://duckduckgo.com" , then in the script:

Code: Select all

### If "$UpLink" is blank we cannot collect info, so exit ..
#if [ -z "$UpLink" ]; then yad --info --timeout=30 --height=100 --width=100 --center --title="Network Status" --text="$(printf "\n\t   NO Network\n")" &
# exit 0
#fi

# check if there is network connection using curl, replacing the above commented out
 case "$(curl -s --retry-delay 3 --retry 3 --max-time 10 -I https://duckduckgo.com | sed 's/^[^ ]*  *\([0-9]\).*/\1/; 1q')" in
  [23]) echo "OK, there is network connection, continue..." ;;
  *) yad --info --timeout=30 --height=100 --width=100 --center --title="Network Status" --text="$(printf "\n\t   NO Network\n")" &
 exit 0 ;;
 esac
Fred

User avatar
ETP
Posts: 1193
Joined: Tue 19 Oct 2010, 19:55
Location: UK

#26 Post by ETP »

Choice is a fine thing.
Here is a link to a dynamic utility to give an on-screen display.

http://murga-linux.com/puppy/viewtopic. ... 242#978652

(Requires basic conky)
EDIT: 4th January 2020 - Please note that it is not suitable for use with Debian Dogs.
Last edited by ETP on Sat 04 Jan 2020, 14:17, edited 1 time in total.
Regards ETP
[url=http://tinyurl.com/pxzq8o9][img]https://s17.postimg.cc/tl19y14y7/You_Tube_signature80px.png[/img][/url]
[url=http://tinyurl.com/kennels2/]Kennels[/url]

enrique
Posts: 595
Joined: Sun 10 Nov 2019, 00:10
Location: Planet Earth

#27 Post by enrique »

I am on BusterDog64 and it has Conky as default. I try to manually install but show nothing. One thing is missing "/root/.config/wallpaper/bg_img" where can I find this?

Edit: After doing conkytogle I have NET:EXT: ***.***.*** over IP(wlan0): ###.###.###. But this value never gets updated if I start VPN or STOP?

What I am doing wrong?

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#28 Post by jamesbond »

My version, as a way to say thanks. May this be useful for those who need it.

Code: Select all

#!/bin/sh
# Inspiration: http://murga-linux.com/puppy/viewtopic.php?t=117675

TMP=/tmp/ipinfo.$$
cat > $TMP << EOF
Local IP Address(es)
--------------------
$(
ifconfig | sed -n '/^[a-z].*:/ {s/:.*/:/; N; /inet /!d; s/:.*inet /: /; s/[ ]*netmask.*//; H}; ${x;s/^\n//;p}'
)

Remote IP address
-----------------
$(curl -s https://geoip.ubuntu.com/lookup | xml2 | sed 's|/Response/||; s/=/: /')
EOF

[ -z "$DISPLAY" ] && cat "$TMP" ||
Xdialog --fixed-font --title "Network Info" --no-cancel --editbox "$TMP" 0 0 2> /dev/null
rm -f $TMP
For this to work, you need "xml2" which "flattens" XML to a line-oriented format (which then you can process with grep/sed/awk/etc). The original source of this small nifty utility has been blown away by time, but fortunately Debian folks keeps a copy for us.
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

enrique
Posts: 595
Joined: Sun 10 Nov 2019, 00:10
Location: Planet Earth

#29 Post by enrique »

@jamesbond Your script works very nice. One more sample for my collections.

Now to be honest YOU MADE MY DAY. I like to work in many projects. One of then was in Real Need of your suggested xml2. As this too parse also HTML. So THANK YOU.

User avatar
ETP
Posts: 1193
Joined: Tue 19 Oct 2010, 19:55
Location: UK

#30 Post by ETP »

enrique wrote:I am on BusterDog64 and it has Conky as default. I try to manually install but show nothing. One thing is missing "/root/.config/wallpaper/bg_img" where can I find this?

Edit: After doing conkytogle I have NET:EXT: ***.***.*** over IP(wlan0): ###.###.###. But this value never gets updated if I start VPN or STOP?

What I am doing wrong?
Hi enrique,
Sorry my fault, I did not realise that you were using BusterDog64.
The .pet I linked to is only suitable for Pups such as Bionicpup64 8.0
and easyos.
Regards ETP
[url=http://tinyurl.com/pxzq8o9][img]https://s17.postimg.cc/tl19y14y7/You_Tube_signature80px.png[/img][/url]
[url=http://tinyurl.com/kennels2/]Kennels[/url]

enrique
Posts: 595
Joined: Sun 10 Nov 2019, 00:10
Location: Planet Earth

#31 Post by enrique »

No need to say it is your fault. In fact if any, We the DebianDog users are the ones confusing all of you.

We understand that we need to unpack the pets and rebuild as deb packages. Only when there is binaries is when we take things a little more carefully.

Now your pet has only script. and I guess Conky is Conky. Then what would then prevent the updates. It does show correct IP at first. But does not update.

ETP could you at least orient us in Installing to usb and save to sd card. Well I am doing it more as a learning project, but Lucius1202 has a laptop that had broken HDD but has 2 USB and 1 SDCARD. 1 USB is used for Mouse. So he wants to have puppy save in SDCARD. He expect to boot USB - SYSTEM to RAM, then be able to remove USBFLASH so that he can have a spare USB. I guess we need to edit fstab & rc.local to have /dev/mmcblkop1 auto mount. I know you have post on it. Any help appreciated. We wait for you on that thread.

User avatar
ETP
Posts: 1193
Joined: Tue 19 Oct 2010, 19:55
Location: UK

#32 Post by ETP »

Hi enrique,

I have edited my previous post to make it clear that the .pet is not suitable for dogs.

The main reason for it not working is that the syntax in the conf file is ancient
(pre 2014) & Conky has moved on since then.

I will endeavour to produce a new version specifically for Dogs & will PM a copy to
you for testing.
With regard to Lucius1202 I gather that his HD checks out ok so will let sleeping
dogs lie.
Regards ETP
[url=http://tinyurl.com/pxzq8o9][img]https://s17.postimg.cc/tl19y14y7/You_Tube_signature80px.png[/img][/url]
[url=http://tinyurl.com/kennels2/]Kennels[/url]

Post Reply