Date: Thu, 15 Sep 2005 13:55:51 +0200 From: John Oxley <john@yoafrica.com> To: Grant Peel <gpeel@thenetnow.com> Cc: freebsd-questions@freebsd.org Subject: Re: IPs , Netmasks and Broadcast. Message-ID: <20050915115551.GB7660@yoafrica.com> In-Reply-To: <014f01c5b945$65df9280$6501a8c0@GRANT> References: <014f01c5b945$65df9280$6501a8c0@GRANT>
next in thread | previous in thread | raw e-mail | index | archive | help
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?20050915115551.GB7660>