On Dec 11, 2010, at 3:08 PM, Levan, Jerry wrote: > > On Dec 10, 2010, at 4:56 PM, Dan Shoop wrote: > >> ] >> How about you just define a real function you're trying to achieve: being >> able to access your dynamically assigned public IP address assigned to your >> NAT'ed network remotely. And you want to know about it and maybe if it >> changes. >> >> Over the years the InterWebs have developed a way to determine or announce >> an IP address, they called it DNS. Of course the problem for all those with >> an IP address that kept changing was to noticed that it changed and be able >> to switch the IP address to the new one when the dynamic address changed. So >> DynDNS - a free service - came about, along with tools/plugins/apps that >> allow for the whole notification of changes thingie to be dealt with. >> >> Have you considered why this won't work to resolve what may be your real >> problem here? >> >> In other words perhaps you're going about this in the wrong way? >> >> -d > > It turns out that it is not hard to get the Airport Extreme Base Station > external address: > > [mbp:]$ snmpwalk -Ov -OQ -c public router ipAdEntAddr > 76.177.12.46 > 127.0.0.1 > 127.0.0.2 > 169.254.162.44 > 192.168.1.1
Except that this isn't the proper answer to your question at all. Nor are you going to be able to reliably use this either. This isn't your WAN IP address at all, it's a list of all VNICs that the Airport currently has. > The smnpwalk command above grabs a part of the ipAddr table which lists info > on all > ip addresses assigned to the machine. As a "list" it is an unordered data structure and you can't simply say the first one will always be the WAN IP address. > The first (at least in this case ) is the external ip of the router. "in this example", but not all. > The second two addresses are a bit of mystery to me but they are certainly > not the external address This statement demonstrates a significant lack of understanding of basic IP fundamentals. The of the addresses you don't recognize (which is hard to believe) is that of localhost. 127.0.0.1 is an address all IP hosts possess. The second is similar in nature. They're both in the localhost CIDR block and loopback to the local host. > The fourth is a special configuration address, try whois 169.254.162.44 for > more info. Well you're not quite on track here either, its the local address. Honestly, it sounds like a bit of education on IP networking should be on order for you. > The last address is the internal lan address of the router. > The next part of the plan was to mail the results periodically to a public > account so one > could check the ip before turning on a VPN or connecting to an open port. Gee, you just keep making your trivial non-problem more and more complex. > I had hoped that I could use the local 'mail' command to send the results > somewhere, regrettably that > is becoming tricky... > > I have several mail accounts...An Exchange account at the University where I > retired from, my > isp RoadRunner, and my MobileMe account. So plenty of accounts from which you can send mail, provided you can send port 25 traffic and you can AUTH. > If I use the mail command to attempt to send a mail via the isp I get: > > ******************* > <[email protected]>: host smtp-server.roadrunner.com[75.180.132.33] said: > 554 > 5.1.8 - Domain of sender address [email protected] does not exist [R0107008] Right, because you're trying to use an invalid GTLD. There is no .skynet on the Internet. > (in reply to MAIL FROM command) > Reporting-MTA: dns; mbp.skynet > X-Postfix-Queue-ID: 54670A652E1 > X-Postfix-Sender: rfc822; [email protected] > Arrival-Date: Sat, 11 Dec 2010 13:24:07 -0500 (EST) > > Final-Recipient: rfc822; [email protected] > Action: failed > Status: 5.1.8 > Remote-MTA: dns; smtp-server.roadrunner.com > Diagnostic-Code: smtp; 554 5.1.8 - Domain of sender address [email protected] > does not exist [R0107008] > > From: [email protected] (Jerry Levan) > Date: December 11, 2010 1:24:07 PM EST > To: [email protected] > Subject: fromJerry > > > hello from mbp > > **************** > > skynet is the (local) domain of my lan. No it's not. The local domain of your LAN is .local. This isn't a FQDN. > > I get a similar error if I attempt to mail my gmail account with routing > though roadrunner. As I would expect. > Fortunately I *can* use my local smtp to send mail directly to my mobileme > address which > surprised the *heck* out of me. Not sure why it should, you AUTH. > So does anyone know how I can convince roadrunner to accept mail from my > machine using mail or sendmail? You need to stop pretending to be someone you're not and they you'll need to SMARTHOST to your ISP. Again, you are really making this problem hard for yourself. It took about half a second to google "what is my ip address" which yielded a page with my WAN IP address and simply viewing its source showed that they have a page for automated use: http://www.whatismyip.com/automation/n09230945.asp which using curl just returns the IP address and nothing more (not even a line break): $ curl http://www.whatismyip.com/automation/n09230945.asp 123.123.123.123Seuss:~ shoop$ So something like $ perl -e '$ip=`curl -s http://www.whatismyip.com/automation/n09230945.asp`; print "$ip\n";' 123.123.123.123 DOES provide the correct and proper answer. Your solution does not. Now if you'd only properly configure your DNS and postfix (it's not sendmail) you'd maybe be a bit farther in getting something working /properly/. On Dec 11, 2010, at 5:26 PM, Levan, Jerry wrote: > The last part of the puzzle was to mail the results off site... > > Earlier I noted that my ISP puked when it saw my local domain > as the envelope-from in the tramsaction. As well it. > After playing around with the sendmail command on the mac I found > the following would work... > > Create a text file, say message.txt and put a To:, From: and Subject: > header at the top of the file and then dump the results of the > above snmpwalk into the file. > > The following command seems to work for me... > > sendmail -t -f [email protected] < message.txt > > the -t command picks up the To: field in the message.txt file , the -f sets > the envelope-from field, > that's the critical step evidently many smtp servers reject domains that > cannot be resolved. Yes, this is all very well known, provided you have postfix (it's not sendmail) configured properly. > It appears to me that using plain old mail is like using > > sendmail -t < message.txt > > which defaulted to using my local domain as the envelope-from field > > Normally (I think ) the local smtp-server would be used but from times past > I have set up a redirection via the /etc/postfix/transport file that would > choose the roadrunner smtp-server rather than the local smtp server for > sending > mail to many external locations. ( that whole idea seems dead now...) I have no idea why you'd do this, it's not necessary and not recommended. Instead use a SMARTHOST for your postfix configuration. AUTH if necessary. > Just out of curiosity, am I the only person who wants to send a 'scripted > email' to > a location outside of the local network? It seems like that would be a handy > notification tool. No you're the only person doing it in such a silly way. This is all woolly thinking and you really need to understand what you're doing, and more importantly define the real problem you're not really solving. This is ridiculous what you're doing and your approach. What are you really trying to do? Most no one needs to have a mail message sent to them to tell them the address of their IP since any sane person would use a DNS name and not an IP address. Given dyndns solves this problem completely and for free and with next to no effort on your part I find it silly that you're going about it this way. -d ------------------------------------------------------------------------ Dan Shoop [email protected] GoogleVoice: 1-646-402-5293 aim: iWiring twitter: @colonelmode _______________________________________________ MacOSX-admin mailing list [email protected] http://www.omnigroup.com/mailman/listinfo/macosx-admin
