0

I want to set my primary ethernet adapter to static ip because DHCP makes problem every time in my connections.

here's my /etc/network/interfaces.

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

auto enp1s0
iface enp1s0 inet static
address 192.168.0.40
netmask 255.255.255.0
gateway 192.168.0.1

And I do restart networking by services networking restart and error appears.

● networking.service - Raise network interfaces
   Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: en
  Drop-In: /run/systemd/generator/networking.service.d
           └─50-insserv.conf-$network.conf
   Active: failed (Result: exit-code) since sun 2017-02-26 02:05:44 KST; 20s ago
     Docs: man:interfaces(5)
  Process: 13609 ExecStop=/sbin/ifdown -a --read-environment --exclude=lo (code=exite
  Process: 13637 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FA
  Process: 13629 ExecStartPre=/bin/sh -c [ "$CONFIGURE_INTERFACES" != "no" ] && [ -n 
 Main PID: 13637 (code=exited, status=1/FAILURE)

 2월 26 02:05:44 haseunggabserver systemd[1]: Starting Raise network interfaces...
 2월 26 02:05:44 haseunggabserver ifup[13637]: RTNETLINK answers: File exists
 2월 26 02:05:44 haseunggabserver ifup[13637]: Failed to bring up enp1s0.
 2월 26 02:05:44 haseunggabserver systemd[1]: networking.service: Main process exited,
 2월 26 02:05:44 haseunggabserver systemd[1]: Failed to start Raise network interfaces
 2월 26 02:05:44 haseunggabserver systemd[1]: networking.service: Unit entered failed 
 2월 26 02:05:44 haseunggabserver systemd[1]: networking.service: Failed with result 'exit-code'. '

But when I try this : just add # before auto enp1s0

# interfaces(5) file used by ifup(8) and ifdown(8)
    auto lo
    iface lo inet loopback

    #auto enp1s0
    iface enp1s0 inet static
    address 192.168.0.40
    netmask 255.255.255.0
    gateway 192.168.0.1

networking restarts successfully.

I think nothing wrong in my interfaces file.. but I don't know why this appears.

my ifconfig :

enp1s0    Link encap:Ethernet  HWaddr 40:8d:5c:d7:a7:0a  
          inet addr:192.168.0.40  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::8c37:9a69:f4f6:dd92/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:135599 errors:0 dropped:0 overruns:0 frame:0
          TX packets:135766 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:14013385 (14.0 MB)  TX bytes:139304076 (139.3 MB)

enp2s0    Link encap:Ethernet  HWaddr 40:8d:5c:d7:a7:09  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:1015 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1015 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:95769 (95.7 KB)  TX bytes:95769 (95.7 KB)

Any ideas to fix this? regards.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.