Re: netmask question

2023-05-26 Thread Andy Smith
Hello,

On Fri, May 26, 2023 at 09:07:23PM -0400, Greg Wooledge wrote:
> On Sat, May 27, 2023 at 12:59:59AM +, Andy Smith wrote:
> > On Mon, May 22, 2023 at 08:26:47PM -0400, Dan Ritter wrote:
> > > No. What's the netmask if you have:
> > > 
> > > IP: 192.168.255.132
> > > broadcast: 192.168.255.255 ?
> > 
> > It's 255.255.0.0.
> > 
> > Specifying a broadcast address does completely define the network
> > range. If you know that 192.168.255.255 is the broadcast then the
> > network can only be 192.168.0.0/16.
> 
> Dan's example was carefully chosen so that this is not true.  The last
> 16 bits of the broadcast address are all 1.  This means the network
> part of the address could be anywhere from 16 to 31 bits.  All are
> equally possible.

Yes, sorry, of course you (and Dan) are correct. There is no reason
why it could not be describing, for example, 192.168.255.0/24
(255.255.255.0 netmask). That will teach me to not write emails at
2am!

Cheers,
Andy

-- 
https://bitfolk.com/ -- No-nonsense VPS hosting



Re: netmask question

2023-05-26 Thread Greg Wooledge
On Sat, May 27, 2023 at 12:59:59AM +, Andy Smith wrote:
> On Mon, May 22, 2023 at 08:26:47PM -0400, Dan Ritter wrote:
> > No. What's the netmask if you have:
> > 
> > IP: 192.168.255.132
> > broadcast: 192.168.255.255 ?
> 
> It's 255.255.0.0.
> 
> Specifying a broadcast address does completely define the network
> range. If you know that 192.168.255.255 is the broadcast then the
> network can only be 192.168.0.0/16.

Dan's example was carefully chosen so that this is not true.  The last
16 bits of the broadcast address are all 1.  This means the network
part of the address could be anywhere from 16 to 31 bits.  All are
equally possible.



Re: netmask question

2023-05-26 Thread Andy Smith
Hello,

On Mon, May 22, 2023 at 08:26:47PM -0400, Dan Ritter wrote:
> Tom Reed wrote: 
> > If I know the network addr:  192.168.1.0
> > And know the broadcast addr: 192.168.1.255
> > Then I should have the possibility to cal the netmask addr: 255.255.255.0
> > 
> > Isn't it?
> 
> No. What's the netmask if you have:
> 
> IP: 192.168.255.132
> broadcast: 192.168.255.255 ?

It's 255.255.0.0.

Specifying a broadcast address does completely define the network
range. If you know that 192.168.255.255 is the broadcast then the
network can only be 192.168.0.0/16.

You do not need to know even the network address; it's implied.
Since the broadcast is the all-ones address, change them to all
zeroes and that's your network address. So if your KNOW your
broadcast address is 192.168.255.255 then you ALSO KNOW that your
network address is 192.168.0.0/16 because there are 16 bits of 1s
there.

The reverse is not true: if you KNOW the network address is
192.168.0.0 but NOT the prefix/networks (how many 1s there are) then
you do not know where the broadcast address is. It could easily be:

192.168.0.0/31 = 192.168.0.0 → 192.168.0.1 no broadcast
192.168.0.0/30 = 192.168.0.0 → 192.168.0.2 broadcast 192.168.0.3
192.168.0.0/29 = 192.168.0.0 → 192.168.0.4 broadcast 192.168.0.5
.
.
192.168.0.0/24 = 192.168.0.0 → 192.168.0.254 broadcast 192.168.0.155
.
.
192.168.0.0/21 = 192.168.0.0 → 192.168.7.254 broadcast 192.168.7.255
.
.
192.168.0.0/16 = 192.168.0.0 → 192.168.255.254 broadcast 192.168.255.255

…and so on. Without the netmask or prefix you don't know where it
ends, but given a broadcast address then you DO know the netmask and
can work it out.

If given just an address and not told whether it is a broadcast
address or not then you are correct - you can't tell. If the only
information you have is "192.168.0.255" then you don't know if that
is a host address in a network bigger than /24. e.g. 192.168.0.0/23
goes from 192.168.0.0 → 192.168.1.255 and there, 192.168.0.255 would
just be another usable host address. But if you are told that
192.168.0.255 is definitely the broadcast, then this has completely
defined the rest.

Generally in this day and age we would be better off sticking to
prefix lengths not netmasks, i.e. "/24" not "255.255.255.0". And
those who have said this is backwards do have a point - you would
not normally start by specifying the broadcast address since
normally what is important to you is how many addresses are needed.
The netmask and broadcast addresses follow from that. But it's just
maths and it works both ways.

Also as regards /32 addresses, they are normally used for point to
point interfaces such as PPP, VPNs or virtual Ethernets, where every
packet you send that is not destined for yourself will always just
hit the other end of the link. While you CAN use any prefix, if it
is a point-to-point link with no need to directly interact with the
other end device then it is a waste to use anything but a /32. Such
links do not have a broadcast domain; they do not have or need a
network or broadcast address and as they accept every packet that
isn't addressed to itself they only need 1 address.

Here is an example of a real PPP interface I have here (IPs changed
however):

# ip -4 addr show dev ppp0
20: ppp0:  mtu 1492 qdisc pfifo_fast 
state UNKNOWN qlen 3
inet 192.168.218.242 peer 81.187.81.187/32 scope global ppp0
# ip -4 ro show default
default dev ppp0  scope link

As you can see, the interface does not have a prefix because it's
not got a broadcast domain. There is no such concept as a broadcast
or network address here in this situation. The other end is
81.187.81.187/32 regardless. Every packet not destined for
192.168.218.242 obeys the default route, which is to an interface
(ppp0) not to an IP.

This could have been done with a /31 but that would have wasted a
lot of IPs: There'd be one for the customer and its pair at the ISP
end, instead of the /32 situation where the ISP end is the same for
all customers at that location. It could have been done with a /30
but that would have been even worse: it would burn 4 IPs per
customer for no useful reason. It could be done with any other valid
network and would waste more and more IPs the bigger the network is,
but it would still work.

There is still some legacy equipment that doesn't support /31s on
networks with only two devices despite RFC 3021 being more than 20
years old now.

Cheers,
Andy

-- 
https://bitfolk.com/ -- No-nonsense VPS hosting



Re: netmask question

2023-05-23 Thread Dan Purgert
On May 23, 2023, debian-u...@howorth.org.uk wrote:
> Dan Purgert  wrote:
> > On May 22, 2023, gene heskett wrote:
> > > I don't see it, 255 is all 8 bits set, 256 is all 8 bits cleared
> > > and carry set.  
> > 
> > In "natural counting", 2^8 is 256.  (1, 2, 3, 4, ... , 256).
> 
> In any counting, 2^8 is 256. "2^8 is 256" is just a way of saying in
> English the same as the assertion "2^8 == 256" in a programming
> language. They are exactly the same statement. And they are true.
> That's all Tomas was saying.

I explicitly mentioned natural counting, since we don't order objects
from zero (e.g. objects on a table are counted as  "1,2,3,4,5", not
"0,1,2,3,4").  You still get 256 total values in binary counting, it's
just that the set of values is offset by a count of one from the
position where they fall in the set.  

That is, the value of "zero" is at the "first position" (likewise, the
value 255 is at the 256th position).
 
> And yes you need 9 bits in binary to say it.

You only need 9 bits if you want to display some (decimal) value that
would fit in the 257th - 512th position of a computer's zero-based
counting system (i.e. 256-511).

-- 
|_|O|_|
|_|_|O| Github: https://github.com/dpurgert
|O|O|O| PGP: DDAB 23FB 19FA 7D85 1CC1  E067 6D65 70E5 4CE7 2860


signature.asc
Description: PGP signature


Re: netmask question

2023-05-23 Thread debian-user
Dan Purgert  wrote:
> On May 22, 2023, gene heskett wrote:
> > On 5/22/23 15:04, to...@tuxteam.de wrote:  
> > > On Mon, May 22, 2023 at 12:16:09PM -0400, gene heskett wrote:  
> > > > On 5/22/23 03:32, Tim Woodall wrote:  
> > > > > On Mon, 22 May 2023, to...@tuxteam.de wrote:
> > > > > 
> > > > >    number; for (human) display it is subdivided into four 8
> > > > > bit chunks  
> > > > > > (called "octets" for obvious reasons), and those octets
> > > > > > only can go from 0 to 255 (since 2^8 == 255).
> > > > > >   
> > > > > Nit, but 2^8 is 256.
> > > > > 
> > > > > .  
> > > > The octets count from base 0 Tim.  
> > > 
> > > That's right, but then they go 0 .. 2^8 - 1. 2^8 is still 256,
> > > Tim does have a point there :-)
> > >   
> > I don't see it, 255 is all 8 bits set, 256 is all 8 bits cleared
> > and carry set.  
> 
> In "natural counting", 2^8 is 256.  (1, 2, 3, 4, ... , 256).

In any counting, 2^8 is 256. "2^8 is 256" is just a way of saying in
English the same as the assertion "2^8 == 256" in a programming
language. They are exactly the same statement. And they are true.
That's all Tomas was saying.

And yes you need 9 bits in binary to say it.

> However, you're correct in that the 256 possible values for an 8-bit
> number in computing are 0-255. (i.e. 0 to (2^8)-1)



Re: netmask question

2023-05-23 Thread Tim Woodall

On Tue, 23 May 2023, Tom Reed wrote:





On Tue, May 23, 2023 at 08:24:10AM +0800, Tom Reed wrote:

Sorry for my newbie question too.

If I know the network addr:  192.168.1.0
And know the broadcast addr: 192.168.1.255
Then I should have the possibility to cal the netmask addr:
255.255.255.0

Isn't it?


Not necessarily.  PROBABLY yes, but you can't be certain.

The netmask in this example could be either /23 or /24.

Why are you asking these questions?  What's your ACTUAL issue?



IIRC, last year my ISP gives me 8 IPv4, they said the first is network
addr, the last is broadcast addr, then I have to calculate the netmask by
myself.

regards.



It's almost certain that you could actually use all 8 addresses assuming
that the reason for having them is to allow routing to/from the
internet and you were connecting via ppp.

I had a static /30 but could use all four addresses for hosting. Once it
reached my ISP (via a /32 ppp address :-) ) it was part of a larger
block.

What I did was pretend I had a /28 - which meant if any of those
'hijacked' addresses around mine tried to connect they'd get no response. If you
don't want to risk that then you can NAT the addresses into the middle
of a rfc1918 range.

That won't work if one of the addresses is the isp's router.



Re: netmask question

2023-05-22 Thread tomas
On Mon, May 22, 2023 at 07:48:46PM -0400, gene heskett wrote:
> On 5/22/23 15:04, to...@tuxteam.de wrote:

[...]

> > That's right, but then they go 0 .. 2^8 - 1. 2^8 is still 256, Tim does
> > have a point there :-)
> > 
> I don't see it, 255 is all 8 bits set, 256 is all 8 bits cleared and carry
> set.

You cheated: that's 9 bits :)

Cheers
-- 
t


signature.asc
Description: PGP signature


Re: netmask question

2023-05-22 Thread tomas
On Mon, May 22, 2023 at 08:26:47PM -0400, Dan Ritter wrote:
> Tom Reed wrote: 
> > 
> > 
> > 
> > If I know the network addr:  192.168.1.0
> > And know the broadcast addr: 192.168.1.255
> > Then I should have the possibility to cal the netmask addr: 255.255.255.0
> > 
> > Isn't it?
> 
> 
> No. What's the netmask if you have:
> 
> IP: 192.168.255.132
> broadcast: 192.168.255.255 ?

See my other post: I think Tom means the "subnet address", which
by convention is the "subnet address" in the sense of [1].

I don't know whether there is an accepted RFC for that, but it
seems to be current practice (there are proposals to get rid of
that one [2], which actually doesn't make any sense, but IPv6
would be the better way to go anyway :)

I see Greg and you interpreted Tom's "net addr" as "the internet
address of the host in question". I think it's meant as the
"subnet address" in the sense of [1]. It seems a relic from BSD,
which seems to have used it /also/ as broadcast. These days it
is a disfunctional appendage mainly used to torture networking
students, but it's there with a big sign "DON'T STEP ON IT" ;-)

Cheers

[1] https://en.wikipedia.org/wiki/IPv4#First_and_last_subnet_addresses
[2] https://www.ietf.org/archive/id/draft-intarea-schoen-lowest-address-00.html
-- 
t


signature.asc
Description: PGP signature


Re: netmask question

2023-05-22 Thread tomas
On Mon, May 22, 2023 at 08:08:26PM -0400, Greg Wooledge wrote:
> On Tue, May 23, 2023 at 07:39:21AM +0800, Tom Reed wrote:
> > For a given ipv4, if I know net addr and broadcast addr, how will I
> > calculate the netmask?
> 
> I hope this is a theoretical question, because this is backwards.
> Normally you would specify the IP address and the netmask, and the
> software would calculate a broadcast address for you.
> 
> The question you asked has no unique solution in the general case.
> Consider that you have the IPv4 address 10.0.255.42 and the broadcast
> address 10.0.255.255.
> 
> Now, the netmask *could* be /24.  That would make 10.0.255.* the network
> address, and setting all the non-network bits to 1 gives you the
> broadcast address 10.0.255.255.
> 
> But the netmask could also be /22.  That would make the network
> address range 10.0.252.0 through 10.0.255.255.
> 
> In fact, the netmask could be anything from /17 to /24 inclusive.  You
> can't deduce it from the available information.
> 
> That's why you specify the netmask up front.  You have to know it.

Unless... Tom's "net addr" was meant to be "network address", which
(first by convention, now by RFC) has all zeros for the host part.

In that case, it's easy: from the network address to the broadcast
address, exactly the host bit parts change (from 0 to 1), so

   = NOT (  XOR )

with the customary bitwise operators NOT and XOR.

Only Tom knows now :)

Cheers
-- 
t


signature.asc
Description: PGP signature


Re: netmask question

2023-05-22 Thread Dan Ritter
> > Why are you asking these questions?  What's your ACTUAL issue?
> >
> 
> IIRC, last year my ISP gives me 8 IPv4, they said the first is network
> addr, the last is broadcast addr, then I have to calculate the netmask by
> myself.


Well, they told you the additional necessary information: 8
addresses.

2^3 = 8
32 - 3 = 29
They gave you a /29.
The netmask is 255.255.255.248

The package you want to install is sipcalc:

$ sipcalc 123.234.22.1/29

-[ipv4 : 123.234.22.1/29] - 0

[CIDR]
Host address- 123.234.22.1
Host address (decimal)  - 2078938625
Host address (hex)  - 7BEA1601
Network address - 123.234.22.0
Network mask- 255.255.255.248
Network mask (bits) - 29
Network mask (hex)  - FFF8
Broadcast address   - 123.234.22.7
Cisco wildcard  - 0.0.0.7
Addresses in network- 8
Network range   - 123.234.22.0 - 123.234.22.7
Usable range- 123.234.22.1 - 123.234.22.6


-dsr-



Re: netmask question

2023-05-22 Thread Dan Purgert
On May 22, 2023, gene heskett wrote:
> On 5/22/23 15:04, to...@tuxteam.de wrote:
> > On Mon, May 22, 2023 at 12:16:09PM -0400, gene heskett wrote:
> > > On 5/22/23 03:32, Tim Woodall wrote:
> > > > On Mon, 22 May 2023, to...@tuxteam.de wrote:
> > > > 
> > > >    number; for (human) display it is subdivided into four 8 bit chunks
> > > > > (called "octets" for obvious reasons), and those octets only can
> > > > > go from 0 to 255 (since 2^8 == 255).
> > > > > 
> > > > Nit, but 2^8 is 256.
> > > > 
> > > > .
> > > The octets count from base 0 Tim.
> > 
> > That's right, but then they go 0 .. 2^8 - 1. 2^8 is still 256, Tim does
> > have a point there :-)
> > 
> I don't see it, 255 is all 8 bits set, 256 is all 8 bits cleared and carry
> set.

In "natural counting", 2^8 is 256.  (1, 2, 3, 4, ... , 256).

However, you're correct in that the 256 possible values for an 8-bit
number in computing are 0-255. (i.e. 0 to (2^8)-1)

-- 
|_|O|_|
|_|_|O| Github: https://github.com/dpurgert
|O|O|O| PGP: DDAB 23FB 19FA 7D85 1CC1  E067 6D65 70E5 4CE7 2860


signature.asc
Description: PGP signature


Re: netmask question

2023-05-22 Thread Tom Reed



> On Tue, May 23, 2023 at 08:24:10AM +0800, Tom Reed wrote:
>> Sorry for my newbie question too.
>>
>> If I know the network addr:  192.168.1.0
>> And know the broadcast addr: 192.168.1.255
>> Then I should have the possibility to cal the netmask addr:
>> 255.255.255.0
>>
>> Isn't it?
>
> Not necessarily.  PROBABLY yes, but you can't be certain.
>
> The netmask in this example could be either /23 or /24.
>
> Why are you asking these questions?  What's your ACTUAL issue?
>

IIRC, last year my ISP gives me 8 IPv4, they said the first is network
addr, the last is broadcast addr, then I have to calculate the netmask by
myself.

regards.



-- 
sent from https://dkinbox.com/



Re: netmask question

2023-05-22 Thread Timothy M Butterworth
On Mon, May 22, 2023 at 8:24 PM Tom Reed  wrote:

>
>
> > Tom Reed wrote:
> >>
> >> >
> >> > That's right, but then they go 0 .. 2^8 - 1. 2^8 is still 256, Tim
> >> does
> >> > have a point there :-)
> >> >
> >>
> >> For a given ipv4, if I know net addr and broadcast addr, how will I
> >> calculate the netmask?
> >
> >
> > You can't.
> >
>
> Hello
>
> Sorry for my newbie question too.
>
> If I know the network addr:  192.168.1.0
> And know the broadcast addr: 192.168.1.255
> Then I should have the possibility to cal the netmask addr: 255.255.255.0
>
> Isn't it?
>

That is correct.



>
> --
> sent from https://dkinbox.com/
>
>

-- 
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org/
⠈⠳⣄⠀⠀


Re: netmask question

2023-05-22 Thread Greg Wooledge
On Tue, May 23, 2023 at 08:24:10AM +0800, Tom Reed wrote:
> Sorry for my newbie question too.
> 
> If I know the network addr:  192.168.1.0
> And know the broadcast addr: 192.168.1.255
> Then I should have the possibility to cal the netmask addr: 255.255.255.0
> 
> Isn't it?

Not necessarily.  PROBABLY yes, but you can't be certain.

The netmask in this example could be either /23 or /24.

Why are you asking these questions?  What's your ACTUAL issue?



Re: netmask question

2023-05-22 Thread Dan Ritter
Tom Reed wrote: 
> 
> 
> 
> If I know the network addr:  192.168.1.0
> And know the broadcast addr: 192.168.1.255
> Then I should have the possibility to cal the netmask addr: 255.255.255.0
> 
> Isn't it?


No. What's the netmask if you have:

IP: 192.168.255.132
broadcast: 192.168.255.255 ?

-dsr-



Re: netmask question

2023-05-22 Thread Dan Ritter
Tom Reed wrote: 
> 
> >
> > That's right, but then they go 0 .. 2^8 - 1. 2^8 is still 256, Tim does
> > have a point there :-)
> >
> 
> For a given ipv4, if I know net addr and broadcast addr, how will I
> calculate the netmask?


You can't.

You can assume that the broadcast address is the last usable
address in the subnet, but it's not unique.

The router sets the addressable area. Without knowledge of that,
you can't tell the difference between 10.3.255.243 being in a
/16, a /24, a /26...

In most networks, the router will tell you the information on
request via DHCP. In most IPv6 networks, the router will either
have DHCP or SLAAC (router solicitation/router advertisement_ available.

But most is not all.

-dsr-



Re: netmask question

2023-05-22 Thread Tom Reed



> Tom Reed wrote:
>>
>> >
>> > That's right, but then they go 0 .. 2^8 - 1. 2^8 is still 256, Tim
>> does
>> > have a point there :-)
>> >
>>
>> For a given ipv4, if I know net addr and broadcast addr, how will I
>> calculate the netmask?
>
>
> You can't.
>

Hello

Sorry for my newbie question too.

If I know the network addr:  192.168.1.0
And know the broadcast addr: 192.168.1.255
Then I should have the possibility to cal the netmask addr: 255.255.255.0

Isn't it?


-- 
sent from https://dkinbox.com/



Re: netmask question

2023-05-22 Thread Timothy Butterworth


On May 22, 2023, at 8:08 PM, Greg Wooledge  wrote:

>On Tue, May 23, 2023 at 07:39:21AM +0800, Tom Reed wrote:
>> For a given ipv4, if I know net addr and broadcast addr, how will I
>> calculate the netmask?
>I hope this is a theoretical question, because this is backwards.
>Normally you would specify the IP address and the netmask, and the
>software would calculate a broadcast address for you.
>The question you asked has no unique solution in the general case.
>Consider that you have the IPv4 address 10.0.255.42 and the broadcast
>address 10.0.255.255.
>Now, the netmask *could* be /24.  That would make 10.0.255.* the network
>address, and setting all the non-network bits to 1 gives you the
>broadcast address 10.0.255.255.
>But the netmask could also be /22.  That would make the network
>address range 10.0.252.0 through 10.0.255.255.

The network address is 10.0.252.0, the first address. The broadcast address is 
10.0.252.255, the last address. The host addresses are 10.0.252.1 - 254.

>In fact, the netmask could be anything from /17 to /24 inclusive.  You
>can't deduce it from the available information.
>That's why you specify the netmask up front.  You have to know it.


Re: netmask question

2023-05-22 Thread Greg Wooledge
On Tue, May 23, 2023 at 07:39:21AM +0800, Tom Reed wrote:
> For a given ipv4, if I know net addr and broadcast addr, how will I
> calculate the netmask?

I hope this is a theoretical question, because this is backwards.
Normally you would specify the IP address and the netmask, and the
software would calculate a broadcast address for you.

The question you asked has no unique solution in the general case.
Consider that you have the IPv4 address 10.0.255.42 and the broadcast
address 10.0.255.255.

Now, the netmask *could* be /24.  That would make 10.0.255.* the network
address, and setting all the non-network bits to 1 gives you the
broadcast address 10.0.255.255.

But the netmask could also be /22.  That would make the network
address range 10.0.252.0 through 10.0.255.255.

In fact, the netmask could be anything from /17 to /24 inclusive.  You
can't deduce it from the available information.

That's why you specify the netmask up front.  You have to know it.



Re: netmask question

2023-05-22 Thread gene heskett

On 5/22/23 15:04, to...@tuxteam.de wrote:

On Mon, May 22, 2023 at 12:16:09PM -0400, gene heskett wrote:

On 5/22/23 03:32, Tim Woodall wrote:

On Mon, 22 May 2023, to...@tuxteam.de wrote:

   number; for (human) display it is subdivided into four 8 bit chunks

(called "octets" for obvious reasons), and those octets only can
go from 0 to 255 (since 2^8 == 255).


Nit, but 2^8 is 256.

.

The octets count from base 0 Tim.


That's right, but then they go 0 .. 2^8 - 1. 2^8 is still 256, Tim does
have a point there :-)

I don't see it, 255 is all 8 bits set, 256 is all 8 bits cleared and 
carry set.



Cheers


Cheers, Gene Heskett.
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page 



Re: netmask question

2023-05-22 Thread Tom Reed


>
> That's right, but then they go 0 .. 2^8 - 1. 2^8 is still 256, Tim does
> have a point there :-)
>

For a given ipv4, if I know net addr and broadcast addr, how will I
calculate the netmask?


-- 
sent from https://dkinbox.com/



Re: netmask question

2023-05-22 Thread tomas
On Mon, May 22, 2023 at 12:16:09PM -0400, gene heskett wrote:
> On 5/22/23 03:32, Tim Woodall wrote:
> > On Mon, 22 May 2023, to...@tuxteam.de wrote:
> > 
> >   number; for (human) display it is subdivided into four 8 bit chunks
> > > (called "octets" for obvious reasons), and those octets only can
> > > go from 0 to 255 (since 2^8 == 255).
> > > 
> > Nit, but 2^8 is 256.
> > 
> > .
> The octets count from base 0 Tim.

That's right, but then they go 0 .. 2^8 - 1. 2^8 is still 256, Tim does
have a point there :-)

Cheers
-- 
t


signature.asc
Description: PGP signature


Re: netmask question

2023-05-22 Thread gene heskett

On 5/22/23 03:32, Tim Woodall wrote:

On Mon, 22 May 2023, to...@tuxteam.de wrote:

  number; for (human) display it is subdivided into four 8 bit chunks

(called "octets" for obvious reasons), and those octets only can
go from 0 to 255 (since 2^8 == 255).


Nit, but 2^8 is 256.

.

The octets count from base 0 Tim.

Cheers, Gene Heskett.
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page 



Re: netmask question

2023-05-22 Thread tomas
On Mon, May 22, 2023 at 06:11:50AM -0400, Timothy M Butterworth wrote:

[...]

> Point-to-point links should have  a mask of 255.255.255.252. This provides
> a Network, Broadcast and two host addresses.

In practice, I've seen both: /30 and /31. Wikipedia [1] quotes RFC3021,
which states /31 for that case:

  "As a special case, a /31 network has capacity for just two hosts.
   These networks are typically used for point-to-point connections.
   There is no network identifier or broadcast address for these
   networks"

Cheers

[1] 
https://en.wikipedia.org/wiki/Internet_Protocol_Version_4#First_and_last_subnet_addresses

-- 
t


signature.asc
Description: PGP signature


Re: netmask question

2023-05-22 Thread Dan Ritter
cor...@free.fr wrote: 
> On 22/05/2023 11:08, Tim Woodall wrote:
> > On Mon, 22 May 2023, cor...@free.fr wrote:
> > > In CIDR a host address is xx.xx.xx.xx/32 which means 255.255.255.255.
> > > isn't it?
> > > 
> > 
> > It depends on what question you're asking.
> > 
> > An individual address is a /32, but a host address might be listed as a
> > /24 for example. This means there are 256 addresses that can be reached
> > without routing.
> 
> I see. thanks.
> In some use cases my configuration requires a host address with /32 for
> CIDR. such as postscreen whitelist stuff.
> 
> I know 192.168.1.0/24 means a C class.
> But 192.168.1.100/24 means what? C class or that separated address
> 192.168.1.100?



The C in CIDR stands for Classless; the Class system went away,
even though people still routinely (and slightly incorrectly)
talk about any /24 as a class C.

192.168.1.100/24 either means:

one IP, 192.168.1.100, with a /24 network mask to define the
network

or

the entirety of 192.168.1.*, but badly specified.

The first meaning is more usual.

-dsr-



Re: netmask question

2023-05-22 Thread Timothy M Butterworth
On Mon, May 22, 2023 at 6:12 AM  wrote:

> On 22/05/2023 11:08, Tim Woodall wrote:
> > On Mon, 22 May 2023, cor...@free.fr wrote:
> >
>
> >>
> >> Hello,
> >>
> >> In CIDR a host address is xx.xx.xx.xx/32 which means 255.255.255.255.
> >> isn't it?
> >>
> >
> > It depends on what question you're asking.
> >
> > An individual address is a /32, but a host address might be listed as a
> > /24 for example. This means there are 256 addresses that can be reached
> > without routing.
>
> I see. thanks.
> In some use cases my configuration requires a host address with /32 for
> CIDR. such as postscreen whitelist stuff.
>
> I know 192.168.1.0/24 means a C class.
> But 192.168.1.100/24 means what? C class or that separated address
> 192.168.1.100?
>

192.168.1.0/24 is the class C network address and 192.168.1.100/24 is the
class C host address. /24 is class C, /8 is Class A, /16 is Class B.


> kind regards
> Corey
>
>

-- 
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org/
⠈⠳⣄⠀⠀


Re: netmask question

2023-05-22 Thread Tim Woodall

On Mon, 22 May 2023, Timothy M Butterworth wrote:


On Mon, May 22, 2023 at 3:41?AM Tim Woodall 
wrote:


On Sun, 21 May 2023, Timothy M Butterworth wrote:


The only address that should have a netmask of 255.255.255.255 is the
Loopback interface.



I don't much use ipv4 any more if I can avoid it but isn't it normal for
point-to-point links to have a netmask of 255.255.255.255?



Point-to-point links should have  a mask of 255.255.255.252. This provides
a Network, Broadcast and two host addresses.


Why? I'm not saying you cannot do this but I don't see what possible
advantage it offers.

The two cases I see are that you want the individual clients connecting
via p-t-p links to be able to talk in which case you probably want
something bigger than a /30 or you don't in which case a /32 is all you
need.




Re: netmask question

2023-05-22 Thread Timothy M Butterworth
On Mon, May 22, 2023 at 3:32 AM Tim Woodall 
wrote:

> On Mon, 22 May 2023, to...@tuxteam.de wrote:
>
>   number; for (human) display it is subdivided into four 8 bit chunks
> > (called "octets" for obvious reasons), and those octets only can
> > go from 0 to 255 (since 2^8 == 255).
> >
> Nit, but 2^8 is 256.
>

In binary the first address is 0 which is all bits off. In a /24 network
the .0 is reserved for network addresses and 255 is reserved for broadcast
which means there are 254 usable host addresses!

-- 
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org/
⠈⠳⣄⠀⠀


Re: netmask question

2023-05-22 Thread Timothy M Butterworth
On Mon, May 22, 2023 at 3:41 AM Tim Woodall 
wrote:

> On Sun, 21 May 2023, Timothy M Butterworth wrote:
>
> > The only address that should have a netmask of 255.255.255.255 is the
> > Loopback interface.
> >
>
> I don't much use ipv4 any more if I can avoid it but isn't it normal for
> point-to-point links to have a netmask of 255.255.255.255?
>

Point-to-point links should have  a mask of 255.255.255.252. This provides
a Network, Broadcast and two host addresses.

 It definitely can be, maybe not so common as I assumed.

>
> loopback is a /8
>

 The 127.0.0.1 is a /8 but you can assign a public IP address to loopback
which is useful on routers. A /32 provides a Network, Broadcast and Host
address as a single address because there is only one host.


-- 
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org/
⠈⠳⣄⠀⠀


Re: netmask question

2023-05-22 Thread coreyh

On 22/05/2023 11:08, Tim Woodall wrote:

On Mon, 22 May 2023, cor...@free.fr wrote:





Hello,

In CIDR a host address is xx.xx.xx.xx/32 which means 255.255.255.255.
isn't it?



It depends on what question you're asking.

An individual address is a /32, but a host address might be listed as a
/24 for example. This means there are 256 addresses that can be reached
without routing.


I see. thanks.
In some use cases my configuration requires a host address with /32 for 
CIDR. such as postscreen whitelist stuff.


I know 192.168.1.0/24 means a C class.
But 192.168.1.100/24 means what? C class or that separated address 
192.168.1.100?


kind regards
Corey



Re: netmask question

2023-05-22 Thread Tim Woodall

On Mon, 22 May 2023, cor...@free.fr wrote:


On 22/05/2023 09:41, Tim Woodall wrote:

On Sun, 21 May 2023, Timothy M Butterworth wrote:


The only address that should have a netmask of 255.255.255.255 is the
Loopback interface.



I don't much use ipv4 any more if I can avoid it but isn't it normal for
point-to-point links to have a netmask of 255.255.255.255?

It definitely can be, maybe not so common as I assumed.

loopback is a /8


Hello,

In CIDR a host address is xx.xx.xx.xx/32 which means 255.255.255.255.
isn't it?



It depends on what question you're asking.

An individual address is a /32, but a host address might be listed as a
/24 for example. This means there are 256 addresses that can be reached
without routing.




Re: netmask question

2023-05-22 Thread coreyh

On 22/05/2023 09:41, Tim Woodall wrote:

On Sun, 21 May 2023, Timothy M Butterworth wrote:


The only address that should have a netmask of 255.255.255.255 is the
Loopback interface.



I don't much use ipv4 any more if I can avoid it but isn't it normal 
for

point-to-point links to have a netmask of 255.255.255.255?

It definitely can be, maybe not so common as I assumed.

loopback is a /8


Hello,

In CIDR a host address is xx.xx.xx.xx/32 which means 255.255.255.255.
isn't it?

Thanks.



Re: netmask question

2023-05-22 Thread tomas
On Mon, May 22, 2023 at 08:41:13AM +0100, Tim Woodall wrote:
> On Sun, 21 May 2023, Timothy M Butterworth wrote:
> 
> > The only address that should have a netmask of 255.255.255.255 is the
> > Loopback interface.
> > 
> 
> I don't much use ipv4 any more if I can avoid it but isn't it normal for
> point-to-point links to have a netmask of 255.255.255.255?

Right -- this one designates an isolated host address: "the computer is the
network" [1]. I think it's rather used to designate host routes or single
hosts in firewall rules. For point-to-point links I think a /23, i.e.
255.255.255.254 seems more appropriate.

> It definitely can be, maybe not so common as I assumed.
> 
> loopback is a /8

Most definitely:

  tomas@trotzki:~$ ip addr show
  1: lo:  mtu 65536 qdisc noqueue state UNKNOWN group 
default qlen 1000
  link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
  inet 127.0.0.1/8 scope host lo
 valid_lft forever preferred_lft forever
  inet6 ::1/128 scope host 
 valid_lft forever preferred_lft forever

(I actually make use if it when I want to test web pages locally and want
a host IP different to localhost).

Cheers
-- 
t


signature.asc
Description: PGP signature


Re: netmask question

2023-05-22 Thread tomas
On Mon, May 22, 2023 at 08:32:14AM +0100, Tim Woodall wrote:
> On Mon, 22 May 2023, to...@tuxteam.de wrote:
> 
>  number; for (human) display it is subdivided into four 8 bit chunks
> > (called "octets" for obvious reasons), and those octets only can
> > go from 0 to 255 (since 2^8 == 255).
> > 
> Nit, but 2^8 is 256.

Eh' -- off-by-one error. We C programmers do that ;-P

But yes, thanks for the clarification.

Cheers
-- 
t


signature.asc
Description: PGP signature


Re: netmask question

2023-05-22 Thread Tim Woodall

On Sun, 21 May 2023, Timothy M Butterworth wrote:


The only address that should have a netmask of 255.255.255.255 is the
Loopback interface.



I don't much use ipv4 any more if I can avoid it but isn't it normal for
point-to-point links to have a netmask of 255.255.255.255?

It definitely can be, maybe not so common as I assumed.

loopback is a /8



Re: netmask question

2023-05-22 Thread Tim Woodall

On Mon, 22 May 2023, to...@tuxteam.de wrote:

 number; for (human) display it is subdivided into four 8 bit chunks

(called "octets" for obvious reasons), and those octets only can
go from 0 to 255 (since 2^8 == 255).


Nit, but 2^8 is 256.



Re: netmask question

2023-05-21 Thread tomas
On Mon, May 22, 2023 at 04:49:07AM +0200, cor...@free.fr wrote:
> Hello list,
> 
> currently the netmask for an IPv4 is 255.255.255.255.
> I am just not sure, why can't the netmask for IPv4 be 768.768.768.768?
> Can I set that a netmask directly in linux OS?
> If so we have much more IPv4 space available, even no IPv6 is needed.

Charles is right: the Wikipedia page is a good resource here.

The short answer is: an IPv4 address is, behind the scenes a 32 bit
number; for (human) display it is subdivided into four 8 bit chunks
(called "octets" for obvious reasons), and those octets only can
go from 0 to 255 (since 2^8 == 255).

There are more limitations to netmasks: since the net part of an
address has to be "to the left" and the host part "to the right",
you can only have netmasks with all (binary) ones to the left and
all (binary) zeroes to the right. Some examples:

 |  binary | decimal |
 |-+-|
 | ... |   255.255.255.0 |
 | ...1000 | 255.255.255.128 |
 | ...1100 | 255.255.255.192 |

Therefore it is sufficient to specify how many "one" bits there
are in your netmask. These days it is customary to just write
that (after a slash) to specify the netmask. For an IP address
of the third type, you might write, for example:

  192.168.12.11/26

...the "26" specifying the netmask.

Cheers
-- 
t


signature.asc
Description: PGP signature


Re: netmask question

2023-05-21 Thread Charles Curley
On Mon, 22 May 2023 04:49:07 +0200
cor...@free.fr wrote:

> currently the netmask for an IPv4 is 255.255.255.255.
> I am just not sure, why can't the netmask for IPv4 be 768.768.768.768?
> Can I set that a netmask directly in linux OS?
> If so we have much more IPv4 space available, even no IPv6 is needed.

You need to do some serious reading. I suggest you start with this
article. https://en.wikipedia.org/wiki/IP_address

The reason your idea won't work for IPV4 is explained in
https://en.wikipedia.org/wiki/IP_address#IPv4_addresses Each of the
four quads represents 8 unsigned bits. So the range is 0 to 255. 768
won't fit in 8 bits.

Now, if you want to define a new IP protocol, go ahead.

-- 
Does anybody read signatures any more?

https://charlescurley.com
https://charlescurley.com/blog/



Re: netmask question

2023-05-21 Thread Timothy M Butterworth
On Sun, May 21, 2023 at 10:49 PM  wrote:

> Hello list,
>
> currently the netmask for an IPv4 is 255.255.255.255.
> I am just not sure, why can't the netmask for IPv4 be 768.768.768.768?
>

The IPv4 standard only allows each octet to be a value between 0 - 255.
Each Octet is 8 binary bits which adds up to a total of 255 if all bits are
set to on.

The only address that should have a netmask of 255.255.255.255 is the
Loopback interface.

Tim



> Can I set that a netmask directly in linux OS?
> If so we have much more IPv4 space available, even no IPv6 is needed.
>
> Thank you.
> Corey H.
>
>

-- 
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org/
⠈⠳⣄⠀⠀


RE: Netmask error

2007-06-01 Thread Marlos Sedrez
Pois eh manda o seu ifconfig e route que estão configurados ;p

E quais foram os arquivos relacionados que vc alterou ?

Att

Marlos Sedrez

  _  

From: Ayesha [mailto:[EMAIL PROTECTED] 
Sent: sexta-feira, 1 de junho de 2007 14:13
To: Lista
Subject: Netmask error

 

Olá Lista,

 

Sei que a duvida com certeza é de principiante, mas não estou conseguindo
saná-la :(

 

Tenho uma speedy funcionando sem problemas, fazendo NAT etc e tal. Estou
testando (ou tentando)uma nova operadora, que me deu IP fixo e GTW como a
speedy. Troquei então nos arquivos relacionados, e aí recebo a mensagem no
boot:

 

route: netmask doesn't match route address

 

Ora, minhas máscaras continuam como dantes...o que posso fazer?

 

Valew!  

 

-- 

Best regards,

 Ayesha   mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]



RE: netmask question

1999-09-27 Thread Pollywog

On 27-Sep-99 Pollywog wrote:
 If this is the wrong place to ask this question, just let me know.
 
 I installed a script that configures ipchains for me, and it gives me
 some
 error messages about an incorrect netmask, but the author of the script
 told me the error messages are in error because his script groks the
 netmask from 'ifconfig'.
 
 I did 'ifconfig' and I get something interesting for ppp0.
 Why does ppp0 not have the netmask 255.255.255.0 just as my network card
 has?

---snip

Someone just explained to me that the netmask with all bits set to 1 is
used because the interface ppp0 is using P-t-P.  That explains it.

--
Andrew


Re: netmask

1997-12-29 Thread Miquel van Smoorenburg
In article [EMAIL PROTECTED],
Hamish Moffatt [EMAIL PROTECTED] wrote:
Is a netmask of 255.255.255.128 (ie half a class C) 25 bits of
address, ie a /28 designator for tools that use that form of netmask?

Yes, it's 25 bits, but it's not a /28, it's a /25 ofcourse ..

Mike.
-- 
 Miquel van Smoorenburg |  Studying to be a technomage   *
[EMAIL PROTECTED]  | May you live in interesting times


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word unsubscribe to
[EMAIL PROTECTED] . 
Trouble?  e-mail to [EMAIL PROTECTED] .


Re: netmask

1997-12-29 Thread Hamish Moffatt
On Mon, Dec 29, 1997 at 01:09:16PM +0100, Miquel van Smoorenburg wrote:
 In article [EMAIL PROTECTED],
 Hamish Moffatt [EMAIL PROTECTED] wrote:
 Is a netmask of 255.255.255.128 (ie half a class C) 25 bits of
 address, ie a /28 designator for tools that use that form of netmask?
 
 Yes, it's 25 bits, but it's not a /28, it's a /25 ofcourse ..

Of course. Thanks for your help.


Hamish
-- 
Hamish Moffatt, [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]
Latest Debian packages at ftp://ftp.rising.com.au/pub/hamish. PGP#EFA6B9D5
CCs of replies from mailing lists are welcome.   http://hamish.home.ml.org


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word unsubscribe to
[EMAIL PROTECTED] . 
Trouble?  e-mail to [EMAIL PROTECTED] .