Out of range IP address in /var/log/messages

Matthew Seaman m.seaman at infracaninophile.co.uk
Wed Jan 23 22:44:53 PST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Anjang Aki wrote:
> Thank you for your reply.
> Here is ifconfig -a output:
> 
> [root at freebsdsrv] ~ $ ifconfig -a
> fxp0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
>         options=b<RXCSUM,TXCSUM,VLAN_MTU>
>         inet 213.112.195.98 netmask 0xffffffe0 broadcast 213.112.195.127
>         inet 213.112.194.34 netmask 0xffffffff broadcast 213.112.194.255
                                      ^^^^^^^^^^ Here's the problem
>         inet 213.112.194.35 netmask 0xffffffff broadcast 213.112.194.255
>         inet 213.112.194.36 netmask 0xffffffff broadcast 213.112.194.255

[...]
 
> Usable IP range: 213.112.195.98 - 213.112.195.126 and 213.112.194.34 -
> 213.112.194.62

You've actually got two disjoint network ranges here:

% ipcalc 213.112.194.34/27
Address:   213.112.194.34       11010101.01110000.11000010.001 00010
Netmask:   255.255.255.224 = 27 11111111.11111111.11111111.111 00000
Wildcard:  0.0.0.31             00000000.00000000.00000000.000 11111
=>
Network:   213.112.194.32/27    11010101.01110000.11000010.001 00000
HostMin:   213.112.194.33       11010101.01110000.11000010.001 00001
HostMax:   213.112.194.62       11010101.01110000.11000010.001 11110
Broadcast: 213.112.194.63       11010101.01110000.11000010.001 11111
Hosts/Net: 30                    Class C

% ipcalc 213.112.195.98/27
Address:   213.112.195.98       11010101.01110000.11000011.011 00010
Netmask:   255.255.255.224 = 27 11111111.11111111.11111111.111 00000
Wildcard:  0.0.0.31             00000000.00000000.00000000.000 11111
=>
Network:   213.112.195.96/27    11010101.01110000.11000011.011 00000
HostMin:   213.112.195.97       11010101.01110000.11000011.011 00001
HostMax:   213.112.195.126      11010101.01110000.11000011.011 11110
Broadcast: 213.112.195.127      11010101.01110000.11000011.011 11111
Hosts/Net: 30                    Class C

The rule with setting up aliases on FreeBSD is that the first address
used from any netblock must have the correct netmask for the whole block.
Subsequent alias IPs from the same block typically use 0xffffffff as the
netmask -- this certainly used to be mandatory but I think that requirement
was actually dropped fairly recently. 

Anyhow, in order to fix your problem, change the netmask for the 194.34
address in your /etc/rc.conf:

   ifconfig_fxp0_alias0="inet 213.112.194.34 netmask 0xffffffe0"

Note: you don't actually need to supply both netmask and broadcast --
broadcast will be calculated for you automatically. You can also give
the netmask in 'slash notation' like so:

   ifconfig fxp0 inet 213.112.194.34/27 alias 

If this is configured correctly, then you should see routes for both 
213.112.194.34/27 and 213.112.195.98/27 in the output of 'netstat -rn'

	Cheers,

	Matthew

- -- 
Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
                                                  Kent, CT11 9PW
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHmDPe8Mjk52CukIwRCMe4AJsH64LMk3H3HCXCi4xXbo7gUIBuCACbBGbm
I+qdHOSXJcNVHtq4OAbfg0M=
=NiOh
-----END PGP SIGNATURE-----


More information about the freebsd-questions mailing list