Changes to /etc/network/interfaces ignored and restored at re-boot

0

I wanted to set up a virtual machine according to this tutorial: http://www.howtoforge.com/virtualization-with-kvm-on-a-debian-lenny-server

I reached to the point where I have to modify the interfaces file, which look liked this:

auto lo
iface lo inet loopback

auto  eth0
iface eth0 inet static
      address   176.9.XXX.XXX
      netmask   255.255.255.255
      pointopoint   176.9.XXX.XXX
      gateway   176.9.XXX.XXX

And changed it to this:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet manual

auto br0
iface br0 inet static
    address   176.9.XXX.XXX
    netmask   255.255.255.255
    pointopoint   176.9.XXX.XXX
    gateway   176.9.XXX.XXX
    bridge_ports eth0
    bridge_fd 9
    bridge_hello 2
    bridge_maxage 12
    bridge_stp off

Then I did: /etc/init.d/networking restart, but my ifconfig output stays the same and when I re-boot my server the interface file looks like before. Why is this happening?

ifconfig:

eth0      Link encap:Ethernet  HWaddr 00:18:51:XX:XX:XX
          inet addr:176.9.XXX.XXX  Bcast:176.9.XXX.XXX Mask:255.255.255.255
          inet6 addr: fe80::218:51ff:XXXX:XXXX/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4236 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4569 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:414559 (404.8 KiB)  TX bytes:501379 (489.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:16436  Metric:1
          RX packets:3406 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3406 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:319219 (311.7 KiB)  TX bytes:319219 (311.7 KiB)

Kia

Posted 2014-10-29T10:24:33.323

Reputation: 103

Answers

0

Not really an answer but some observations too long for a comment, which might help…

First, do you have bridge-utils installed? The reason is that the ifupdown package responsible for parsing /etc/network/interfaces and managing your networking is just a bunch of shell scripts calling out to appropriate lower-level tools (such as those of iproute, dhcp3-client and so on), so if you're missing tools which are responsible for the grunt work of setting up bridges, ifupdown alone won't be able to set your bridge up.

Second, Instead of "restarting the networking" you should have been leveraging interactive stuff offerred by ifupdown in the form of its ifup and ifdown scripts: to test whether brindge interface is able to start, you'd do

# ifup br0

and see what happens. Please consult appropriate manual pages.


Third, please stop using

# /etc/init.d/<foo> <action>

and do

# service <foo> <action>

instead (available since Squeeze). This has a number of advantages:

  • It works no matter which init system is installed—that is, it works even with upstart, systemd, openrc etc while each of these systems provides its own specific tools for controlling services.

    Hence using service will ease your transition to another init system later (Jessie will transition your system to systemd by default) by not requiring you quickly relearn how to manage your services.

  • With sysvinit (what you're currently using), it properly sanitizes the environment before calling the target init script. The old direct invocation approach is vulnerable to be affected by the state of the shell which called the script. The service script makes sure the init script it calls sees an environment with sensible $PATH, umask, working directory and so on.

kostix

Posted 2014-10-29T10:24:33.323

Reputation: 2 435