Querying The Hub for the external IP address withi...

As a programming challenge I'm trying to get the dynamic, external IP address of my broadband connection.
route -n -> returns routing information including the 192.168.1.254 gateway
nslookup "gateway" returns:
server: 192.168.1.254
address: 192.168.1.254#53
254.1.168.192.in-addr.arpa name BTHomehub.home.
254.1.168.192.in-addr.arpa name btbroadband.home.
254.1.168.192.in-addr.arpa name api.home.
using nslookup api.home (or any of the others) returns:
server: 192.168.1.254
address: 192.168.1.254#53
I want the external address not the internal. Can anyone help? I don't want to just use an ip finder website to get the address.
Thank You,
JvH

Thx for your help. Yes, I can login (via web page) and find the hubs external IP address but wanted to do it from within a script and wondered if it was possible without having to go down that road (login credentials, accessing right page, parsing the output).
route -n and looking for "G" under flags returns the gateway(s) and this gives me 192.168.1.254 which is the IP of the homehub, not my machine, so I'm querying the right device.
The annoying thing is; this used to work. I was running under Ubuntu 10, upgrading to 12 and it doesn't anymore. U12 has dnsmasq server  which provides local DNS caching. I thought maybe this was the problem (it was handling the query from within the network and not asking the hub for the info) so I switched it off.
I'm going to try and create a USB boot drive with Ubuntu 10 on it (if I can) and see if the script still works from within that.
Finally, I'm not an expert and am happy for any useful criticism and advice. Tnx guys

Similar Messages

  • Unable to make a connection with the external ip address

    I made a simple chat program in order to test the networking. I was able to make local connections using the internal ip addresses, bu when I try the external ip address, the connextion fails.
    Here is my ServerSocket in the MessengerServer class : ServerSocket server = new ServerSocket(1234);
    And here is the code that worked in the local network in the MessengerClient class: s = new Socket(InetAddress.getByName("192.168.1.4"), 1234);
    I also tried that code, using both the external and internal addresses : s = new Socket(InetAddress.getByName("71.178.183.40"), 1234, InetAddress.getByName("192.168.1.4"), 1234);
    Can anyone help me?

    francois203 wrote:
    Yes, it is the router address (WAN address),Then you have to set up your router for port forwarding, if you want a computer behind that router to receive incoming connection requests.
    but I suppose that to communicate with another computer not in the local network I need both the wan and the lan addresses.That depends on what precisely you mean by "communicate with." For instance, any website I visit "communicates with" my computer, and it knows nothing about my computer's private IP address.
    But I don't know how to construct a socket able to have both the router and the local address.Set up your router for port forwarding. The client doesn't have to know anything about what's behind the router. (Note that this assumes that a) your overall approach is sound and b) your ISP will allow incoming connections. I have no way of knowing if either of those is true.)

  • My icloud emails arent arriving most of the time and a few days ago my iphone and ipad started showing "Can't Get Mail" box. This has not happened before since I set up the iclud email address with the purchase of my ipad about a month ago.

    My icloud emails arent arriving most of the time and a few days ago my iphone and ipad started showing "Can't Get Mail" box. This has not happened before since I set up the iclud email address with the purchase of my ipad about a month ago.

    That's one of the weird things.. it recognizes it maybe 10% of the time. And usually, only after I do the two-button reset. Problem is.. since it won't charge above 2%, anytime I try to do a restore or anything like that using iTunes, my device shuts off and I lose whatever progress I'd made.
    So, an update... after reading through a bunch of similar complaints (there are literally 1000's of them so there's NO WAY this isn't somehow ios7 related, thanks a lot APPLE ) I decided to try a restore in recovery mode. After 3 hours and several disconnections... I ended up having to just set it up as a new iPad, as the restore did nothing. Weirdly though... as I was doing the restore in recovery mode.. I noticed I'd gotten up to a 10% charge.. higher than it's been since September, so after setting it up as a new device, I turned it off and plugged it in using the wall charger. 2 hours later and I was up to 38%. Still not great, as my iPad, before ios7 could've fully charged twice in the amount of time it took for me to now get 28% more of a charge. And that's with a fully cleaned out device.. so that really ***** and I'm now more confused than ever.
    But I'm gonna leave it overnight charging and see what I come up with tomorrow. Sadly, when I paid $600 for it in February, I never expected to have to play "wait and see" with it...

  • How to specify in the ISE mac-address with its description?

    Hello :-)
    I want to implement ISE 1.2.
    We have a database of mac-addresses and their description (for example the phone with the Mac address, John).
    When connecting the phone John to a wifi network, WLC checks its mac-address in the database and allows access.
    How to specify in the ISE Mac address with its description?
    In the endpoint settings in ISE 1.2 there is no description field. We have ISE1.2.1.198, vWLC 8.0.100, AIR-LAP1131, MS AD (Win2003).
    How can I handle this situation? Any ideas?

    This link http://www.cisco.com/c/en/us/td/docs/security/ise/1-2/user_guide/ise_user_guide/ise_man_network_devices.html about managing network devices(router,switch), not endpoints(phone, notebook).

  • HT5114 can i have the same email address with different itunes accounts my kids are to young to have an email address but love apps

    can i have the same email address with different itunes accounts my kids are to young to have an email address but love apps

    Have a look here...
    http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l
    And Here  >  Sharing Apps
    http://macmost.com/sharing-ios-apps-with-family.html

  • HT5312 I am trying to reset my security questions, I cannot locate the option for a rescue email address with My Apple Id. When I click on the button to reset the security questions, it states it is sending an email to the primay email address, but it doe

    I am trying to reset the Security Questions as I have forgotten them, when I have logged into My Apple Id, and click on the button to reset the Security Questions, it states it is sending an email to the Primary Email address. I do not have the option to input a Rescue Email address, the only option I have is to input an Alternate Email address, which I have done so.
    Also when I have tried to book an appointment throuth Online Support, I have not successful, I have rung a telephone number provided by the Mac Store in Perth, Australia and the reply provided is that we are closed. I was given to understand that Apple provided 24/7 Support to their users.

    Hot N Spicy wrote:
    I am trying to reset the Security Questions as I have forgotten them,
    Forgotten Security Questions / Answers...
    See Here > Apple ID: Contacting Apple for help with Apple ID account security
              Ask to speak with the Account Security Team...
    Or Email Here  >  Apple  Support  iTunes Store  Contact
    More Info >  Apple ID: All about Apple ID security questions
    Note:
    You can only set up and/or change a Rescue Email Before you forget the questions/answers

  • How get the external ip address of proxy (or nat) server with AppServer

    Subject contains the basic question.
    I need get ip adres (not in local net, but external) of client!
    Wish with AppServer only. Becoze with java it less accurate.
    Or I was wrong?
    help me please!
    Edited by: user13325288 on 29.06.2010 16:06
    Edited by: user13325288 on 29.06.2010 16:07

    Thank you, MLBrown. I have configured webutil and it works. But I read that the function webutil_clientinfo.Get_IP_Address; return address on the LAN. Address of network card in my local network. But what if I need to get the ip address if I connect through multiple networks or via the Internet??
    I need to AppServer worked with an external ip address of the server, through which I connect to the AppServer
    Edited by: Ihavoker on 30.06.2010 9:55

  • Query the Local Computer Policy with PowerShell

    One of our applications requires some local computer policy settings for some services accounts and we wanted to be able to query these values with a Remote PowerShell window. 
    I was unable to find the registry keys that hold the Local Computer Policy and I also tried activating and importing the import-module grouppolicy but couldn’t figure out how to query the local policy. 
    Below are the values I am interested in seeing:  I also tried the posting here which was most like what I was looking for but no luck.
    SeAssignPrimaryTokenPrivilege(Replace a process-level token)
    SeImpersonatePrivilege (Impersonate a client after authentication)
    SeServiceLogonRight (Log on as a service)
    SeIncreaseQuotaPrivilege (Adjust memory quotas for a process)
    SeBatchLogonRight (logon as a batch job)
    https://social.technet.microsoft.com/Forums/scriptcenter/en-US/9fac4ebd-ab68-4ee9-8d5a-44413f08530e/wmi-query-for-user-rights-assignment-local-computer-policy?forum=ITCG
    Thanks,
    Chris
    Chris J.

    The local GPO is a bit tricky.  Administrative Templates go into a registry.pol file, but for the rest of the settings you see in the local GPO, they're just configured on the computer (generally in the registry somewhere.)  If you change, for
    example, the user rights assignments with ntrights.exe, you'll see those changes reflected in the local Group Policy object as well.  This different from domain GPOs, where there's an INF file that contains all the settings that aren't part of an administrative
    template registry.pol file.
    Regarding user rights assignments, there's no quick and easy way to get at this information that I'm aware of.  NTRights.exe makes it easy to change user rights assignments, but doesn't offer functionality to query the existing settings.  For that,
    you need to use the Win32 API function
    LsaEnumerateAccountsWithUserRight.  This can be done from PowerShell, but it involves some embedded C# code that uses P/Invoke... it's about the most complicated type of code you're likely to encounter in a PowerShell script.
    I tinkered around with this recently, and this code seems to work (though it's a little on the ugly side):
    # All of this C# code is used to call the Win32 API function we need, and deal with its output.
    $csharp = @'
    using System;
    using System.Runtime.InteropServices;
    using System.Security;
    using System.Security.Principal;
    using System.ComponentModel;
    namespace LsaSecurity
    using LSA_HANDLE = IntPtr;
    [StructLayout(LayoutKind.Sequential)]
    public struct LSA_OBJECT_ATTRIBUTES
    public int Length;
    public IntPtr RootDirectory;
    public IntPtr ObjectName;
    public int Attributes;
    public IntPtr SecurityDescriptor;
    public IntPtr SecurityQualityOfService;
    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
    public struct LSA_UNICODE_STRING
    public ushort Length;
    public ushort MaximumLength;
    [MarshalAs(UnmanagedType.LPWStr)]
    public string Buffer;
    [StructLayout(LayoutKind.Sequential)]
    public struct LSA_ENUMERATION_INFORMATION
    public IntPtr PSid;
    sealed public class Win32Sec
    [DllImport("advapi32", CharSet = CharSet.Unicode, SetLastError = true),
    SuppressUnmanagedCodeSecurityAttribute]
    public static extern uint LsaOpenPolicy(LSA_UNICODE_STRING[] SystemName,
    ref LSA_OBJECT_ATTRIBUTES ObjectAttributes,
    int AccessMask,
    out IntPtr PolicyHandle);
    [DllImport("advapi32", CharSet = CharSet.Unicode, SetLastError = true),
    SuppressUnmanagedCodeSecurityAttribute]
    public static extern uint LsaEnumerateAccountsWithUserRight(LSA_HANDLE PolicyHandle,
    LSA_UNICODE_STRING[] UserRights,
    out IntPtr EnumerationBuffer,
    out int CountReturned);
    [DllImport("advapi32")]
    public static extern int LsaNtStatusToWinError(int NTSTATUS);
    [DllImport("advapi32")]
    public static extern int LsaClose(IntPtr PolicyHandle);
    [DllImport("advapi32")]
    public static extern int LsaFreeMemory(IntPtr Buffer);
    public class LsaWrapper : IDisposable
    public enum Access : int
    POLICY_READ = 0x20006,
    POLICY_ALL_ACCESS = 0x00F0FFF,
    POLICY_EXECUTE = 0X20801,
    POLICY_WRITE = 0X207F8
    const uint STATUS_ACCESS_DENIED = 0xc0000022;
    const uint STATUS_INSUFFICIENT_RESOURCES = 0xc000009a;
    const uint STATUS_NO_MEMORY = 0xc0000017;
    const uint STATUS_NO_MORE_ENTRIES = 0xc000001A;
    IntPtr lsaHandle;
    public LsaWrapper()
    : this(null)
    // local system if systemName is null
    public LsaWrapper(string systemName)
    LSA_OBJECT_ATTRIBUTES lsaAttr;
    lsaAttr.RootDirectory = IntPtr.Zero;
    lsaAttr.ObjectName = IntPtr.Zero;
    lsaAttr.Attributes = 0;
    lsaAttr.SecurityDescriptor = IntPtr.Zero;
    lsaAttr.SecurityQualityOfService = IntPtr.Zero;
    lsaAttr.Length = Marshal.SizeOf(typeof(LSA_OBJECT_ATTRIBUTES));
    lsaHandle = IntPtr.Zero;
    LSA_UNICODE_STRING[] system = null;
    if (systemName != null)
    system = new LSA_UNICODE_STRING[1];
    system[0] = InitLsaString(systemName);
    uint ret = Win32Sec.LsaOpenPolicy(system, ref lsaAttr,
    (int)Access.POLICY_ALL_ACCESS,
    out lsaHandle);
    if (ret == 0) { return; }
    if (ret == STATUS_ACCESS_DENIED)
    throw new UnauthorizedAccessException();
    if ((ret == STATUS_INSUFFICIENT_RESOURCES) || (ret == STATUS_NO_MEMORY))
    throw new OutOfMemoryException();
    throw new Win32Exception(Win32Sec.LsaNtStatusToWinError((int)ret));
    public SecurityIdentifier[] ReadPrivilege(string privilege)
    LSA_UNICODE_STRING[] privileges = new LSA_UNICODE_STRING[1];
    privileges[0] = InitLsaString(privilege);
    IntPtr buffer;
    int count = 0;
    uint ret = Win32Sec.LsaEnumerateAccountsWithUserRight(lsaHandle, privileges, out buffer, out count);
    if (ret == 0)
    SecurityIdentifier[] sids = new SecurityIdentifier[count];
    for (int i = 0, elemOffs = (int)buffer; i < count; i++)
    LSA_ENUMERATION_INFORMATION lsaInfo = (LSA_ENUMERATION_INFORMATION)Marshal.PtrToStructure(
    (IntPtr)elemOffs, typeof(LSA_ENUMERATION_INFORMATION));
    sids[i] = new SecurityIdentifier(lsaInfo.PSid);
    elemOffs += Marshal.SizeOf(typeof(LSA_ENUMERATION_INFORMATION));
    return sids;
    if (ret == STATUS_ACCESS_DENIED)
    throw new UnauthorizedAccessException();
    if ((ret == STATUS_INSUFFICIENT_RESOURCES) || (ret == STATUS_NO_MEMORY))
    throw new OutOfMemoryException();
    throw new Win32Exception(Win32Sec.LsaNtStatusToWinError((int)ret));
    public void Dispose()
    if (lsaHandle != IntPtr.Zero)
    Win32Sec.LsaClose(lsaHandle);
    lsaHandle = IntPtr.Zero;
    GC.SuppressFinalize(this);
    ~LsaWrapper()
    Dispose();
    public static LSA_UNICODE_STRING InitLsaString(string s)
    // Unicode strings max. 32KB
    if (s.Length > 0x7ffe)
    throw new ArgumentException("String too long");
    LSA_UNICODE_STRING lus = new LSA_UNICODE_STRING();
    lus.Buffer = s;
    lus.Length = (ushort)(s.Length * sizeof(char));
    lus.MaximumLength = (ushort)(lus.Length + sizeof(char));
    return lus;
    Add-Type -TypeDefinition $csharp
    # Here's the code that uses the C# classes we've added.
    $lsa = New-Object LsaSecurity.LsaWrapper
    $sids = $lsa.ReadPrivilege('SeInteractiveLogonRight')
    # ReadPrivilege() returns an array of [SecurityIdentifier] objects. We'll try to translate them into a more human-friendly
    # NTAccount object here (which will give us a Domain\User string), and output the value whether the translation succeeds or not.
    foreach ($sid in $sids)
    try
    $sid.Translate([System.Security.Principal.NTAccount]).Value
    catch
    $sid.Value
    You do need to know the proper string for each user right, and they are case sensitive. 
    Edit:  You can get a list of right / privilege names from
    https://support.microsoft.com/kb/315276?wa=wsignin1.0 ; they're the same values used for NTRights.exe.

  • Labview program to find the external hardwares connected with the PC

    Hai All,
    Do any one know how to find the external hardware details connected with our PC (like USB memory stick),  using labview program.

    That's assuming the user is running Windows.
    If you are under Windows you can access this information from the Registry. For example, for USB you can look at the key
    HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\USB.
    Message Edited by smercurio_fc on 04-30-2008 10:39 AM

  • HT4628 Limit on the # of IP Addresses with Time Capsule?

    I seem to only be able to connect 6 devices to my wireless network at one time, and I often have to reset my modem and Time Capsule to get something to connect. My internet service provider said it's probably a limit to the # of IP addresses through the Time Capsule.  Is that true?  Any other advice?
    I have the 2TB Time Capsule with iMac, Macbook, iPhone, Xoom tablet, and printer that I regularly connect to it.
    Thanks for your help!

    Please review what we said previously.......
    Assuming that the Time Capsule is configured as your router, the Time Capsule will provide up to 200 IP addresses unless you have changed the settings. You can adjust it to provide up to 250 if you need more than 200.
    If the Time Capsule is in Bridge Mode to work with your modem/router, then it is up to your modem/router to issue IP addresses.
    Your Time Capsule is not configured to act as the router for your network since you told us above that......
    Airport Utility is set as "Router Mode: Off(Bridge Mode)".
    Configure the Time Capsule Router Mode = DHCP and NAT if you want it to act as the router for your network.....not as a bridge.

  • Apple Script For Opening External EML File With Apple Mail

    Hi folks,
    

 I am working with Apple Script for implementing numerous function related to Mail App.
    

I am using the following Apple Script lines for opening the mails which are in Mail app for each modes.
    

View Mode : open theMsg

    Reply View Mode : reply theMsg opening window yes

    Reply All Mode : reply theMsg opening window yes reply to all yes

    Forward Mode : forward theMsg opening window yes



    I want to know how we can open external eml file in different view modes (View, Reply, Reply All and Forward) using Apple Script or Apple Event programmatically with a similar mechanism available through script in Mail App.

    
Thanks in advance.

Regards
    
Nisar

    I'm not sure what you're doing here, but this isn't anything I recognize as compilable applescript. what is this 'mode' thing you're talking about.
    at any rate, if you have a loose emlx file sitting around somewhere you can simply open it in mail (use the 'open' command and the file specification for the emlx file) and work with it appropriately. if you're talking about an actual eml file (e.g. from Outlook Express) you'd have to GUI script Mail's 'import mailbox' command (the applescript handler for importing mail only works with Mail.app mailboxes)

  • Error while querying the external tables in 9i

    i am working on a project on Oracle 9iR2 on Linux AS 3.0, i am in urgent need to port my data in text files for using in the DB
    I have created an external table using the following script. While executing a query it gives the following error. Pls Hlp
    create table ap_info_ex
         (ser_no number(7),
         no_of_sps number(1),
         hpy_liq_mm number(2),
         rmp_rnk_cd number(1),
         ir number(3),
         dps_flg varchar2(1))
    organization external
    (type oracle_loader
         default directory aps_jul
         access parameters (records delimited by newline
                        fields terminated by ","
                        (sno char,
                        no_sps char,
                        hpy_mm char,
                        rmp_rnk char,
                        ir char,
                        dpsflg char))
    location ('info.txt'));
    Table has been created successfully
    but when i execute a query say
    select * from ap_info_ex;
    THIS IS THE ERROR MESSAGE I AM GETTING
    ERROR at line 1:
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-04063: unable to open log file AP_INFO_EX_6151.log
    OS error Permission denied
    ORA-06512: at "SYS.ORACLE_LOADER", line 14
    ORA-06512: at line 1
    hope you would help me. i am greateful for that.

    Arun,
    Here are the things you could do.
    1. You may want to specify a logfile in your access parameters using the command 'logfile'.
    For example,
    logfile 'info.log'. You could create the file in advance and provide appropriate permissions to the operating system user(In unix, I use the commands 'touch' and 'chmod').
    2. You could specify the command
    'NOLOGFILE' in your access parameters.
    3. Provide permissions for the user to create files in the folder associated with the directory object 'aps_jul'.

  • The external hard drive with my iTunes library on it died, but I have it backed up on another drive. What's the best way to make iTunes switch to the new drive for reference?

    I've been through similar problems before and used the .xml file to restore the library, but is a better way of just changing the drive pathways in iTunes so it doesn't have to rebuild everything from scratch? I'm using a PC with Windows Vista.

    Change the drive letter of the backup drive so it matches the one that died. If necessary move/rename the backup folder so that it matches the old path of the media folder.
    tt2

  • UCxn - Query to search for a specific email address

    I've got an odd issue...I've got a user in our London office on a completely separate voicemail system (Unity 5) that is receiving SMTP notifications from the voicemail system (UCxn 9.1.2) here in the US.  I'm wondering if there's a query I can run against the database to search for her email address and see if it is in the US cluster someplace?  I'm not a DB guy at all, so when it comes to SQL, I'm lost.
    Appreciate any help someone can provide
    SJ           

    You can try the user data dump from the ciscounitytools online and then just search the output and see if it's in there.
    HTH
    java
    if this helps, please rate
    www.cisco.com/go/pdihelpdesk

  • Twin unpowered USB hub for connecting external HDD and iphone

    I have a MBA and a powered Kensington 7 port USB hub which works great when I am either at home/in the office.
    Is there an unpowered twin port USB hub that would allow me to connect both my WD myv passport 320gb external HDD and 3g iphone to my MBA when i am truly on the move?
    thanks in advance
    Message was edited by: NRG1970

    Because those are both drawing power from the macbook air, it might be questionable, but any should do, but I haven't seen any 2 port hubs, only four port ones, and I tend to like Logiix, as their support is good and their products are good also, and they are fairly low profile.

Maybe you are looking for

  • How can I align multiple titles in Premiere Pro?

    We are working on a video (obviously) and we have a bullet list that we'd like to come up as the speaker is naming off specific items. So far we have created a separate title for each bullet point, so that we can control when the bullets fade in. The

  • I cannot upgrade itunes in my MacBook air, why is that?

    Can sombody tell me, why I can not upgrade itunes?

  • Split view pausing when updating code

    HI, I love split view, can live without it, but in the latest version 5 and up, it seems when i change the code in code view side, the wysiwyg side pauses for a few seconds to update what i've changed, almost flashes asif reloading, maybe it is, but

  • Why doesn't Media Encoder like changes to preset settings?

    (CS4) Adobe Media Encoder crashes whenever I set the frame rate or screen size in Premiere to be different to the supplied presets. For example, when I select FLV and change the frame rate to 24 instead of 29.97, the CrashReporterApp pops up. Even if

  • Problems after new software install - 5800

    Yesterday I installed software v 40.0.005 to my 5800 Music Express and I have found a few issues that I cannot seem to resolve: 1 - The appearance of the stop/snooze buttons for the Alarm Clock changed, but the stop button no longer works.  Although