Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to change my Ubuntu to static IP. My current IP setting is:

eth0      Link encap:Ethernet  HWaddr 00:0c:29:xx:xx:xx  
      inet addr:  Bcast:  Mask:
      inet6 addr: fe80::20c:xx:xx:xx/64 Scope:Link
      RX packets:234690 errors:0 dropped:0 overruns:0 frame:0
      TX packets:1864 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:22953435 (22.9 MB)  TX bytes:205616 (205.6 KB)

what should I put as the network in /etc/network/interfaces (note the network mask of

share|improve this question
What exactly do you have trouble with? I don't see any network statements in interfaces(5). You might consider rephrasing your question and add some details. – Andreas Wiese Mar 31 '14 at 19:56
Stop using ifconfig, use ip addr instead. This is what ifupdown (the software that parses /etc/network/interfaces) uses under the hood anyway, so you will definitely want to get used to it. – BatchyX Mar 31 '14 at 20:06
@BatchyX, I use ip addr for other things but not this one, because it'd be worse that ifconfig -- ifconfig at least gives me address, broadcast & netmask, but ip addr doesn't give me netmask, at least my version doesn't. – xpt Apr 1 '14 at 2:40
@xpt: ip addr gives you the modern CIDR prefix length just next to the IP address. It also accept old-style netmask on input (i.e. – BatchyX Apr 2 '14 at 17:52
up vote 1 down vote accepted

If I'm understanding your question, to set a static IP, your network runs from -, with the identity address at and the broadcast at I've never had to use the Network keyword, but I've never used a supernet address on a host. I've only seen them used for route aggregation.

 auto eth0
 iface eth0 inet static
share|improve this answer
My IP is not a good example for network for this case. I guess if my IP is, my network value is still, correct? BTW, are you saying that is network optional for /etc/network/interfaces? I'm following, and there is a network there. – xpt Apr 1 '14 at 2:29
it depends on your network mask. for the Class C network 192.168.X.Y, a subnetted network would have >24 bits of mask (, a supernetted net would have < 24 bits mask (255.0-255.0-252.0), and a normal (class natural) Class C would be which one it is defines the "shape" of your IP address layout. – Frank Thomas Apr 1 '14 at 11:27
Yeah, all these is because of the supernetted net, a term that I just learned from you. Otherwise, for network mask, the examples are everywhere. So again, to confirm, for network mask of, for all IP of 192.168.18.*, 192.168.28.* till 192.168.31.*, their network value are all, right? – xpt Apr 1 '14 at 14:07
yep. now that said, there is the possibility that subnetworks are defined under this address space, so make sure when configuring systems in this way that they all have a mask. if you see any more confining masks (more than 20 bits) you will need to recalculate the network range, ID, and broadcast when configuring systems on that network. I use this calculator: – Frank Thomas Apr 1 '14 at 14:16
network is totally ignored by ifupdown, the system can figure it by itself anyway. Your broadcast is useless here: the system will pick the same in your case. Your gateway is not part of your subnet, so ifupdown will fail at that point. – BatchyX Apr 2 '14 at 18:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.