IPs , Netmasks and Broadcast.

Jerry McAllister jerrymc at clunix.cl.msu.edu
Thu Sep 15 06:31:22 PDT 2005


> 
> Jerry,
> 
> I apologise. Its late in the day for me and the email addresses are blending 
> into one :-)
> 
> Anyways, so the examples I put together are correct. Good. So I wonder why, 
> the 1 IP I have, won't work with the real netmask, but only with the 255. 
> One more item of note, I see in dmesg that when it tries to apply it, the 
> message:

Look carefully.   I changed one thing in each group.

Also, if you have a block of 128, your main mask would
probably not be 255.255.2555.0.  I think it would be 255.255.255.128.

Anyway, all the aliases for any one NIC card must be 255.255.255.255.

> 
> arplookup xxx.xxx.xxx.xxx failed: host is not on local network

Probably because the ifconfig didn't work right with the wrong
netmasks.


> -Grant
> 
> P.S. This is a small block, only 30 ips. The other 29, including 1 with the 
> real netmask, is on another machine working fine, right beside the machine I 
> am referencing.

You will have to calculate the mask somewhat based on the switch/router
segment you are on.    It is too early for me to think it out.

////jerry

> 
> 
> ----- Original Message ----- 
> From: "Jerry McAllister" <jerrymc at clunix.cl.msu.edu>
> To: <gpeel at thenetnow.com>
> Cc: "John Oxley" <john at yoafrica.com>; <freebsd-questions at freebsd.org>
> Sent: Thursday, September 15, 2005 8:56 AM
> Subject: Re: IPs , Netmasks and Broadcast.
> 
> 
> >>
> >> 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.
> >
> > No, this is not what I said.   I don't know if anyone else has posted
> > on this since then.   But,
> >
> > The next two chunks below represent what I said.
> >
> > ////jerry
> >
> > 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.255"
> > 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.255"
> > 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.255"
> > 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.255"
> > 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 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 at yoafrica.com>
> >> To: "Grant Peel" <gpeel at thenetnow.com>
> >> Cc: <freebsd-questions at 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 at 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 at 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
> >> >
> >> >
> >>
> >>
> >> _______________________________________________
> >> freebsd-questions at freebsd.org mailing list
> >> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> >> To unsubscribe, send any mail to 
> >> "freebsd-questions-unsubscribe at freebsd.org"
> >>
> >
> >
> > 
> 
> 
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
> 



More information about the freebsd-questions mailing list