What does mask 0.0.0.0 mean when it's assigned to a network interface?

3

2

Suppose I use ifconfig or some similar command to setup my network interface, and I assign 0.0.0.0 to the mask parameter. Does it have a special meaning? What implications could this have?

dario_ramos

Posted 2011-07-03T21:44:07.427

Reputation: 398

Answers

5

0.0.0.0 generally means that the network interface isn't bound to any network at all, not even localhost requests will be acknowledged. If anything it's a way of the operating system to present the interface as available but inactive and un-routed.

Ruairi Fullam

Posted 2011-07-03T21:44:07.427

Reputation: 2 284

Would ARP Request from the host owning said interface work? – dario_ramos – 2011-07-03T21:58:43.107

I don't think it would, it doesn't in Windows in any case. – Ruairi Fullam – 2011-07-03T22:10:29.120

3

From ArsTechnica:

Think of a subnet mask as a filter for outbound traffic. The subnet mask helps the IP protocol decide which is local "LAN" traffic and what traffic needs to be forwarded to a router.

In effect a 0.0.0.0 subnet mask would make it so all outbound traffic is 'local' and nothing will ever be forwarded to a router. This configuration should work fine if there is no router (aka Default Gateway) on the network.

If you do need to route you can always add static routes on the house by using the ROUTE ADD command (Windows, other OS's should have the same/similar command).

In this case (with a few edits for brevity). I can add a /0 or 0.0.0.0 netmask to an interface, and it will work on loopback and link-local:

root@host:/tmp# ip addr add 10.0.0.0/0 dev eth0
root@host:/tmp# ip addr show
root@host:/tmp# ip a s
1: lo: <LOOPBACK,UP,LOWER_UP> ...
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> ...
    link/ether fe:dc:ba:98:76:54 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.0/0 scope global eth0
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> ...
    link/ether 01:23:45:67:89:ab brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.5/24 brd 192.168.1.255 scope global wlan0
       valid_lft forever preferred_lft forever
    inet6 fe80::226:c6ff:fe4b:e38e/64 scope link 
       valid_lft forever preferred_lft forever
root@host:/tmp# ping 10.0.0.0
PING 10.0.0.0 (10.0.0.0) 56(84) bytes of data.
64 bytes from 10.0.0.0: icmp_seq=1 ttl=64 time=0.033 ms
64 bytes from 10.0.0.0: icmp_seq=2 ttl=64 time=0.036 ms
^C
--- 10.0.0.0 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.033/0.034/0.036/0.006 ms

glallen

Posted 2011-07-03T21:44:07.427

Reputation: 1 886