1

I installed debian 9 and everything was working perfectly -- I was able to discover networks around and connect to the internet. The problem came when I decided to try changing from assigning an IP address automatically via DHCP to a static IP by changing this file /etc/network/interfaces. Realizing I could not connect to the internet after reboot, I tried "fixing" this plus other "fixes" I can't remember and now the file looks like this:

source /etc/network/interfaces.d/* auto lo iface lo inet loopback auto enp0s31f6 allow-hotplug enp0s31f6 iface enp0s31f6 inet dhcp auto wlp2s0 allow-hotplug wlp2s0 iface wlp2s0 inet dhcp **EDIT** address 10.0.0.163 netmask 255.255.255.0 gateway 10.0.0.1 

Here is the output of ip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1 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: enp0s31f6: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000 link/ether 14:b3:1f:17:c8:36 brd ff:ff:ff:ff:ff:ff 3: wlp2s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000 link/ether f8:59:71:a6:57:4d brd ff:ff:ff:ff:ff:ff 

and finally this is what I get from sudo systemctl status networking.service

networking.service - Raise network interfaces Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled) Active: active (exited) since Tue 2017-09-26 12:23:50 EAT; 34s ago Docs: man:interfaces(5) Process: 5293 ExecStop=/sbin/ifdown -a --read-environment --exclude=lo (code=exited, status=0/SUCCESS) Process: 5419 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=0/SUCCESS) Process: 5413 ExecStartPre=/bin/sh -c [ "$CONFIGURE_INTERFACES" != "no" ] && [ -n "$(ifquery --read-environment --list --exclude=lo)" ] && udevadm settle (code=exited, status=0/SUCCESS) Main PID: 5419 (code=exited, status=0/SUCCESS) Tasks: 2 (limit: 4915) CGroup: /system.slice/networking.service ├─5473 /sbin/dhclient -4 -v -pf /run/dhclient.enp0s31f6.pid -lf /var/lib/dhcp/dhclient.enp0s31f6.leases -I -df /var/lib/dhcp/dhclient6.enp0s31f6.leases enp0s31f6 └─5581 /sbin/dhclient -4 -v -pf /run/dhclient.wlp2s0.pid -lf /var/lib/dhcp/dhclient.wlp2s0.leases -I -df /var/lib/dhcp/dhclient6.wlp2s0.leases wlp2s0 
7
  • Remove/save the files under /etc/network/interfaces.d/ and keep using only /etc/network/interfaces then configure a static ip Commented Sep 26, 2017 at 10:25
  • @GAD3R thank you for your response, i currently dont have any files in /etc/network/interfaces.d/ , i've added the address netmask and gateway to the file /etc/network/interfaces, but i still cant discover any networks Commented Sep 26, 2017 at 10:38
  • can you add the content of /etc/network/interfaces with a static IP Commented Sep 26, 2017 at 11:42
  • sure edited the question please check. Commented Sep 26, 2017 at 12:15
  • 1
    I dont think i have eth0 i think its enp0s31f6 from ifconfig command , my gateway is fine and ip as well. Commented Sep 26, 2017 at 12:31

2 Answers 2

1

Edit your /etc/network/interfaces as follows:

auto lo iface lo inet loopback 

Configure a static IP for your ethernet interface:dhcpcd method

Install dhcpcd:

sudo apt install dhcpcd5 

Edit your /etc/dhcpcd.conf file :

sudo nano /etc/dhcpcd.conf 

Past the following lines:

# define static profile profile static_enp0s31f6 static ip_address=10.0.0.163 /24 static routers=10.0.0.1 static domain_name_servers=10.0.0.1 # fallback to static profile on enp0s31f6 interface enp0s31f6 fallback static_enp0s31f6 

Then disable the dhcpcd daemon:

sudo update-rc.d -f dhcpcd remove 

enable networking:

sudo systemctl enable networking 

Reboot then run:

 sudo iptables -t nat -A POSTROUTING -o enp0s31f6 -j MASQUERADE sudo dhcpcd 

Archlinux wiki dhcpcd

0
0
 - write under:: auto wlp2s0 allow-hotplug wlp2s0 iface wlp2s0 inet dhcp address 10.0.0.163 netmask 255.255.255.0 broadcast 10.0.0.255 gateway 10.0.0.1 ################################################ wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf# or your wpa conf file path #or wpa-ssid "home-network-ssid" wpa-psk "secret-key" ################################################ 

and you can look

  • $ man interfaces
  • $ man ifcfg
  • $ man ifconfig

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.