-2

Suppose I connect two machines directly together with an ethernet cable. I know nothing about machine2's configuration - I only have access to machine1.

What can I do on machine1 to determine machine2's IP address? (Note that machine2 could have any possible IP.)

(The practical use for this is having a client connect a cellular router to their machine, and not having to do any configuration on their side for me to be able to then configure the cell router to talk to their machine.)

Rex
  • 7,815
  • 3
  • 28
  • 44
Daniel
  • 113
  • 1
  • 7
    `"Suppose I connect two machines directly together with an ethernet cable. I know nothing about machine2's configuration - I only have access to machine1."` - don't go sticking your cable into places you know nothing about. – TheCleaner Mar 12 '14 at 16:44
  • 2
    You've not even mentioned an operating system – Chopper3 Mar 12 '14 at 16:53
  • It depends on the OS, but it is easy. See http://askubuntu.com/questions/22835/how-to-network-two-ubuntu-computers-using-ethernet-without-a-router and http://www.labnol.org/software/connect-computers-without-router/11049/ . Basically, you set a static IP on both machines such as 10.0.0.1 and 10.0.0.2 or 192.68.0.1 .. – Panther Mar 12 '14 at 18:44
  • @bodhi.zazen - the OP already stated he only has access to machine1. – TheCleaner Mar 12 '14 at 18:51
  • If one does not have access to machine 1, how would you connect a cable to it ? The sys admin of machine 1 will need to help by assisgning an ip to the interface in question. Sure you could use nmap to discover an IP, but you still need a sys admin on machine 1 to then configure a share (NFS, sambs, http, ftp, ssh, etc). – Panther Mar 12 '14 at 19:04

4 Answers4

5

A lot of this may depend on what the other machine is doing. If the other machine is dark, you may never be able to find out.

However, most systems are at least a little "chatty" to some degree. Install/configure/run a packet sniffer on the system you have access to. It is likely that eventually the other system will send out a broadcast packet of some kind at which point your sniffer would pick up the broadcast packet from which you should be able to determine the IP and MAC address of machine2.

Rex
  • 7,815
  • 3
  • 28
  • 44
3

If the machine is on, and the interface is enabled, then after connecting the cable you will probably see activity from the network interface attached to the remote system.

Fire up wireshark/tcpdump. Do you see any DHCP requests? Do you see any ARP requests? These would be somewhat normal for a system using TCP/IP.

Zoredache
  • 128,755
  • 40
  • 271
  • 413
1

Are You sure that second machine has static address?

If You are not sure, maybe try to run DHCP server on machine you've got access and follow the log.

micro
  • 76
  • 1
1

The interface on Machine2 that you're plugging into might not even have an address - on what basis are you assuming that it has one?

You cannot, in a "guaranteed to always work" sense, do what you're asking for. Your best bet will be to include a DHCP server (as @micro suggested) and instruct your end user to configure their machine to use DHCP for that interface.

mfinni
  • 35,711
  • 3
  • 50
  • 86