The interfaces file looks like below:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static

As you can see the netmask address is sort of invalid. (250 instead of 255) The problem is when we use the following code to get the current IP address and netmask:

ioctl(iSock, SIOCGIFADDR, &stIFReq);
ioctl(iSock, SIOCGIFNETMASK, &stIFReq);

It always returns "72,0,67,33" (hex:0x48004321) on both ioctl functions. I wonder if this is some sort of error code or bug during ifup. I would like to know what type of checking ifup does on netmasks/ip addresses and what does it do if the address is judged as invalid.

Additional info:

  1. Linux version

  2. BusyBox v1.18.5

  3. [ifup] is not a script but a C program on the system


Check on your system, but on most ifup is a shell script, so you can see what it does by taking a peak at the source. You can see where the script resides with this command:

$ type -a ifup
ifup is /sbin/ifup

Feodra/Red Hat Distros

On my system (Fedora 14) /sbin/ifup includes this library of shell script functions, /etc/sysconfig/network-scripts/network-functions. If you grep through this file for "mask":

$ grep -i mask /etc/sysconfig/network-scripts/network-functions
    if [ -z "${NETMASK}" ]; then
    eval $(/bin/ipcalc --netmask ${IPADDR})
    eval $(/bin/ipcalc --prefix ${IPADDR} ${NETMASK})
    eval $(/bin/ipcalc --broadcast ${IPADDR} ${NETMASK})
    eval $(/bin/ipcalc --network ${IPADDR} ${NETMASK})

The tool ipcalc is an executable that is used to do "calculations" regarding network configurations.

You can run it from the command line too:

$ /bin/ipcalc --netmask

$ /bin/ipcalc --prefix


The ipcalc tool is slightly different on Debian/Ubuntu but serves a similar function.

$ ipcalc
Address:          11000000.10101000.00000001. 00000001
Netmask: = 24   11111111.11111111.11111111. 00000000
Wildcard:            00000000.00000000.00000000. 11111111
Network:       11000000.10101000.00000001. 00000000
HostMin:          11000000.10101000.00000001. 00000001
HostMax:        11000000.10101000.00000001. 11111110
Broadcast:        11000000.10101000.00000001. 11111111
Hosts/Net: 254                   Class C, Private Internet

You configurations


$ /bin/ipcalc --netmask

$ /bin/ipcalc --prefix


$ ipcalc
Address:        11000000.10101000.00000000. 10000010
Netmask: = 24   11111111.11111111.11111111. 00000000
Wildcard:            00000000.00000000.00000000. 11111111
Network:       11000000.10101000.00000000. 00000000
HostMin:          11000000.10101000.00000000. 00000001
HostMax:        11000000.10101000.00000000. 11111110
Broadcast:        11000000.10101000.00000000. 11111111
Hosts/Net: 254                   Class C, Private Internet

So what's most likely happening is your settings are getting setup with the wrong value in a spot. To debug this further I'd need to see the output of ip.


$ ip addr show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:19:d1:e8:4c:95 brd ff:ff:ff:ff:ff:ff
    inet brd scope global eth0
    inet6 fe80::219:d1ff:fee8:4c95/64 scope link 
       valid_lft forever preferred_lft forever
  • Thank you for your information. Sorry I didn't put it earlier but [ifup] on the system is not a script, but a program. Also, the system is on an embedded device so, it lacks some command/functions like [ipcalc]. – Naze Kimi Oct 24 '13 at 2:53
  • @NazeKimi - figures. What does ifup show you? It should be a text file that you can view with a more command. – slm Oct 24 '13 at 2:55
  • here was the output – Naze Kimi Oct 24 '13 at 3:03
  • [root]# ifup -a ifup: interface lo already configured ifup: interface eth0 already configured [root]# [root]# [root]# ip addr show dev eth0 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000 link/ether 00:06:48:00:43:21 brd ff:ff:ff:ff:ff:ff [root]# – Naze Kimi Oct 24 '13 at 3:04
  • @NazeKimi - sorry I meant for you to more the file, not run it. – slm Oct 24 '13 at 3:16

You are running BusyBox, whereifup/ifdown are applets. Looking at function count_netmask_bits() in the source code, BusyBox starts at the LSB and stops when it encounters the first 1. So it will not notice your malformed netmask.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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