I have a Raspberry Pi I'm going to use to control decorative lightson my house, and have it be headless. I'll want to be able to sshinto the Pi to troubleshoot and monitor. It connects on WiFi viaan AirPort Extreme. While I could always go to the AirPort extremevia the AirPort utility to find it's IP address (currently 10.0.1.12),it would be more satisfying to have a hostname I could use. I'mcurrently puzzled, when I do 'dig raspberrypi' (from my Macintosh)I get an address of 198.105.244.114 (Full output below).This doesn'tmatch anything on my pi. Using 'ifconfig' on the pi shows no ip4address associated with eth0, and the wlan0 address is on the10.x.x.x network. (Full output below as well).
What might I do to get the hostname 'raspberrypi' associated with the correct ip address which presumably can be different every timepower cycles on the Pi as it gets the address via DHCP on the Airportextreme? So I can then 'ssh raspberrypi' and get to the right place.
As I was preparing this question, I thought I'd change my pi hostnamejust to look at the effects. After pi reboot, it comes up with thenew hostname and the same wan0 address, but in the AirPortExtremedisplay, the name doesn't change. (Still 'raspberrypi' not the newname 'lightpi'. This is puzzling and annoying, but perhaps notrelevant.
As I was browsing the AirPort utility it occurred to me that I couldconfigure a DHCP reservation for the Pi, so I could use the sameIPv4 address all the time. Would this be a reasonable alternative?
$ dig raspberrypi; <<>> DiG 9.10.6 <<>> raspberrypi;; global options: +cmd;; Got answer:;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 679;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0;; QUESTION SECTION:;raspberrypi. IN A;; ANSWER SECTION:raspberrypi. 10 IN A 198.105.244.114raspberrypi. 10 IN A 198.105.254.114;; Query time: 39 msec;; SERVER: 10.0.1.1#53(10.0.1.1);; WHEN: Mon Jul 02 11:22:57 PDT 2018;; MSG SIZE rcvd: 61opi@raspberrypi $ sudo ifconfigeth0 Link encap:Ethernet HWaddr b8:27:eb:ce:48:f9 inet6 addr: fe80::d793:ec86:c0b:5b12/64 Scope:Link UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:136 errors:0 dropped:0 overruns:0 frame:0 TX packets:136 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:11472 (11.2 KiB) TX bytes:11472 (11.2 KiB)wlan0 Link encap:Ethernet HWaddr 74:da:38:59:ca:a4 inet addr:10.0.1.12 Bcast:10.0.1.255 Mask:255.255.255.0 inet6 addr: fe80::76da:38ff:fe59:caa4/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:7629 errors:0 dropped:153 overruns:0 frame:0 TX packets:4231 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:3990719 (3.8 MiB) TX bytes:571886 (558.4 KiB)