pathead
Posts: 21
Joined: Mon Dec 14, 2015 7:19 pm

Set "default" IP address(not static)

Sat Feb 27, 2016 2:36 pm

At home, I can connect my Pi to my router and find out the IP it gets assigned easily. Away from home, I would like to be able to connect to my Pi with a laptop and access it via SSH. I cannot setup a static IP as I am ultimately going to be connecting to it to public wifi.

Since my laptop isn't running a DHCP server when I connect the Pi defaults to a 169.254.x.x address. The only way I've been able to get that address is by plugging in a monitor.

Is there anyway that I can set what the default 169.254.x.x address will be? Or does anyone have any other ideas for finding out the Pi's IP address?

Thank you

DirkS
Posts: 9877
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Set "default" IP address(not static)

Sat Feb 27, 2016 2:43 pm

Assuming you're using Raspbian Jessie you could try something like this:
(add it to /etc/dhcpcd.conf)

Code: Select all

profile static_eth0
static ip_address=192.168.1.200
static routers=192.168.1.1

interface eth0
fallback static_eth0
Change the IP address to what you need to connect to your laptop.

pathead
Posts: 21
Joined: Mon Dec 14, 2015 7:19 pm

Re: Set "default" IP address(not static)

Sun Feb 28, 2016 6:43 pm

That is perfect thank you!

I was able to change it so that it would work the default 169.254.x.x address that my laptop gets assigned:

Code: Select all

profile static_eth0
static ip_address=169.254.100.100

interface eth0
fallback static_eth0

Return to “Networking and servers”