Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Fixing a stubborn netmask setting Network
When I was reconfiguring the IP address on my OS X box to move from one network to another, I noticed that my netmask was 255.255.255.1 instead of 255.255.255.0. I hadn't noticed any problems before. But every time I tried to change it to 255.255.255.0, it would go back to 255.255.255.1 when I hit the Apply button. Everything seems to work still, except I couldn't log into my .1 router even though I can ping it.

To my surprise, when I changed the netmask to 255.255.254.0, the Mac accepted the change. And now when I changed it to the correct 255.255.255.0 netmask, it stayed!

This was one of the more bizarre network strangeness I've seen. Hopefully, the hint will save some headaches out there. Note: I'm running OS X Server 10.2.6. Don't know if the anomaly has been seen elsewhere.

[robg adds: If anyone has any thoughts on what might cause this problem, please post them!]

    •    
  • Currently 2.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (4 votes cast)
 
[8,231 views]  

Fixing a stubborn netmask setting | 5 comments | Create New Account
Click here to return to the 'Fixing a stubborn netmask setting' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Fixing a stubborn netmask setting
Authored by: Numbski on Jun 03, '03 11:58:23AM
Okay, a little lesson in IP networking.

Those netmask numbers are really bits. Each of the 4 octets has 8 bits. Each one goes like so:

128     64     32     16     8     4     2     1
 0       0      0      0     0     0     0     0
Now, for the first example, let's look at your last octet. You had a .1, so the only bit you had turned on was the last one.
0     0     0     0     0     0     0     1
Now, that would be cool if it were an IP address, but netmasks are different. You're specifying at what point you're going to start paying attention to the address as yours, because you're doing a variable length subnet. (Uh...layman's terms......might be instead of specifying what state you're in, or what town you're in, or even what street you're on, you're giving an exact house number. I could tell you I live at 211, but what 211? You don't know without the other info, but if you're already at the right street, in the right city, in the right state, all you care about is 211. That's what the netmask is for.)

So we have this:

State.City.Street.Number

or, in network-ese

Network.Network.Network.Host

That's called a class C. In our above example, that give you all bits turned on in the first three octets. 8+8+8, a /24. Or if you add the values of those bits together, 255.255.255.0.

Okay, so what happens if you want to split your street up into blocks? I want to be able to talk to everyone else on my block, but not everyone on the street, because the guys three blocks down are morons. :P Well, then you a varlable length subnet. You start stealing host bits (bits that belong to the hosts...the computers on your network) and give them to the network so that you can further segment things. The last octet looks like this without the variable length subnet:

|  H       H      H      H     H     H     H     H
| 128     64     32     16     8     4     2     1
|  0       0      0      0     0     0     0     0
Well, okay, so we want to let just the guys on my block talk to one another. There's 10 guys on each block that want to talk to one another, so we need to solve for this equation:

H stands for host bits

2^H >= 10
2^3 >= 10
16 >= 10

Okay, so we need 3 host bits to service my block, the rest go to the network:

 N       N      N      N     N  |  H     H     H
128     64     32     16     8  |  4     2     1
 1       1      1      1     1  |  0     0     0
That gives us a last octet of 128+64+32+16+8, or 255.255.255.248, or 8+8+8+5, /29.

In your situation you have 255.255.255.1. Looking above where our network/host split happen...that's not possible. You can't have a .1 as a netmask. The 'smallest' number you can have in a non-zero octet is 128, because that's the first bit to get turned on. More than likely you were pinging yourself, not your router. Why on earth OS X's IP stack did that to you I don't know, but I suspect had you pinged your router, then did an arp -a, the hardware (mac) address for your router would have been the same as your NIC's.

Okay, you can all go take your CCNA's. Hope you pass. ;)

[ Reply to This | # ]

Fixing a stubborn netmask setting
Authored by: denty on Jun 03, '03 06:46:20PM

A netmask like the above would tend to deny access to every other host on your local LAN - although would be very dependent upon the implementation of the IP stack.

The reason is that the netmask uses bitwise AND to determine whether an address is local or not. To use C notation, if (target_address & netmask) == (interface_address & netmask) then the address is local. Otherwise not.

Of course, that doesn't help work out why things are the way they are.



[ Reply to This | # ]
Fixing a stubborn netmask setting
Authored by: MacMuse26 on Jun 04, '03 09:52:49PM

Most likely this is minor bug in the GUI where you set the mask.

Changing the last octect 'x.x.x.1' didn't actually result in a change behind the scenes. The code probably stopped processing when it reached the first zero in the last octet (see the binary explanation above).

By changing an earlier number in the mask (255 to 254) finally forced the entire field to be completely rewritten, and thereby fixed the problem.



[ Reply to This | # ]
Fixing a stubborn netmask setting
Authored by: LouieNet on Jun 08, '03 03:17:39PM
I agree that it's likely a bug in the GUI. If I ever come across this again, I think I would have a look at the ifconfig -a output, and see if I can fix it there.

P.S. I'm a network engineer by trade, so imagine my surprise when I saw 255.255.255.1 for a netmask.

---
G4 cube, 1152M RAM, OS X Server 10.2.6

[ Reply to This | # ]

Fixing a stubborn netmask setting
Authored by: LouieNet on Jun 08, '03 03:40:51PM
Numbski wrote:
Network.Network.Network.Host

That's called a class C. In our above example, that give you all bits turned on in the first three octets. 8+8+8, a /24. Or if you add the values of those bits together, 255.255.255.0.

Okay, you can all go take your CCNA's. Hope you pass. ;)

Does the CCNA test ask the difference between "/24" and "class C"? :)

For clarification, all class C addresses are defined to fall in the IP address range 192.0.0.0 - 223.255.255.255. Networks that use class C addresses should use a /24 netmask (255.255.255.0).

In contrast, not all /24 networks need to fall in class C address space. Class A (1.0.0.0 - 126.255.255.255) and class B (128.0.0.0 - 191.255.255.255) addresses can be subnetted using /24 netmasks if the network equipment supports CIDR. (And if your gear doesn't do CIDR, try to sell it! :)

Apple's corporate network would have melted by now if they haven't subnetted their class A.

---
G4 cube, 1152M RAM, OS X Server 10.2.6

[ Reply to This | # ]