4

I tried to set a static IP on my Debian 8.1 (in VirtualBox), so I edited the /etc/network/interface file :

# The loopback network interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.1.51
netmask 255.255.255.0
gateway 192.168.1.1
broadcast 192.168.1.255

This configuration seems correct (I also tried without 'auto eth0') and the ip is not already used in the network.
However, when I check with ifconfig, eth0 does not appear, there is obviously an error in my configuration.

ifconfig without interfaces edit (normal) :

eth0      Link encap:Ethernet  HWaddr 08:00:27:4a:58:ae  
          inet addr:192.168.1.43  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe4a:58ae/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:26 errors:0 dropped:0 overruns:0 frame:0
          TX packets:77 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2201 (2.1 KiB)  TX bytes:10924 (10.6 KiB)

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:39 errors:0 dropped:0 overruns:0 frame:0
          TX packets:39 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:4573 (4.4 KiB)  TX bytes:4573 (4.4 KiB)

ifconfig with interfaces edit (abnormal) :

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:39 errors:0 dropped:0 overruns:0 frame:0
          TX packets:39 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:4573 (4.4 KiB)  TX bytes:4573 (4.4 KiB)

I would like to know how to configure this eth0 interface to get a static ip.

kolm3
  • 41
  • 1
  • 2
  • After you've configured the interfaces file and restarted networking, will `ifup eth0` bring it up for you? – Safado Jul 29 '15 at 22:43
  • Have you tried reboot or combination of: `ifdown --verbose eth0`, `ifconfig eth0 inet 0.0.0.0 down`, `ifup --verbose eth0`? Show us the output of these commands. – sam_pan_mariusz Jul 30 '15 at 05:25
  • @Safado @sam_pan_mariusz `ifup --verbose eth0` or `ifdown --verbose eth0` **shows the following error** :ifup: couldn't `read interfaces:2: misplaced option`. `ifconfig eth0 inet 0.0.0.0 down` **shows nothing** – kolm3 Jul 30 '15 at 11:02
  • 2
    It's complaining about line 2 in your interfaces file. Is what you pasted above the entire file? Or is their more text that you didn't paste here? – Safado Jul 31 '15 at 00:08

1 Answers1

1

There might be more in your file (as Safado above notes) that you did not include, and that might be at fault. Is there a header perhaps that you have accidentally pulled onto two lines that is incorrectly formatted?

Xavier Nicollet
  • 620
  • 4
  • 10
hlmtre
  • 146
  • 6