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?

UZIERSKI
  • 41
  • 2
  • 6
  • 1
    You have mis-configured it. See [How do I set up networking/WiFi/Static IP](http://raspberrypi.stackexchange.com/a/37921/8697) 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 '17 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 '17 at 14:09
  • 1
    If you have not just entered the details incorrectly you have a **VERY UNUSUAL** network. – Milliways Oct 24 '17 at 00: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 '17 at 00: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 06 '20 at 12:48
  • I went around and around trying to set a static IP on my rPi and although I could set the IP address, that did not always mean I could access it remotely and definitely (in my case) never meant I could use DNS on the rPi. I don't claim to be any kind of networking admin. Just the opposite. However, my router has an ability to assign particular IP addresses by MAC address. This is easy and works great. But of course, it doesn't help you if you are not at home. – user1270418 Jan 06 '20 at 22:44

1 Answers1

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.

  • 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 '17 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. –  Oct 24 '17 at 15:19