Determine IP address assigned to MAC

Determine IP address assigned to MAC

Post by Ian Pilche » Sat, 14 Jan 2006 08:57:29



When I am working in my home office, I like to use rdesktop (on Linux)
to connect to my Windows laptop.  This gives me the big screen, full-
sized keyboard, etc., without springing for a docking station.

The problem (inconvenience) I have is that my Internet gateway (I refuse
to call them routers) can't be configured to assign a consistent IP
address to a particular MAC address.  If, however, I could find a way to
scan my network for a particular MAC address and determine its IP
address, I could easily whip us a script to connect to the laptop
without manually determining its current IP address.

Anyone know of a way to do this?

Thanks!

--
========================================================================

========================================================================

 
 
 

Determine IP address assigned to MAC

Post by Paul Colquhou » Sat, 14 Jan 2006 09:39:06


| When I am working in my home office, I like to use rdesktop (on Linux)
| to connect to my Windows laptop.  This gives me the big screen, full-
| sized keyboard, etc., without springing for a docking station.
|
| The problem (inconvenience) I have is that my Internet gateway (I refuse
| to call them routers) can't be configured to assign a consistent IP
| address to a particular MAC address.  If, however, I could find a way to
| scan my network for a particular MAC address and determine its IP
| address, I could easily whip us a script to connect to the laptop
| without manually determining its current IP address.
|
| Anyone know of a way to do this?
|
| Thanks!

The 'arp' cpmmand can show you the MAC to IP address mapping, as long as
the machines have swapped packets. Sending a 'ping' the the local broadcast
address may be an easy way to get a response from the laptop before
running 'arp'.

--
Reverend Paul Colquhoun, ULC.    http://andor.dropbear.id.au/~paulcol
     Asking for technical help in newsgroups?  Read this first:
        http://catb.org/~esr/faqs/smart-questions.html#intro

 
 
 

Determine IP address assigned to MAC

Post by Allen McIntos » Sat, 14 Jan 2006 10:46:51


Quote:> | The problem (inconvenience) I have is that my Internet gateway (I refuse
> | to call them routers) can't be configured to assign a consistent IP
> | address to a particular MAC address.
> | Anyone know of a way to do this?
> The 'arp' cpmmand can show you the MAC to IP address mapping,

You could always turn off DHCP on the gateway and run it on your Linux box.
 
 
 

Determine IP address assigned to MAC

Post by Unru » Sat, 14 Jan 2006 11:11:58


Quote:>> | The problem (inconvenience) I have is that my Internet gateway (I refuse
>> | to call them routers) can't be configured to assign a consistent IP
>> | address to a particular MAC address.
>> | Anyone know of a way to do this?

Buy a router or Internet gateway or whatever you want to call it that does
allow assigning a consistent IP to a particular mac address.
Or try just turning off dhcp entirely and give your machine a static ip
which is not assigned by dhcp.
I assume these answers were all obvious to you before you asked so there
must be some other hidden question which you are not asking.
And why do you not want to call them routers when that is what they are.
They have nothing to do with the internet. They simply tell packets where
to go. They route them.
 
 
 

Determine IP address assigned to MAC

Post by David Schwart » Sat, 14 Jan 2006 18:30:55



Quote:> The problem (inconvenience) I have is that my Internet gateway (I refuse
> to call them routers) can't be configured to assign a consistent IP
> address to a particular MAC address.  If, however, I could find a way to
> scan my network for a particular MAC address and determine its IP
> address, I could easily whip us a script to connect to the laptop
> without manually determining its current IP address.

    Don't use DHCP for machines that you need to connect to. Configure them
statically, don't make the gateway assign the IP.

    DS

 
 
 

Determine IP address assigned to MAC

Post by Secure Buddh » Sat, 14 Jan 2006 19:01:44


This ia actually the job of the reverse address resolution
protocol(rarp). Google for it to find out more information if you so
desire. However, this rarp protocol will not apply to your scenario
becuase there are no static address assignments.

To successfully acquire the information that you need for a given node
you will need to send a broadcast to the subnet that you are attempting
to access using the "ping" utility. This will then elicit a response
from all the nodes located on the desired node's subnet. More
importantly, the node that you are trying to access.

Now that you have received a echo_reply from the subnet nodes, your arp
cache will contain all the MAC address to IP address resolutions. You
can then "grep" the cache for the needed MAC address to IP address
pairing.

for instance:

PING <subnet broadcast>(<subnet broadcast>) 56(84) bytes of data.
64 bytes from <subnet broadcast>: icmp_seq=1 ttl=64 time=0.130 ms
64 bytes from <subnet broadcast>: icmp_seq=2 ttl=64 time=0.078 ms
64 bytes from <subnet broadcast>: icmp_seq=3 ttl=64 time=0.087 ms
64 bytes from <subnet broadcast>: icmp_seq=4 ttl=64 time=0.109 ms
64 bytes from <subnet broadcast>: icmp_seq=5 ttl=64 time=0.097 ms
64 bytes from <subnet broadcast>: icmp_seq=6 ttl=64 time=0.086 ms


? (<node1>) at 00:0A:41:7E:B8:A0 [ether] on eth0
? (<node2>) at 00:0A:41:7E:B8:A1 [ether] on eth0
? (<node3>) at 00:0A:41:7E:B8:A2 [ether] on eth0

Now this whole process is dependent on a few things:

1. You are capable of sending broadcasts to the internal subnet. It may
be rejected from a external router or firewall through ingress rules.

2. Host resident firewalls may deny echo_requests.

3. Egress filtering may be in place to deny information leakage from
the internal network/subnets.

Hopefully, that'll help. Good luck.
Thomas

 
 
 

Determine IP address assigned to MAC

Post by Ian Pilche » Sun, 15 Jan 2006 00:46:13



>     Don't use DHCP for machines that you need to connect to. Configure them
> statically, don't make the gateway assign the IP.

That approach would be fine if the laptop never left my house.  I often
travel, however, and need to plug in to various networks.  Reconfiguring
the Ethernet interface on the laptop between DHCP and a static address
would probably be more of a pain than having to locally run ipconfig.

--
========================================================================

========================================================================

 
 
 

Determine IP address assigned to MAC

Post by Ian Pilche » Sun, 15 Jan 2006 00:48:28



> You could always turn off DHCP on the gateway and run it on your Linux box.

I've had things set up this way on occassion.  Unfortunately, I do
occassionally need to reboot this box into Windows or do some sort of
maintenance on it, etc.  Of course, if I'm having a problem with the
Linux box, that's when I most need to be able to connect with my laptop,
so I don't like introducing that dependency.

--
========================================================================

========================================================================

 
 
 

Determine IP address assigned to MAC

Post by Rober » Sun, 15 Jan 2006 10:49:29



> I've had things set up this way on occassion.  Unfortunately, I do
> occassionally need to reboot this box into Windows or do some sort of
> maintenance on it, etc.  Of course, if I'm having a problem with the
> Linux box, that's when I most need to be able to connect with my laptop,
> so I don't like introducing that dependency.

Have you thought about locking down and ip address to a MAC Address?

host apex {
   option host-name "apex.example.com";
   hardware ethernet 00:A0:78:8E:9E:AA;
   fixed-address 192.168.1.4;

Quote:}

--

Regards
Robert

Smile... it increases your face value!

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----

 
 
 

Determine IP address assigned to MAC

Post by Snowba » Sun, 15 Jan 2006 11:51:43




>>     Don't use DHCP for machines that you need to connect to. Configure them
>> statically, don't make the gateway assign the IP.

> That approach would be fine if the laptop never left my house.  I often
> travel, however, and need to plug in to various networks.  Reconfiguring
> the Ethernet interface on the laptop between DHCP and a static address
> would probably be more of a pain than having to locally run ipconfig.

It looks like you could toggle an interface between DHCP and static IP
pretty easily using ipconfig.pl - perhaps from a couple of DOS on/off
scripts?
http://www.itefix.no/phpws/index.php?module=pagemaster&PAGE_user_op=v...
 
 
 

Determine IP address assigned to MAC

Post by Moe Tr » Mon, 16 Jan 2006 07:35:55


On Fri, 13 Jan 2006, in the Usenet newsgroup comp.os.linux.networking, in


>>     Don't use DHCP for machines that you need to connect to. Configure them
>> statically, don't make the gateway assign the IP.

>That approach would be fine if the laptop never left my house.  I often
>travel, however, and need to plug in to various networks.  Reconfiguring
>the Ethernet interface on the laptop between DHCP and a static address
>would probably be more of a pain than having to locally run ipconfig

The way we've always handled that problem is using different runlevels
to select DHCP verses Static.  Minor problem is that most modern
distributions obfuscate the hell out of the boot scripts. but it's not
an insurmountable problem.  For example, look at your /etc/inittab to see
what levels are already in use. Red Hat and clones generally have runlevel
4 virtually identical to runlevel 3 (compare the links in the runlevel
directories). We simply change the "S??network link to point to a different
script that brings the network up differently.   Once that is done, the
user can select the run level at boot time (LILO makes this incredibly
easy - merely pass "linux 3" or "linux 4" as the selection at the LILO
boot prompt. GRUB can do this as well, but it takes a bit more effort on
the user's part.)

Another technique is to modify the network boot script so that it asks
the user which way to go.  On a laptop which won't likely be doing unattended
reboots, this is painless.

At least one other method is "profiles" - set up by some distributions. This
allows you to tailor the setup at boot time in a similar manner.

        Old guy

 
 
 

Determine IP address assigned to MAC

Post by Moe Tr » Mon, 16 Jan 2006 07:36:54


On 13 Jan 2006, in the Usenet newsgroup comp.os.linux.networking, in article


>This ia actually the job of the reverse address resolution
>protocol(rarp). Google for it to find out more information if you so
>desire.

  0903 Reverse Address Resolution Protocol. R. Finlayson, T. Mann, J.C.
       Mogul, M. Theimer. Jun-01-1984. (Format: TXT=9345 bytes) (Also
       STD0038) (Status: STANDARD)

This protocol is handled by a 'rarpd' server that may or may not be part
of the distribution.  Red Hat/Fedora has been supplying rarpd-ss981107 for
several years.  RFC0903 is widely available on many web server world wide.

Quote:>However, this rarp protocol will not apply to your scenario becuase there
>are no static address assignments.

  1931 Dynamic RARP Extensions for Automatic Network Address
       Acquisition. D. Brownell. April 1996. (Format: TXT=27544 bytes)
       (Status: INFORMATIONAL)

Likewise, depending on a user supplied string (here, the MAC address which
can easily be changed) isn't the greatest security feature. RFC1931 should
also be available at the same place you find RFC0903.

Quote:>Now this whole process is dependent on a few things:

>1. You are capable of sending broadcasts to the internal subnet. It may
>be rejected from a external router or firewall through ingress rules.

1a. The remote systems may not respond to a 'broadcast' ping. Some O/S
do this to avoid DOS or broadcast storms.

Quote:>2. Host resident firewalls may deny echo_requests.

However, if the individual address is pinged, the remote hosts will almost
always respond to the ARP request that precedes the ICMP echo.  The
exception would be if the remote is filtering on MAC addresses in a modified
network stack. (ARP is normally at a "lower" level in the stack than the
firewall code.)  Thus, the "remote" hardware address will almost always be
available in the ARP cache.

        Old guy

 
 
 

Determine IP address assigned to MAC

Post by Maurizio Loret » Mon, 16 Jan 2006 16:24:33



> That approach would be fine if the laptop never left my house.  I often
> travel, however, and need to plug in to various networks.  Reconfiguring
> the Ethernet interface on the laptop between DHCP and a static address
> would probably be more of a pain than having to locally run ipconfig.

Not a too big pain, however; as an example, Fedora has "network
profiles", used to store different network configurations; but I
didn't like at all their approach.

I have a short script called "configure" in /root, that I use to
change the network configuration between sites; once you have tuned a
Linux system for a given network, the relevant parameters are stored
in only a few files that I copy with suitable names to /root/ too.

To switch configuration, I 1) boot in single user mode, 2) execute
root/configure, and 3) reboot.  Here is the file:

,-----[ /root/configure ]-----
| #! /bin/bash
|
| SITES="brookdale casa cern fermilab firenze fisica labo"
|
| select SITE in ${SITES}
|   do if [ -n "${SITE}" ]
|       then echo "You picked '${SITE}' ..."
|       cp -fv /root/network.${SITE} /etc/sysconfig/network
|       cp -fv /root/eth0.${SITE}    /etc/sysconfig/network-scripts/ifcfg-eth0
|       cp -fv /root/eth1.${SITE}    /etc/sysconfig/network-scripts/ifcfg-eth1
|       cp -fv /root/keys.${SITE}    /etc/sysconfig/network-scripts/keys-eth1
|       cp -fv /root/resolv.${SITE} /etc/resolv.conf
|       echo "... reconfiguration done"
|   else
|       echo "Wrong choice.  Exiting."
|   fi
|   break;
| done
|
| unset SITE SITES
`-----

--
Maurizio Loreti                         http://www.pd.infn.it/~loreti/mlo.html

 
 
 

Determine IP address assigned to MAC

Post by Unru » Tue, 17 Jan 2006 02:16:38




>> That approach would be fine if the laptop never left my house.  I often
>> travel, however, and need to plug in to various networks.  Reconfiguring
>> the Ethernet interface on the laptop between DHCP and a static address
>> would probably be more of a pain than having to locally run ipconfig.

That is of course up to you. However, I have a script (well two of them,
one for root, and a wrapper which can be set suid) which changes the
default setup in ifcfg-eth0

Ie, I have a bunch of file
eth0-home
eth0-dhcp
eth0-work
....
and I call the script with
network home
network dhcp
or whatever.
The script does
ln -sf /etc/sysconfig/network-script/eth-$1 /etc/sysconfig/network-script/ifcfg-eth0
and then runs ifup eth0

Ie, this is very similar to the suggestion below, but I do it on the fly--
ie no single user required.
You could also probably use a suid perl script to do it as well, but I use
a shell script wrapper C program to wrap around the script.

>Not a too big pain, however; as an example, Fedora has "network
>profiles", used to store different network configurations; but I
>didn't like at all their approach.
>I have a short script called "configure" in /root, that I use to
>change the network configuration between sites; once you have tuned a
>Linux system for a given network, the relevant parameters are stored
>in only a few files that I copy with suitable names to /root/ too.
>To switch configuration, I 1) boot in single user mode, 2) execute
>root/configure, and 3) reboot.  Here is the file:
>,-----[ /root/configure ]-----
>| #! /bin/bash
>|
>| SITES="brookdale casa cern fermilab firenze fisica labo"
>|
>| select SITE in ${SITES}
>|   do if [ -n "${SITE}" ]
>|       then echo "You picked '${SITE}' ..."
>|       cp -fv /root/network.${SITE} /etc/sysconfig/network
>|       cp -fv /root/eth0.${SITE}    /etc/sysconfig/network-scripts/ifcfg-eth0
>|       cp -fv /root/eth1.${SITE}    /etc/sysconfig/network-scripts/ifcfg-eth1
>|       cp -fv /root/keys.${SITE}    /etc/sysconfig/network-scripts/keys-eth1
>|       cp -fv /root/resolv.${SITE} /etc/resolv.conf
>|       echo "... reconfiguration done"
>|   else
>|       echo "Wrong choice.  Exiting."
>|   fi
>|   break;
>| done
>|
>| unset SITE SITES
>`-----
>--
>Maurizio Loreti                         http://www.pd.infn.it/~loreti/mlo.html


 
 
 

Determine IP address assigned to MAC

Post by Maurizio Loret » Tue, 17 Jan 2006 16:20:19



> ...
> and then runs ifup eth0

> Ie, this is very similar to the suggestion below, but I do it on the fly--
> ie no single user required.

I have noticed that, if the HOSTNAME is changed, a simple "ifup eth0"
is not enough; I have to reboot.  E.g. my laptop MAC address is mapped
to mlodell.pd.infn.it in a place, lapcdf.fnal.gov in another one, and
so on...  Of course, if you have to reboot, there's no difference in
booting in single user mode or going to init 3 or 5; working in single
user mode is just faster.

--
Maurizio Loreti                         http://www.pd.infn.it/~loreti/mlo.html

 
 
 

1. Determining IP address from MAC address

Hi,

   I have a MAC address for a given system and need to be able to
programatically determine it's IP address for use with a TCP-IP based
application.  Clearly, the ip address might be in the arp table for ced
host but the problem occurs when it is not.  The options as I see it
are

1) broadcast ping (programmatically horrible as every host on the
network will respond)
2) inverse arp lookup

My questions are:

1) Does linux support the inverse arp protocol, as various resources
I've seen indicate it is primarily used for frame relay?  If so could
you direct me to the appropriate resources as I've been unable to
determine if linux supports this.

2) What other methods could I use to obtain this information?

Regards
Ian Neal

2. a C programming question

3. How to determine a mac address on a remote computer with only ip address known?

4. problem with colorado t1000 tape drive

5. Utility desired for determining ISP-assigned IP address from remote location/over the Internet

6. Number of End Users per Sys Admin

7. How do I determine Assigned IP address ?

8. %L/%l parameters ignored in X{USER}FILESEARCHPATH

9. determining dynamically assigned IP address on host

10. determining dynamically assigned IP address

11. Assigning IP Range via First Half of MAC ( hardware ) Address

12. Remotely determine IP given MAC address?

13. mounting via ssh, and determining IP from MAC address remotely