Static IP Config on Debian, RaspberryPi-Asterisk

I have just installed an image of FreePBX and Asterisk on a new RaspberryPi 2 Model B and it works amazingly well. I have even been able to add most all of the current modules that do not come with the image or in its updates. So no issues there.

My problem is, (and I know this is not a Debian group or a Raspbian group, but I KNOW the expertise is here), I cannot get a static IP address to stick or even work.

I have modified the /etc/network/interfaces file with: (my desired lan config)

eth0 auto
iface eth0 inet static
address 192.168.0.165
netmask 255.255.255.0
gateway 192.168.0.20
dns-nameservers 192.168.0.1

… and commented out the iface etho inet dhcp. Left the lo settings alone.

a reboot and no network connectivity. The only way I can get this to stick, albeit temporarily, is to use ifconfig and set the params. I thought maybe dns-nameservers was an issue so I removed that and placed those IPs in the /etc/resolv.conf file. Still no joy.

I finally had to reserve these IPs in my DHCP server to get what I wanted/needed. After a reboot or network restart, it gets the reserved DHCP addresses and I have great joy.

What might be wrong? Bug in the Raspbian/Debian distribution that FreePBX and Asterisk run on?

Thanks for any thoughts!

John

Is there another file or something else I am missing

Just a comment but your gateway is NOT also your nameserver, post

ip addr show dev eth0
ip route
traceroute 4.2.2.1
traceroute www.yahoo.com

both on boot and when you “fix” the network, that should expose the differences, (ip is nowadays preferred over ifconfig to manage your network, If by any chance you have network-manager installed than

apt-get purge network-manager

it shouldn’t screw up a static setup but it is truly a POS)

Thanks Dicko. I’ll check those differences using ip and post them if I can’t see what might be going on. Not sure if network-manager is installed in this distro but easy to check and purge. And my name server is separate; a Windows server.

I haven’t a clue what I did differently, other than it was off for several hours and ensured network-manager was not installed but I had to install traceroute. I edited the interfaces file exactly as I did above and did a service networking restart and everything came up fine. Did a reboot a couple of times both warm and cold (power off-on) start ups and not an issue at all.

I did not use at all ifconfig for any reads or writes.

I am stumped. I swear… no fat fingers on this one!

Now I am anxious to do a few stress tests on this little piece of pi!

Thanks Dicko!

John

Hehe, the trouble with computers is that they almost always do what you say, this is not necessarily what you want :wink: , glad its all fixed.