Solved Strange IF broadcast address

  • Thread starter Thread starter Deleted member 9563
  • Start date Start date
D

Deleted member 9563

Guest
I have two relatively similar machines which had FreeBSD 10.1-RELEASE installed at about the same time. The output of ifconfig on one looks normal to me. Like this:
Code:
inet 192.168.1.101 netmask 0xffffff00 broadcast 192.168.1.255
I don't understand the other one:
Code:
inet 192.168.1.103 netmask 0xfafafa00 broadcast 197.173.5.255
If I change that in /etc/rc.conf to read the same as the first machine (changing 101 to 103 of course) then it cannot connect to the internet any more.

When I did the installation I put in numbers for a normal static address, but what I see is completely foreign. Can someone explain to me where that netmask of 0xfafafa00 and broadcast of 197.173.5.255 is coming from and why I can't change it?

PS: I see the IP belongs to Hurricane Electric, so perhaps it is coming from my router which I had tried to set up with a tunnel but since abandoned so no such numbers show up in it at this point. In any case, I would like to have control of my network configuration.
 
What does the original ifconfig line from /etc/rc.conf look like for the machine that comes up with that wierd netmask? To me I can't see how it's a valid netmask so I suspect there's something wrong with the way it's been configured in rc.conf, although to be honest I'd expect FreeBSD to reject it. (fafafa00 = 250.250.250.0 which isn't a valid mask)

It's nothing to do with Hurricane Electric though. The netmask defines the size of the network, and the broadcast is always the last address in the range. Most people only really use subnets that are 256 addresses (Class C; x.x.x.0 - x.x.x.255), so always see A.B.C.255 as the broadcast. In your case the incorrect subnet mask has created a subnet where the last IP in the range happens to be 197.173.5.255.

Edit: I've actually just tried it and FreeBSD will happily accept an invalid mask. Very strange.
Code:
# ifconfig em0 alias 192.168.1.103 netmask 250.250.250.0
# ifconfig em0 |grep 103
        inet 192.168.1.103 netmask 0xfafafa00 broadcast 197.173.5.255
 
Technically it's possible to have a non-continuous netmask (a mask that changes from 1s to 0s more than once when read from the left as bits) and it will work if the configuration is done otherwise properly. I just don't see any use case for such netmasks. Note that on IPv6 non-continuous netmasks are forbidden.
 
What does the original ifconfig line from /etc/rc.conf look like for the machine that comes up with that wierd netmask? To me I can't see how it's a valid netmask so I suspect there's something wrong with the way it's been configured in rc.conf, although to be honest I'd expect FreeBSD to reject it. (fafafa00 = 250.250.250.0 which isn't a valid mask)

Minus the irrelevant bits, the /etc/rc.conf looks like this:
Code:
ifconfig_em0="inet 192.168.1.103 netmask 250.250.250.0"
#ifconfig em0="inet 192.168.1.103 netmask 0xffffff00 broadcast 192.168.1.255"
defaultrouter="192.168.1.1"
ifconfig_em0_ipv6="inet6 accept_rtadv"
The commented out line is one I tried (copying the other machine), but which didn't work. The machine is fine online, but I just want to gain some control. It's starting to creep me out. :)
 
I can see that it might 'work', but you're effectively creating a network with holes in the middle of it. I can't see that being a particularly good idea in any circumstance.

No documentation or training material I've ever come across has mentioned that this type of netmask is viable, they only teach that masks should be one of the 'valid' ones (1's followed by 0's in binary). Also of course, there is a lot of technology built on top of CIDR, which has no way of being able to handle these netmasks, so it would only really be of any use internally. It's one of those things that is possible, but that nobody should really ever do in the real world. I'd be a bit concerned if I took over an environment that had networks 'hopping' over each other. (It's an interesting way of getting around the problem where you need to increase the size of a network, but have VPNs or other areas that are stopping you from using a larger contiguous block though.)

I've actually asked on freebsd-net to see what they say about it. I tried the same details on Win8.1 and it rejected the mask as I would expect it to.
 
You want the following config for the IPv4 side:

Code:
ifconfig_em0="inet 192.168.1.103 netmask 255.255.255.0"
defaultrouter="192.168.1.1"
I can't really see a reason why anyone would need to manually specify the broadcast address.

If it doesn't work then there are other problems. First of all make sure you can ping 192.168.1.1.
Note that if you reconfigure em0 manually using ifconfig rather than just rebooting, it will probably delete your default gateway, so you'll need to re-add it.

Code:
# ifconfig em0 192.168.1.103 netmask 255.255.255.0
# route add default 192.168.1.1
 
You want the following config for the IPv4 side:

Code:
ifconfig_em0="inet 192.168.1.103 netmask 255.255.255.0"
defaultrouter="192.168.1.1"
I can't really see a reason why anyone would need to manually specify the broadcast address.
Thank you very much. It all looks fine now. I'm embarassed to say that perhaps I typed 250 instead of 255. Usually I cut/paste when possible, and I'm a careful typist, but my eyes are getting bad - so that's likey it.

All's good now! And what an interesting lesson. :)
 
I just wanted to add that my reference to Hurricane Electric wasn't completely idiotic (but close). This whole thing started for me when I did an online DNS leak test and HE came up as one nameserver. I realize now that it is because I have 2002:a1e:b23:1::1 (which belongs to them) in the /etc/resolv.conf.
 
I just wanted to add that my reference to Hurricane Electric wasn't completely idiotic (but close). This whole thing started for me when I did an online DNS leak test and HE came up as one nameserver. I realize now that it is because I have 2002:a1e:b23:1::1 (which belongs to them) in the /etc/resolv.conf.

Ah, to be honest I didn't bother checking, but I assumed you'd looked up the owner of 197.173.5.255 and it had come up as them.
 
Back
Top