Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Sep 2005 08:44:46 -0400
From:      "Grant Peel" <gpeel@thenetnow.com>
To:        "John Oxley" <john@yoafrica.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: IPs , Netmasks and Broadcast.
Message-ID:  <002d01c5b9f3$439f9310$6501a8c0@GRANT>
References:  <014f01c5b945$65df9280$6501a8c0@GRANT> <20050915115551.GB7660@yoafrica.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Thanks John,

What you are saying make perfect sense based on what I've had to do in the 
past. Just to clarify ...

Lets say I have 5 machines (which I do)

And lets say I have 10 blocks of IP address from my upline (which I do)

1.1.1.1/24
2.2.2.2/24
3.3.3.3/24
4.4.4.4/24
...

And, lets say that I need to set up various IPs, from each of the groups 
above, on all 5 of the servers.

To keep the explanation easy to follow, I will put what I might have in 
rc.conf for each machine, Leaving out the gateway IPs as they are not 
realevent to the question...my router setting work fine.


Sever 1:

hostname="machine1.mydomain.com"
defaultrouter="some ip here"
ifconfig_em0="inet 1.1.1.2 netmask 255.255.255.0"
ifconfig_em0_alias0="inet 1.1.1.3 netmask 255.255.255.255"
ifconfig_em0_alias1="inet 1.1.1.4 netmask 255.255.255.255"
...
ifconfig_em0_alias2="inet 2.2.2.3 netmask 255.255.255.0"
ifconfig_em0_alias3="inet 2.2.2.4 netmask 255.255.255.255"
ifconfig_em0_alias4="inet 2.2.2.5 netmask 255.255.255.255"
...
ifconfig_em0_alias5="inet 3.3.3.4 netmask 255.255.255.0"
ifconfig_em0_alias6="inet 3.3.3.5 netmask 255.255.255.255"
ifconfig_em0_alias7="inet 3.3.3.6 netmask 255.255.255.255"
...


Sever 2:

hostname="machine2.mydomain.com"
defaultrouter="some ip here"
ifconfig_em0="inet 1.1.1.5 netmask 255.255.255.0"
ifconfig_em0_alias0="inet 1.1.1.6 netmask 255.255.255.255"
ifconfig_em0_alias1="inet 1.1.1.7 netmask 255.255.255.255"
...
ifconfig_em0_alias2="inet 2.2.2.6 netmask 255.255.255.0"
ifconfig_em0_alias3="inet 2.2.2.7 netmask 255.255.255.255"
ifconfig_em0_alias4="inet 2.2.2.8 netmask 255.255.255.255"
...
ifconfig_em0_alias5="inet 3.3.3.7 netmask 255.255.255.0"
ifconfig_em0_alias6="inet 3.3.3.8 netmask 255.255.255.255"
ifconfig_em0_alias7="inet 3.3.3.9 netmask 255.255.255.255"
...

Sever 2:

hostname="machine3.mydomain.com"
defaultrouter="some ip here"
ifconfig_em0="inet 1.1.1.8 netmask 255.255.255.0"
ifconfig_em0_alias0="inet 1.1.1.9 netmask 255.255.255.255"
ifconfig_em0_alias1="inet 1.1.1.10 netmask 255.255.255.255"
...
ifconfig_em0_alias2="inet 2.2.2.9 netmask 255.255.255.0"
ifconfig_em0_alias3="inet 2.2.2.10 netmask 255.255.255.255"
ifconfig_em0_alias4="inet 2.2.2.11 netmask 255.255.255.255"
...
ifconfig_em0_alias5="inet 3.3.3.10 netmask 255.255.255.0"
ifconfig_em0_alias6="inet 3.3.3.11 netmask 255.255.255.255"
ifconfig_em0_alias7="inet 3.3.3.12 netmask 255.255.255.255"
...

Server 3, 4 and 5 similar with repeating patterns.

So the original question was: When setting up an IP from any given block, 
do, or should I, need to use the real netmask that my ISP has assinged me 
(for the first), then, the single host (255) netmask for each of the rest 
(Again, from a specific IP block?

I hope it is because I have hundreds of IPs set up that way.

The reason I ask this question (again) is because I have one IP that does 
not want to work using the above paradigm. That is to say, that it IS the 
only IP from a specific block, on a particular machine, and it won't take 
using the real netmask, it will only work using the 255 netmask.

Sincerly,

-Confused
(Grant).







----- Original Message ----- 
From: "John Oxley" <john@yoafrica.com>
To: "Grant Peel" <gpeel@thenetnow.com>
Cc: <freebsd-questions@freebsd.org>
Sent: Thursday, September 15, 2005 7:55 AM
Subject: Re: IPs , Netmasks and Broadcast.


> On Wed, Sep 14, 2005 at 12:00:12PM -0400, Grant Peel wrote:
>> Now I am really confused.
> First of all install ipcalc NOW.
>
>> Up until this morning I thought I had a good handle on when I need to use
>> the real Netmask and Broadcast.
>>
>> For example, If I have 3 servers, and my upline asigns me a block of 128
>> addresses, for the first ip used (from this block) on each server, I 
>> would
>> need to specify the IP, true netmask and a broadcase. Then, when using 
>> more
>> IPs from that block, I would use a 255.255.255.255 netmask and a 
>> broadcast
>> equal to the IP.
>
> No, a 255.255.255.255 netmask specifies a single host. If your ISP has
> given you 128 IPs, that is a /25 or netmask 255.255.255.128 as shown :
> sysjo@hades:~$ ipcalc 192.168.254.0/25
> Address:   192.168.254.0        11000000.10101000.11111110.0 0000000
> Netmask:   255.255.255.128 = 25 11111111.11111111.11111111.1 0000000
> Wildcard:  0.0.0.127            00000000.00000000.00000000.0 1111111
> =>
> Network:   192.168.254.0/25     11000000.10101000.11111110.0 0000000
> HostMin:   192.168.254.1        11000000.10101000.11111110.0 0000001
> HostMax:   192.168.254.126      11000000.10101000.11111110.0 1111110
> Broadcast: 192.168.254.127      11000000.10101000.11111110.0 1111111
> Hosts/Net: 126                   Class C, Private Internet
>
> So all your machines would have the same network and broadcast, and you
> would make them all use your gateway box as the default route.
>
> As you can see, a 255.255.255.255 netmask (/32) is only one host:
> sysjo@hades:~$ ipcalc 192.168.254.34/32
> Address:   192.168.254.34       11000000.10101000.11111110.00100010
> Netmask:   255.255.255.255 = 32 11111111.11111111.11111111.11111111
> Wildcard:  0.0.0.0              00000000.00000000.00000000.00000000
> =>
> Hostroute: 192.168.254.34       11000000.10101000.11111110.00100010
> Hosts/Net: 1                     Class C, Private Internet
>
>
> What you need to do is use IP calc to see what the network and broadcast
> are and set those, although on FreeBSD 4.X (I think anyway, someone
> correct me if I am wrong) you can just put in your /etc/rc.conf
> ifconfig_bge0="inet 192.168.254.32/25"
> or
> ifconfig_bge0="inet 192.168.254.32 netmask 255.255.255.128"
>
> And FreeBSD will work out the network and broadcast for you.
>
>> Today, I was in this exact position where I was tring to add an (the 
>> first
>> one one THAT machine, from that block) IP from a block that is almost
>> completely used up on another server, and the one I was adding it to 
>> would
>> not take it. When I tried adding it with a 255.255.255.255 netmask, and a
>> broadcast eaqual to the amount of IPs from that block - it worked.
>
> Like I said before, there is only 1 IP in a /32 block, and the broadcast
> will be either a.b.c.127 or a.b.c.255 depending whether you have the
> first or second subnet inside that class C.
>
> Hope this helps
>
> -John
>
> 





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?002d01c5b9f3$439f9310$6501a8c0>