View previous topic :: View next topic |
Author |
Message |
Gabriel_Blake Guru
Joined: 16 Sep 2007 Posts: 362
|
Posted: Fri May 24, 2013 3:00 pm Post subject: [SOLVED] Finding a device IP over LAN |
|
|
Hi.
I'm having difficulties describing what I want to get here, so picture this:
Device A: server
Device B: laptop
Network: Ethernet with DHCP on router
Let's say I plug in both machines. They get an IP over DHCP. The problem is how can the laptop discover the IP of the server (no MAC checking) ? I was thinking about something that would broadcast some sort of id from the server so that the laptop will catch that. The security is not an issue, because after the laptop gets the server's IP the rest will continue via ssh+rsa.
I'm probably asking for something trivial, but I couldn't phrase it for google correctly.
Last edited by Gabriel_Blake on Mon Jun 03, 2013 4:02 pm; edited 1 time in total |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Fri May 24, 2013 3:46 pm Post subject: Re: Finding a device IP over LAN |
|
|
Gabriel_Blake wrote: | Let's say I plug in both machines. They get an IP over DHCP. The problem is how can the laptop discover the IP of the server (no MAC checking) ? I was thinking about something that would broadcast some sort of id from the server so that the laptop will catch that. |
Gabriel_Blake ... the entire network is already broadcasting such information in the form of arp, its fairly trivial to find out what is on a network, the IP's in use, and their mac addresses, there are packages, like net-analyzer/netdiscover, designed for such aquistion, for example:
Code: | # netdiscover -i eth0 -r 192.168.1.0/24 |
Also, net-analyzer/arping comes with a script, arping-scan-net.sh, which scans a network for a given mac address.
best ... khay |
|
Back to top |
|
|
Gabriel_Blake Guru
Joined: 16 Sep 2007 Posts: 362
|
Posted: Fri May 24, 2013 4:05 pm Post subject: |
|
|
khayyam I did mention:
I know it's trivial to find it using MAC with any network analyzer. The thing is I assume I don't know the mac address (or it may change after switching to a different Ethernet card/adapter) and I don't want to check EVERY IP in the network. |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Fri May 24, 2013 4:55 pm Post subject: |
|
|
Gabriel_Blake wrote: | I did mention: (no MAC checking) |
Gabriel_Blake ... you did, but you placed it in brackets and followed with a question mark, so it wasn't altogether clear.
Gabriel_Blake wrote: | I know it's trivial to find it using MAC with any network analyzer. The thing is I assume I don't know the mac address (or it may change after switching to a different Ethernet card/adapter) and I don't want to check EVERY IP in the network. |
Honestly, you plan to change the card often enough that this would be a hindrance, and for a server on your network whos mac address you can't "assume" to know? But, ok, as you plan to connect via ssh then set your server to use avahi-daemon to publish the sshd service, you should then be able to 'ssh server.local'.
best ... khay |
|
Back to top |
|
|
John R. Graham Administrator
Joined: 08 Mar 2005 Posts: 10589 Location: Somewhere over Atlanta, Georgia
|
Posted: Fri May 24, 2013 5:40 pm Post subject: |
|
|
Out of morbid curiosity, why wouldn't you want to set up a simple DNS like dnsmasq?
- John _________________ I can confirm that I have received between 0 and 499 National Security Letters. |
|
Back to top |
|
|
Gabriel_Blake Guru
Joined: 16 Sep 2007 Posts: 362
|
Posted: Mon May 27, 2013 11:00 pm Post subject: |
|
|
John R. Graham wrote: | Out of morbid curiosity, why wouldn't you want to set up a simple DNS like dnsmasq?
- John |
OK... How would this work ? I'm connected to the internet via NAT on my router. All my computers are set to GoogleDNS 8.8.8.8. How would dnsmasq affect DNS resolution if it's not even addressed to do so ? |
|
Back to top |
|
|
John R. Graham Administrator
Joined: 08 Mar 2005 Posts: 10589 Location: Somewhere over Atlanta, Georgia
|
Posted: Tue May 28, 2013 2:14 pm Post subject: |
|
|
You would set up dnsmasq on your server, configuring it to- Handle DHCP for your network. Of course, you would turn off your router's DHCP service.
- Offer DNS to your network. Then dnsmasq would use Google DNS to satisfy name resolution for machines off your network.
Under these circumstances, dnsmasq will keep a list of host names that have active DHCP leases and the DNS portion of dnsmasq will resolve those names locally. This is what a name server is for.
- John _________________ I can confirm that I have received between 0 and 499 National Security Letters. |
|
Back to top |
|
|
Gabriel_Blake Guru
Joined: 16 Sep 2007 Posts: 362
|
Posted: Mon Jun 03, 2013 4:02 pm Post subject: |
|
|
John R. Graham wrote: | Of course, you would turn off your router's DHCP service. |
Won't do :/
Thanks for the help. I'll have to lower my requirements I'll stick with the MAC based recognition. |
|
Back to top |
|
|
_______0 Guru
Joined: 15 Oct 2012 Posts: 521
|
Posted: Tue Jun 04, 2013 2:58 pm Post subject: |
|
|
wow what a stupid program, all arp does is check this file:
I would restrain from using ipv4 tools, they are dumb and primitive. ipv6 protocol has built-in many things that are cumbersome to find out with ipv4. One such an example is ping6.
Try this:
Code: | ping6 -c4 -I eth0(or your device) ff02::1 |
Where it would take crazy routing and insane setup to ssh with ipv4, ssh'ing with ipv6 it's automagic.
Gentoo should introduce the -ipv4 USE flag. |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Wed Jun 05, 2013 12:16 am Post subject: |
|
|
Install avahi-daemon on all computers and add its initscript to default.
|
|
Back to top |
|
|
_______0 Guru
Joined: 15 Oct 2012 Posts: 521
|
Posted: Sat Jun 08, 2013 3:55 pm Post subject: |
|
|
Ant P. wrote: | Install avahi-daemon on all computers and add its initscript to default. |
This suggestion is for an ideal world and avahi was las updated:
2012-02-15 |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Sat Jun 08, 2013 5:20 pm Post subject: |
|
|
_______0 wrote: | This suggestion is for an ideal world and avahi was las updated:
2012-02-15 |
Stop being a ricer.
My suggestion works and obviates the need for ridiculous actions like memorising multicast IPv6 addresses and interface names, which might as well be random numbers on udev systems.
Avahi was last updated 7 weeks ago, not 16 months. You should update your Portage tree and run glsa-check ASAP if your local systems are so outdated; your obsolete software poses a threat to the herd immunity of other network users. |
|
Back to top |
|
|
|