1

How would I be able to use my rPi with a fixed IP on the ethernet port and 'automatic' wifi?

I've got the credentials for the known accesspoints, with priority stored in /etc/wpa_supplicant/wpa_supplicant.conf

The RPi is autoconnecting to my wifi network, and I was able to SSH into the pi. Now, to setup the static IP for the ethernetport I followed this answer, and so:

In /etc/dhcpcd.conf I uncommented the following:

interface eth0
   static ip_address=x.y.z.5/24
   static routers=x.y.z.1
   static domain_name_servers=1.1.1.1

Then I ran

sudo systemctl disable dhcpcd
sudo systemctl enable networking

But now the pi doesn't connect to the Wifi anymore and I cannot connect to the ethernetport as this is a completely different subnet :)

So in the end I want to have the following:

  • Eth0 > static IP
  • Wlan0 > DHCP, with auto connect with credentials from wpa_supplicant.conf

The reason for this setup: I've got 5 public ip adresses with my provider; I want my pi to be on one of them. As the router itself is 'transparent' and managed by the provider I need to configure the ip settings, including gateway, for this interface manually. The wlan connection is just to configure the pi at my office (which is not the end location).

stUrb
  • 111
  • 1
  • 4

2 Answers2

3

Actually this command given in the Answer

sudo systemctl disable dhcpcd
sudo systemctl enable networking

is for Network Interfaces method not for dhcpcd method.

You just need to add these lines in dhcpcd.conf file or you can uncomment the default lines and edit them as per your IP address

interface eth0
static ip_address=192.168.1.1/24    
static routers=192.168.1.1
static domain_name_servers=192.168.1.1 8.8.8.8

Once done save it using CTRL+O and then CTRL+X to exit. Then do sudo reboot or just this

sudo systemctl start dhcpcd.service
Amit Ray
  • 142
  • 1
  • 9
1

You may have configured /etc/dhcpcd.conf but your next step sudo systemctl disable dhcpcd turns dhcpcd off so the configuration was futile.

It is unclear WHY you want to set Eth0 > static IP or why you are trying to set a gateway address for this interface.

There is no point being coy about x.y.z we don't know what you have done.

Milliways
  • 62,573
  • 32
  • 113
  • 225