1

I'm able to connect to the local server when static IP is not set, however, as soon as I set a static IP on eth0 then I'm no longer able to reach the server by name. When I was configuring my static IP in /etc/network/interfaces I was able to reach the server without issues but now when I follow the guides to set static IP in /etc/dhcpcd.conf it no longer connect to server. I tried brand new Raspbian image so the /etc/network/interfaces file is untouched and this is what I added at the end of /etc/dhcpcd.conf file:

interface eth0
static ip_address=192.168.16.1/24
static routers=192.168.16.254
static domain_name_servers=192.168.10.100

How do I connect to the server even if I have static IP?

6
  • 1
    You have mis-configured it. See How do I set up networking/WiFi/Static IP for a process to determine the correct settings. This also has some hints showing why you don't need a static IP. NOTE the settings for Stretch eth0 may also differ.
    – Milliways
    Oct 17, 2017 at 23:06
  • @Milliways thank you for the reply but I followed this guide in the first place and obtained ip_address, routers and domain_name_server with the commands suggested in that post. We have 60 pi's and it is easier to manage them on static IP than DHCP.
    – UZIERSKI
    Oct 23, 2017 at 14:09
  • 1
    If you have not just entered the details incorrectly you have a VERY UNUSUAL network.
    – Milliways
    Oct 24, 2017 at 0:52
  • In the 1980s I had to manually configure networks (this was before internet and DHCP). It was a nightmare, even with a small network. DHCP was invented for precisely this reason, to simplify an administrator's life.
    – Milliways
    Oct 24, 2017 at 0:55
  • The entry for domain_name_servers is on a different network from your Pi. Are you sure 192.168.10.100 shouldn't be 192.168. 16 .100?
    – Bob Brown
    Jan 6, 2020 at 12:48

1 Answer 1

0

I'm not sure your config is correct.

An example of what mine looks like:

interface eth0

static ip_address = 192.168.0.100/24

static routers = 192.168.0.1

static domain_name_servers = 192.168.0.1

Your domain_name_servers and routers address doesn't jive.

2
  • I obtained static routers with: ip route | grep default | awk '{print $3}' and static domain_name_servers with: cat /etc/resolv.conf. Do you think this is wrong? I used your solution but now I can't even putty in.
    – UZIERSKI
    Oct 23, 2017 at 14:22
  • I don't think its wrong, I just don't understand you network setup, it looks very unusual. The router is usually ends with a .1 not .254 and in this example (and like the guide posted in comments) the domain_name_servers address is the same. Whereas your address is completely different. I don't understand that.
    – user42000
    Oct 24, 2017 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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