Finding the ip address and hardware (ethernet) address of client behind a gateway

Finding the ip address and hardware (ethernet) address of client behind a gateway

Post by Cheng Kwok Wing, Willi » Fri, 14 Jun 2002 11:11:02



Hi folks,

I've setup a gateway and the clients, which connect to the gateway,
can access the Internet without any problems.

          ------------------
          |                |
          |                |
          |   clients      |--------------- gateway -------- Internet
          |                |
          |                |
          ------------------

My question is how can I obtain the ip address and the corresponding
hardware adderss automatically and store it in a plain text file when
the gateway boots up????

Please help!!
Thanks in advance,

William

 
 
 

Finding the ip address and hardware (ethernet) address of client behind a gateway

Post by Yuan Li » Fri, 14 Jun 2002 12:13:53



Quote:> Hi folks,

> I've setup a gateway and the clients, which connect to the gateway,
> can access the Internet without any problems.

>           ------------------
>           |                |
>           |                |
>           |   clients      |--------------- gateway -------- Internet
>           |                |
>           |                |
>           ------------------

> My question is how can I obtain the ip address and the corresponding
> hardware adderss automatically and store it in a plain text file when
> the gateway boots up????

Getting MAC address sounds like an impossible job if you are looking
from the Internet side.  What kind of gateway are we talking about? (I
don't think it's a gateway in the networking sense.  A router?)  It may
or may not be possible to obtain IP address from the Internet side,
either.  Exactly from where do you need this information?

Yuan Liu

- Show quoted text -

Quote:> Please help!!
> Thanks in advance,

> William


 
 
 

Finding the ip address and hardware (ethernet) address of client behind a gateway

Post by James Knot » Sun, 16 Jun 2002 20:48:45



Quote:> Hi folks,

> I've setup a gateway and the clients, which connect to the gateway,
> can access the Internet without any problems.

>           ------------------
>           |                |
>           |                |
>           |   clients      |--------------- gateway -------- Internet
>           |                |
>           |                |
>           ------------------

> My question is how can I obtain the ip address and the corresponding
> hardware adderss automatically and store it in a plain text file when
> the gateway boots up????

You could try a broadcast ping, and then parse your arp cache, to get that
info.

--

All the facts above are true, except for the ones I made up.


james.knott.

 
 
 

Finding the ip address and hardware (ethernet) address of client behind a gateway

Post by James Knot » Sun, 16 Jun 2002 20:50:03




>> Hi folks,

>> I've setup a gateway and the clients, which connect to the gateway,
>> can access the Internet without any problems.

>>           ------------------
>>           |                |
>>           |                |
>>           |   clients      |--------------- gateway -------- Internet
>>           |                |
>>           |                |
>>           ------------------

>> My question is how can I obtain the ip address and the corresponding
>> hardware adderss automatically and store it in a plain text file when
>> the gateway boots up????

> Getting MAC address sounds like an impossible job if you are looking
> from the Internet side.  What kind of gateway are we talking about? (I
> don't think it's a gateway in the networking sense.  A router?)  It may
> or may not be possible to obtain IP address from the Internet side,
> either.  Exactly from where do you need this information?

It's certainly possible in a Linux or Unix based firewall, or any other
where you can do a broadcast ping and then read the arp cache.

--

All the facts above are true, except for the ones I made up.


james.knott.

 
 
 

Finding the ip address and hardware (ethernet) address of client behind a gateway

Post by wavema » Wed, 19 Jun 2002 17:22:37


Hi,

I assume that you want to find the gateway's IP at the gateway machine.  If
the gateway machine has an interface ppp0 goinf outside,
the script finding the IP of the outgoing interface of the gateway is:  (use
similar method, you may able to find the H/W Address.

#!/bin/bash
ifconfig ppp0 > ifconfig_ppp0.txt
if [ $? = 0 ]
then
 echo "Interface ppp0 found!"
 cat ifconfig_ppp0.txt | grep inet | cut -f2 -d: | cut -f1 -d " " >
Internet_IP
 echo "Internet Assigned IP is : "
 cat Internet_IP
else
 echo "IP address not found, check PPP connection!"
 rm ifconfig_ppp0.txt
 rm Internet_IP
 touch ifconfig_ppp0.txt
 touch Internet_IP
fi

Waveman





> >> Hi folks,

> >> I've setup a gateway and the clients, which connect to the gateway,
> >> can access the Internet without any problems.

> >>           ------------------
> >>           |                |
> >>           |                |
> >>           |   clients      |--------------- gateway -------- Internet
> >>           |                |
> >>           |                |
> >>           ------------------

> >> My question is how can I obtain the ip address and the corresponding
> >> hardware adderss automatically and store it in a plain text file when
> >> the gateway boots up????

> > Getting MAC address sounds like an impossible job if you are looking
> > from the Internet side.  What kind of gateway are we talking about? (I
> > don't think it's a gateway in the networking sense.  A router?)  It may
> > or may not be possible to obtain IP address from the Internet side,
> > either.  Exactly from where do you need this information?

> It's certainly possible in a Linux or Unix based firewall, or any other
> where you can do a broadcast ping and then read the arp cache.

> --

> All the facts above are true, except for the ones I made up.


> james.knott.