0

I have configured a static IP on my PI 3 adding this in dhcpcd.conf :

static ip_address=192.168.1.200/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1

It works well when it is plugged in my home router. But if I unplug the Ethernet cable, then there is no IP assigned anymore when I check with ifconfig. Is it normal? Can I have a static IP assigned even when there is no cable plugged?

I have also set the embeded wifi interface as a WIFI hotspot following this tutorial:

Maybe it could explain this behavior.

  • 3
    What good is an IP static or otherwise if it isn't connected? – Steve Robillard Feb 8 '18 at 18:25
1

The IP address is associated with the Ethernet port. So if there is nothing connected it doesn't need an address. Once You plug the cable back in, the same address will be used again. If you want the Wifi to have a static IP address (which I assume it does if it is set up as an access point) Then that is configured separately. Each interface has its own address.

  • you could bridge ethernet and wifi so, they can have the same address (technically, the bridge has the ip address, of course) – Jaromanda X Feb 9 '18 at 1:18
0

Disable or uninstall dhcpcd and define your static ip in /etc/network/interfaces. These settings will be overridden if dhcpcd starts.

  • This is poor advice. It is also WRONG! Settings will NOT "be overridden if dhcpcd starts" - although they may be ignored resulting in duplicates. – Milliways Feb 10 '18 at 0:01
  • I saw it with my own eyes, @Milliways. – Gerard H. Pille Feb 10 '18 at 2:00
0

I have the same situation you have. Sometimes eth0 cable is unplugged, but I managed to set static ip address. You need to edit /etc/network/interfaces file as follows:

auto eth0

iface eth0 inet static

address 192.168.1.40

netmask 255.255.255.0

gateway 192.168.1.1

dns-nameservers 8.8.8.8

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.