I have a raspberry PI in a network where all clients get a DHCP IP address assigned automatically. DHCP-IPs are "192.168.0.X" with subnet mask "255.255.255.0"
But for my raspberry (and other devices) I want to use a fixed IP address in another network. Desired IP "192.168.X.Y" with subnet mask "255.255.0.0"
The raspberry should get the IP "192.168.20.104" with subnet mask "255.255.0.0".
My "/etc/network/interfaces" looks like
auto lo iface lo inet loopback iface eth0 inet static address 192.168.20.104 netmask 255.255.0.0 gateway 192.168.0.252
This works ok so far, my raspberry gets the address "192.168.20.104", but it also gets a DHCP address assigned (in my case "192.168.0.173").
Output of "sudo ip addr show":
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether b8:27:eb:37:1d:30 brd ff:ff:ff:ff:ff:ff inet 192.168.20.104/16 brd 192.168.255.255 scope global eth0 valid_lft forever preferred_lft forever inet 192.168.0.173/24 brd 192.168.0.255 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::ba27:ebff:fe37:1d30/64 scope link valid_lft forever preferred_lft forever
But I want the raspberry to use my static address only. There should be no DHCP address.
Is there an error in my "interfaces" file? Can someone explain why I get a DHCP address although I configured a static address?
What do I have to change in my config file so that I don't get a DHCP address?