Invalid subnet mask, but host is still ping-able

I have two computers connected together directly with a patch cable.
ifconfig command reveals: "Computer A" INET=10.0.0.1 NETMASK=ffffff00 BROADCAST=10.0.0.255 and "Computer B" INET=10.0.0.2 NETMASK=0xffffff80 (<--not a typo) BROADCAST=10.0.0.127 (<--not a typo)
The subnet masks don't match, but I can still successfully ping one from the other. I'm confused about this. Is this a bug in FreeBSD?

The rc.conf on "Computer A": ifconfig_ue0="inet 10.0.0.1 netmask 255.255.255.0"
The rc.conf on "Computer B": ifconfig_ue0="inet 10.0.0.2 netmask 255.255.255.1"

I deliberately changed "Computer B" netmask to an "invalid" one to see what would happen. I didn't know something this strange would happen. Any ideas? Thanks!
 
The subnet masks don't match, but I can still successfully ping one from the other.
Each is still reachable within their 'faulty' subnet masks, thus will simply do an ARP and be able to speak to each other.
I'm confused about this. Is this a bug in FreeBSD?
Not a bug, it's entirely expected if you understand how hosts find each other on a LAN.

ifconfig command reveals: "Computer A" INET=10.0.0.1 NETMASK=ffffff00 BROADCAST=10.0.0.255 and "Computer B" INET=10.0.0.2 NETMASK=0xffffff80 (<--not a typo) BROADCAST=10.0.0.127 (<--not a typo)
If you give computer A the IP address 10.0.0.128 and keep everything else the same you will find that A can ping B but B can't ping A.
 
If you give computer A the IP address 10.0.0.128 and keep everything else the same you will find that A can ping B but B can't ping A.
I tried that and pinging B from A results in
1 packets transmitted, 0 packets received, 100.0% packet loss
Pinging A from B gives
ping: sendto: No route to host

And I still don't understand why on "Computer B", ifconfig shows the netmask as 0xffffff80 when my rc.conf specifies 255.255.255.1
 
The netmask should not have holes. So the 1 gets left aligned and is then 0x80
Wow! You're absolutely right. I changed the mask to 255.255.255.7 and got a netmask of ffffffe0
I'm trying to study IP networking just as a pastime. I knew a lot of it would be complex, but I didn't expect anything unexpected (like my chosen mask getting auto-changed...)
 
Back
Top