Reputation: 684
Cannot get static ip in my new Debian 9.
in my etc/network/interfaces I have following
# This file describes the network interfaces available on your system
# and how to activate them
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.168.88.10
netmask 255.255.255.0
gateway 192.168.88.1 // this is my router ip
network 192.168.88.0 // this is I don't know why, but I saw it in most of instructions
broadcast 192.168.88.255
dns-nameservers 192.168.88.1
Then I do this
service networking restart
And I got error
Job for networking.service failed because the control process exited with error code.
See "systemctl status networking.service" and "journalctl -xe" for details.
Upvotes: 1
Views: 8659
Reputation: 1
In my case I had to write manually resolv.conf file in and remove existing. Some reason system cannot write a resolv.conf file while set i t up to static ip.
after that it works!
Upvotes: 0
Reputation: 101
My Debian version 9
uname -a
4.9.0-5-amd64 #1 SMP Debian 4.9.65-3+deb9u2 (2018-01-04) x86_64 GNU/Linux
Try with following way, it works for me.
file name: /etc/network/interfaces
auto eth0
iface eth0 inet static
hwaddress 3a:c6:b2:43:7b:ab (you MAC address)
address 192.168.88.10
netmask 255.255.255.0
gateway 192.168.88.1
and then restart service:
systemctl restart networking.service
Upvotes: 5
Reputation: 684
I found solution. I installed new instance of Debian and checked settings on fresh system.
The problem was in interface name eth0. Correct name is ens3.
auto ens3
allow-hotplug ens3
iface ens3 inet static
address 192.168.88.10
netmask 255.255.255.0
network 192.168.88.0
broadcast 192.168.88.255
gateway 192.168.88.1
dns-nameservers 192.168.88.1
Upvotes: 0