1

I am following the guide here to configure a fresh Ubuntu 12.04 server installation (running in VirtualBox) with a static IP address. The recommended configuration in /etc/network/interfaces is:

auto lo
iface lo inet loopback


auto eth0
iface eth0 inet static
    address 192.168.1.100
    netmask 255.255.255.0
    network 192.168.1.0
    broadcast 192.168.1.255
    gateway 192.168.1.1

Due to my router, I will be giving the server the address 192.168.1.55, and the gateway will be 192.168.1.254 (which is the IP of my BT HomeHub), and the Netmask is fine as it is.

But I'm interested to know: What are the functions of 'network' and 'broadcast' here?

Can I leave these as they are in the example above, or do they need to point somewhere specific based on my home network?

Ade
  • 699
  • 3
  • 10
  • 21

1 Answers1

6

network here is for network ID, and broadcast is an IP broadcast address.

Both addresses can be calculated* from the ip and the network mask, and don't have to be written to the config, but sometimes it's easier for the admin to see them there, and not have to calculate them (it's simple with /8, /16, /24 networks, but on a sleepless coffeeless night, calculating this for a /27 is error-prone).

Since both your network and netmask are same as the example, you can leave them the same as in the example config, or remove them.

*if you do a logical AND: IP && netmask, you get a network ID. If you swap all the zeros right of the netmask to 1s (binary ofcourse), you get the broadcast address.

mulaz
  • 10,682
  • 1
  • 31
  • 37
  • 1
    I have seen a package that created a hook in the `if-up` scripts that got wonky when the network/broadcast wasn't explicitly set, but that was back in the Deb 3.1 days. I am pretty sure that package got fixed. There is a slight possibility that some other tool still exists that might require them to be set. Though you can probably leave them unset, and add them if you are running something that needs them. – Zoredache Oct 31 '12 at 19:32