QUESTION /root/myip script question

ostridge

Guru
Joined
Jan 22, 2015
Messages
1,618
Reaction score
517
Hi, I have been playing with ./myip and made a copy to try script an update of my wan-rdns in /etc/hosts
I have noticed that whilst:
the output from ~/myip is showing my wan-ip same as updated by crontab to show ddns-ip from afraid.org.
BUT the actual updated ip is placing the 127.0.0.1 (loopback) with the line
Code:
echo "externip=$externip" > /etc/asterisk/sip_custom.conf
The actual [obfuscated] output with debug on as follows:

Code:
root@pi2:~# ping my.ddns.tld
PING my.ddns.tld (147.x.xx.xxx) 56(84) bytes of data.
64 bytes from xxx.xx.x.147.svr.provider.tld (147.x.xx.xxx): icmp_req=1 ttl=64 time=0.656 ms

root@pi2:~#
root@pi2:~#
root@pi2:~#
root@pi2:~# ./myip
+ fqdn=pi2.dom.tld
+ localnet=192.168.1.0
++ ping -c 1 pi2.dom.tld
++ cut -f 1 -d ')' -s
++ cut -f 2 -d '('
++ grep -m 1 '^'
+ externip=127.0.0.1
+ '[' -e /tmp/127.0.0.1 ']'
+ echo No IP Update Required
No IP Update Required
+ echo 'my ExternIP:'
my ExternIP:
+ curl -s http://myip.dnsomatic.com/
147.x.xx.xxx+ echo ' '

So the relevant question is why would we need the loopback address updated; and shouldn't this update the wan-ip as the stdout suggests it has done?
 

ostridge

Guru
Joined
Jan 22, 2015
Messages
1,618
Reaction score
517
This is very old code. What platform??
Incredible PBX 12.0.74 for Raspberry Pi 2
Asterisk: UP Apache: UP MySQL: UP
SendMail: UP IPtables: UP SSH: UP
LAN port: UP Fail2Ban: UP Webmin: UP
RAM:73172 Disk:51G Raspbian (wheezy) 4.1.15-v7+ armv7l GNU/Linux7.9
Asterisk 11.21.2 Incredible GUI 12.0.39 ; update-guiU22
Private IP: 192.168.1.252 . Public IP: xx.xx.xx.xx
 

Members online

Forum statistics

Threads
25,778
Messages
167,504
Members
19,198
Latest member
serhii
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top