News: This forum is now permanently frozen.
Pages: [1] 2
Topic: [solved]getting ip address from pppoe interface by bash/perl script  (Read 4479 times)
« on: July 20, 2013, 17:35:54 »
tecuma *
Posts: 5

hello community,

sorry if there is allready a thread about this  Grin.
i have checked the documentation and searched the forum but could not see the requested info.

is it possible to get the ip address from the pppoe interface by a script (bash or perl) from the internal lan side? does anyone has made this allready?

i have a new dyndns service (after the changes at dyn  Tongue). i need this information to update the ip address for a certain hostname.



best regards

--christian
« Last Edit: September 06, 2013, 08:42:52 by tecuma »
« Reply #1 on: July 20, 2013, 18:06:54 »
Fred Grayson *****
Posts: 994

This will return your current public IP address. You need to have wget in your path.

#!/bin/bash
wget -O - -q icanhazip.com

--
Google is your friend and Bob's your uncle.
« Reply #2 on: July 21, 2013, 05:37:01 »
Lee Sharp *****
Posts: 517

Cool script, Fred!  But there is also that information from the m0n0wall itself in various ways.  But more than that, you know that the Dynamic DNS can work with more than just the listed services, right?  I am using No-IP.org

Service type    DynDNS (Custom)
Hostname    myserver.no-ip.org
Server    no-ip.com
Port    (blank)
MX    (blank)
Username    
Password    
« Reply #3 on: July 21, 2013, 16:42:39 »
Fred Grayson *****
Posts: 994

Sure, there are more than one way. You can scrape the Status: Interfaces page with the added complexity of also providing login credentials.

Or you can SNMPGET the appropriate OID.


--
Google is your friend and Bob's your uncle.
« Reply #4 on: August 13, 2013, 09:06:18 »
tecuma *
Posts: 5

hi,

thank you for the infos.

when i try wget from the internal lan i get an error.

Code:
wchris@runner:~$ wget -O - 192.168.10.1
--2013-08-13 09:03:17--  http://192.168.10.1/
Verbindungsaufbau zu 192.168.10.1:80... verbunden.
HTTP-Anforderung gesendet, warte auf Antwort... 401 Unauthorized
Authorisierung fehlgeschlagen.

do i have to configure something in the monowall so i get the info about the public ip address?

best regards

--christian
« Reply #5 on: August 13, 2013, 15:42:20 »
Fred Grayson *****
Posts: 994

I can't make any sense of your error output - it's not in English, and it's not clear to me what the input was either.


There have been changes to m0n0wall recently that make scraping it for data like this more complicated.

The shell code I posted originally provides you with the information you want and has been verified to work. Is there some reason you can't use it?


--
Google is your friend and Bob's your uncle.
« Reply #6 on: August 13, 2013, 18:42:23 »
Lee Sharp *****
Posts: 517

You input is wrong.  You have;
Code:
wget -O - 192.168.10.1

It should be;
Code:
wget -O - -q icanhazip.com

The script is querying an outside server to see what your IP appears to be.  You are trying to query m0n0wall, and failing with an authorization error.  If it had "worked" all you would get is the source of the status page printed to the console.
« Reply #7 on: August 16, 2013, 09:34:29 »
tecuma *
Posts: 5

hi,

@fred
sorry. did not checked the output for the language.

@lee
thank you for your infos. now i understand the first suggestion from fred better.

i tried from another box where i have an english language environment.
when it try it from there i get

Code:
wchris@coruscant ~ $ wget -O - bike.os-plus.de
--2013-08-16 08:24:35--  http://bike.os-plus.de/
Resolving bike.os-plus.de... 92.194.108.133
Connecting to bike.os-plus.de|92.194.108.133|:80... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Authorization failed.

this is ok for me. i get the public ip address so i am able update my dyn dns info.

many thanks to all.

best regards

--christian
« Reply #8 on: August 17, 2013, 04:27:34 »
Lee Sharp *****
Posts: 517

You are still doing it wrong.  All you are doming is looking up the bike.os-plus.de IP address.
Code:
lee@dev01:~$ wget -O - -q icanhazip.com
108.216.31.152

lee@dev01:~$  wget -O - icanhazip.com
--2013-08-16 21:27:03--  http://icanhazip.com/
Resolving icanhazip.com (icanhazip.com)... 162.209.15.246, 162.209.14.238, 2001:4801:7820:75:c69b:800f:ff10:b267, ...
Connecting to icanhazip.com (icanhazip.com)|162.209.15.246|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 15 [text/plain]
Saving to: `STDOUT'

 0% [                                       ] 0           --.-K/s              108.216.31.152
100%[======================================>] 15          --.-K/s   in 0s     

2013-08-16 21:27:03 (2.54 MB/s) - written to stdout [15/15]

lee@dev01:~$

« Reply #9 on: August 17, 2013, 04:30:29 »
Fred Grayson *****
Posts: 994

I am at a complete loss as to what the OP really wants to do at this point and I surrender.

--
Google is your friend and Bob's your uncle.
« Reply #10 on: September 04, 2013, 09:30:38 »
tecuma *
Posts: 5

@lee
thanks again. i was mistaken.

here again the situation and what i am looking for.

the public ip address of the pppoe interface from my monowall is changing e.g. by action from my dsl provider. in the past i had used dyn dns service and the proper config in my monowall to
update a dns entry for my domain. this is not usable for me anymore.

i have the possibility to use a dynamic dns mechanism of my domain provider. i have
a script where i can update the dns information for my domain with the actuall public ip
address from the monowall.

to do that update i am looking for a way to determine the actual public ip address of the pppoe interface from my monowall.

the suggested way "wget -O - -q bike.os-plus.de" is not working because when the ip address on the pppoe interface has changed it is not accessible anymore from the outside. so i am looking for a way to do this from the internal lan or from the dmz.

« Reply #11 on: September 04, 2013, 15:44:42 »
Fred Grayson *****
Posts: 994

Have you or have you not tired this as previously suggested?

wget -O - -q icanhazip.com

--
Google is your friend and Bob's your uncle.
« Reply #12 on: September 04, 2013, 17:06:11 »
Lee Sharp *****
Posts: 517

We totally understand exactly what you are trying to do and have repeatedly told you exactly how to do it.  You continue to replace a website that tells you what your IP is "icanhazip.com" with your own domain "bike.os-plus.de" and amazingly, it does not work.

Click on this link. (Do not change anything)
http://icanhazip.com/

See?
« Reply #13 on: September 06, 2013, 08:48:02 »
tecuma *
Posts: 5

hi lee,

argggggh yes  Cheesy now i understand.

sorry for taking a long time to understand fred and your infos. in german we call this "to be slow on the uptake".
one more sign that i am ready for holiday  Grin

many thanks to fred and you for your patience.

best regards

--christian
« Reply #14 on: September 06, 2013, 15:19:15 »
Fred Grayson *****
Posts: 994

You're welcome. And "slow on the uptake" isn't German, it's universal Smiley

--
Google is your friend and Bob's your uncle.
 
Pages: [1] 2
 
 
Powered by SMF 1.1.20 | SMF © 2013, Simple Machines