Geek Help - Finding An IP Address

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • crokett
    The Full Monte
    • Jan 2003
    • 10627
    • Mebane, NC, USA.
    • Ryobi BT3000

    #1

    Geek Help - Finding An IP Address

    So I want to schedule the sync from laptop to desktop. I have to run it from the desktop else the file permissions get mucked up. Therein lies the problem. If I am working remotely via VPN, the desktop can't resolve the hostname on the laptop to an IP address to start the sync. The VPN connection is pretty well firewalled I guess. The laptop can resolve the desktop, so I think I have to come up with a way, probably perl script, for the laptop to figure out it's IP address, then tell the desktop what it is, most likely via rsync.

    So, is there an easier way to do this? I thought maybe an ARP lookup, but the VPN adapter in Windows is virtual.
    David

    The chief cause of failure in this life is giving up what you want most for what you want at the moment.
  • BobSch
    Veteran Member
    • Aug 2004
    • 4385
    • Minneapolis, MN, USA.
    • BT3100

    #2
    I've never tried it across a VPN connection, but nslookup systemname will give you the IP.
    Bob

    Bad decisions make good stories.

    Comment

    • crokett
      The Full Monte
      • Jan 2003
      • 10627
      • Mebane, NC, USA.
      • Ryobi BT3000

      #3
      I tried nslookup and all the standard stuff from the Linux box but that doesn't work through the firewall. I did write a perl script for Windows to get the IP Address and dump it to a file. Then I transfer the file to Linux, and I will write a script there that reads the file and kicks off the sync bact to this IP address.

      Just in case anybody wants it:

      Code:
      #!perl.exe
      #count # of lines entered
      
      
        use Sys::HostIP; 
        
        my($outputfile)='c:\\rsynctest\\ipaddrtxt';
          my $interfaces = Sys::HostIP->interfaces;
      
        # $interfaces is a hash ref containg all pairs of interfaces/ip addresses
        # Sys::HostIP could find on your machine.
      
       printf("output file is: $outputfile\n");
       while( my ($k, $v) = each %$interfaces ) {
            #make sure we have the correct output  
            print "if: $k, ip: $v.\n";
              
            #now look for IP address starting with 9, we don't care about the rest
             if ($v =~ /9\./)
             {
           #now dump it to a file
             open (IPFILE, "> $outputfile");
              print IPFILE "$v\n";
             close (IPFILE);  
                print("IBM IP is: $v\n");
                last;
            }
          }
      David

      The chief cause of failure in this life is giving up what you want most for what you want at the moment.

      Comment

      • Rich P
        Established Member
        • Apr 2003
        • 390
        • Foresthill, CA, USA.
        • Powermatic 66 (1966 vintage)

        #4
        If your VPN is working via NAT on a modem/firewall, then one of the machines is not going to have any idea what IP appears at the far end.
        Don't ever ask a barber if you need a haircut.

        Comment

        • crokett
          The Full Monte
          • Jan 2003
          • 10627
          • Mebane, NC, USA.
          • Ryobi BT3000

          #5
          Originally posted by Rich P
          If your VPN is working via NAT on a modem/firewall, then one of the machines is not going to have any idea what IP appears at the far end.
          My guess is that is what is happening. However once I know the IP of the machine that is VPNed in, the other machine can get to it.
          David

          The chief cause of failure in this life is giving up what you want most for what you want at the moment.

          Comment

          • LinuxRandal
            Veteran Member
            • Feb 2005
            • 4890
            • Independence, MO, USA.
            • bt3100

            #6
            I still can't think of the terms right now (long couple of days), but there is a DNS, service, that people were using, when they were hosting a webpage on a home connection (DSL, cable modem). It would send the current ip up, so it could be linked.

            I am just too tired and brain fried today (glad I am not operating power tools).
            She couldn't tell the difference between the escape pod, and the bathroom. We had to go back for her.........................Twice.

            Comment

            • Rich P
              Established Member
              • Apr 2003
              • 390
              • Foresthill, CA, USA.
              • Powermatic 66 (1966 vintage)

              #7
              You can also make an entry in the local "hosts" file for name resolution, at least you can in the MS world. I'm sure linux can do that as well.
              Don't ever ask a barber if you need a haircut.

              Comment

              • jcjrsmith
                Established Member
                • Dec 2002
                • 354
                • Mechanicsburg, PA, USA.
                • Ryobi BT3000

                #8
                Originally posted by LinuxRandal
                I still can't think of the terms right now (long couple of days), but there is a DNS, service, that people were using, when they were hosting a webpage on a home connection (DSL, cable modem). It would send the current ip up, so it could be linked.

                I am just too tired and brain fried today (glad I am not operating power tools).
                www.dyndns.org
                Jerry in PA
                ...Can't sleep, clown will eat me...
                http://home.comcast.net/~jcjrsmith2

                Comment

                • crokett
                  The Full Monte
                  • Jan 2003
                  • 10627
                  • Mebane, NC, USA.
                  • Ryobi BT3000

                  #9
                  dyndns is against company rules. I thought of that too. I have made progress though. I can get the IP address from windows, dump it to a file and get it up to Linux. I can even have Linux read the file. Now I am stuck on building the sync command. There is something being read out of the file that perl doesn't like.
                  David

                  The chief cause of failure in this life is giving up what you want most for what you want at the moment.

                  Comment

                  • dielectric
                    Forum Newbie
                    • Nov 2008
                    • 25
                    • Kenosha, WI
                    • BT3000

                    #10
                    I've always found it easier to set up pseudo-static IPs for my home network. I still have DHCP assign it, but they're assigned by MAC address. "Foreign" machines that attach to the network get assigned a specific subset of addresses, outside of the static range. My router is a WRT54G running DD-WRT, and I went through the exercise of setting up DNSmasq which is easy and cool:
                    http://www.dd-wrt.com/wiki/index.php...as_DHCP_server

                    This way, you can do the unthinkable and hard-code IP addresses into your scripts, etc. Bwhahaha!

                    Comment

                    • Rich P
                      Established Member
                      • Apr 2003
                      • 390
                      • Foresthill, CA, USA.
                      • Powermatic 66 (1966 vintage)

                      #11
                      Have your perl script pipe the machine name and IP address to the "hosts" file (of course replacing any stale entry for the machine). That way you don't need to futz with IP addresses in any of your sync processes.
                      Don't ever ask a barber if you need a haircut.

                      Comment

                      • crokett
                        The Full Monte
                        • Jan 2003
                        • 10627
                        • Mebane, NC, USA.
                        • Ryobi BT3000

                        #12
                        Originally posted by Rich P
                        Have your perl script pipe the machine name and IP address to the "hosts" file (of course replacing any stale entry for the machine). That way you don't need to futz with IP addresses in any of your sync processes.
                        That is an idea I thought of, if I were running this on the machine that needs the information. Or if I were more clever there might be a way to run some commands remotely via ssh to do this and update the hosts file by passing the commands a variable. However I am not really a programmer and what I have works for now.
                        David

                        The chief cause of failure in this life is giving up what you want most for what you want at the moment.

                        Comment

                        Working...