In Debian-derived flavours, what does the ‘network’ line in /etc/network/interfaces actually do

ifconfignetworking

I'm trying to understand the syntax of ifupdown a bit better, and on several sites detailing fairly straightforward static configurations, the example documentation includes a line stating `network 192.168.0.0' — or something obviously similar. For example,

# The loopback network interface
auto lo eth0
iface lo inet loopback

# The primary network interface
iface eth0 inet static
    address 192.168.10.33
    netmask 255.255.255.0
    broadcast 192.168.10.255
    network 192.168.10.0
    gateway 192.168.10.254 
dns-nameservers 192.168.10.254

What exactly does this line do? I can't imagine that it contains anything that the netmask + address doesn't convey about, for example, broadcast addresses. There is much useful documentation about the myriad array of powerful things that one can do with /etc/network/interfaces available online. Almost all of it details various aspects of networking. Therefore, googling isn't terribly helpful!

Best Answer

The network doesn't have to be specified as it is simply the result of address & netmask (& is a binary and):

192.168.10.33 & 255.255.255.0 = 192.168.10.0

It may make it easier to understand by showing it in binary:

  11000000.10101000.00001010.00100001 (192.168.10.33)
& 11111111.11111111.11111111.00000000 (255.255.255.0)
-------------------------------------
  11000000.10101000.00001010.00000000 (192.168.10.0)
Related Question