Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Finding a device IP over LAN
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Gabriel_Blake
Guru
Guru


Joined: 16 Sep 2007
Posts: 362

PostPosted: Fri May 24, 2013 3:00 pm    Post subject: [SOLVED] Finding a device IP over LAN Reply with quote

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
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2244

PostPosted: Fri May 24, 2013 3:46 pm    Post subject: Re: Finding a device IP over LAN Reply with quote

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
View user's profile Send private message
Gabriel_Blake
Guru
Guru


Joined: 16 Sep 2007
Posts: 362

PostPosted: Fri May 24, 2013 4:05 pm    Post subject: Reply with quote

khayyam I did mention:
Quote:
(no MAC checking)


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
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2244

PostPosted: Fri May 24, 2013 4:55 pm    Post subject: Reply with quote

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
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 7804
Location: Somewhere over Atlanta, Georgia

PostPosted: Fri May 24, 2013 5:40 pm    Post subject: Reply with quote

Out of morbid curiosity, why wouldn't you want to set up a simple DNS like dnsmasq?

- John
_________________
This space intentionally left blank.
Back to top
View user's profile Send private message
Gabriel_Blake
Guru
Guru


Joined: 16 Sep 2007
Posts: 362

PostPosted: Mon May 27, 2013 11:00 pm    Post subject: Reply with quote

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
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 7804
Location: Somewhere over Atlanta, Georgia

PostPosted: Tue May 28, 2013 2:14 pm    Post subject: Reply with quote

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
_________________
This space intentionally left blank.
Back to top
View user's profile Send private message
Gabriel_Blake
Guru
Guru


Joined: 16 Sep 2007
Posts: 362

PostPosted: Mon Jun 03, 2013 4:02 pm    Post subject: Reply with quote

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
View user's profile Send private message
_______0
Guru
Guru


Joined: 15 Oct 2012
Posts: 521

PostPosted: Tue Jun 04, 2013 2:58 pm    Post subject: Reply with quote

wow what a stupid program, all arp does is check this file:

Code:
cat /proc/net/arp


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
View user's profile Send private message
Ant P.
Advocate
Advocate


Joined: 18 Apr 2009
Posts: 2374
Location: UK

PostPosted: Wed Jun 05, 2013 12:16 am    Post subject: Reply with quote

Install avahi-daemon on all computers and add its initscript to default.
Code:
avahi-browse -at
Back to top
View user's profile Send private message
_______0
Guru
Guru


Joined: 15 Oct 2012
Posts: 521

PostPosted: Sat Jun 08, 2013 3:55 pm    Post subject: Reply with quote

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
View user's profile Send private message
Ant P.
Advocate
Advocate


Joined: 18 Apr 2009
Posts: 2374
Location: UK

PostPosted: Sat Jun 08, 2013 5:20 pm    Post subject: Reply with quote

_______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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum