Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #258582 > unrolled thread
| Started by | coreyh@free.fr |
|---|---|
| First post | 2023-05-22 04:50 +0200 |
| Last post | 2023-05-23 02:50 +0200 |
| Articles | 19 on this page of 39 — 13 participants |
Back to article view | Back to linux.debian.user
netmask question coreyh@free.fr - 2023-05-22 04:50 +0200
Re: netmask question Timothy M Butterworth <timothy.m.butterworth@gmail.com> - 2023-05-22 05:00 +0200
Re: netmask question Tim Woodall <debianuser@woodall.me.uk> - 2023-05-22 09:50 +0200
Re: netmask question <tomas@tuxteam.de> - 2023-05-22 10:10 +0200
Re: netmask question coreyh@free.fr - 2023-05-22 11:00 +0200
Re: netmask question Tim Woodall <debianuser@woodall.me.uk> - 2023-05-22 11:10 +0200
Re: netmask question coreyh@free.fr - 2023-05-22 12:20 +0200
Re: netmask question Timothy M Butterworth <timothy.m.butterworth@gmail.com> - 2023-05-22 12:30 +0200
Re: netmask question Dan Ritter <dsr@randomstring.org> - 2023-05-22 13:10 +0200
Re: netmask question Timothy M Butterworth <timothy.m.butterworth@gmail.com> - 2023-05-22 12:20 +0200
Re: netmask question Tim Woodall <debianuser@woodall.me.uk> - 2023-05-22 12:30 +0200
Re: netmask question <tomas@tuxteam.de> - 2023-05-22 13:10 +0200
Re: netmask question Charles Curley <charlescurley@charlescurley.com> - 2023-05-22 05:10 +0200
Re: netmask question <tomas@tuxteam.de> - 2023-05-22 07:00 +0200
Re: netmask question Tim Woodall <debianuser@woodall.me.uk> - 2023-05-22 09:40 +0200
Re: netmask question <tomas@tuxteam.de> - 2023-05-22 10:00 +0200
Re: netmask question Timothy M Butterworth <timothy.m.butterworth@gmail.com> - 2023-05-22 12:20 +0200
Re: netmask question gene heskett <gheskett@shentel.net> - 2023-05-22 18:20 +0200
Re: netmask question <tomas@tuxteam.de> - 2023-05-22 21:10 +0200
Re: netmask question gene heskett <gheskett@shentel.net> - 2023-05-23 01:50 +0200
Re: netmask question Dan Purgert <dan@djph.net> - 2023-05-23 03:20 +0200
Re: netmask question debian-user@howorth.org.uk - 2023-05-23 12:50 +0200
Re: netmask question Dan Purgert <dan@djph.net> - 2023-05-23 14:20 +0200
Re: netmask question tomas@tuxteam.de - 2023-05-23 07:00 +0200
Re: netmask question "Tom Reed" <tom@dkinbox.com> - 2023-05-23 01:50 +0200
Re: netmask question Greg Wooledge <greg@wooledge.org> - 2023-05-23 02:10 +0200
Re: netmask question <tomas@tuxteam.de> - 2023-05-23 06:40 +0200
Re: netmask question Dan Ritter <dsr@randomstring.org> - 2023-05-23 02:30 +0200
Re: netmask question "Tom Reed" <tom@dkinbox.com> - 2023-05-23 02:30 +0200
Re: netmask question Dan Ritter <dsr@randomstring.org> - 2023-05-23 02:50 +0200
Re: netmask question <tomas@tuxteam.de> - 2023-05-23 06:50 +0200
Re: netmask question Andy Smith <andy@strugglers.net> - 2023-05-27 03:10 +0200
Re: netmask question Greg Wooledge <greg@wooledge.org> - 2023-05-27 03:10 +0200
Re: netmask question Andy Smith <andy@strugglers.net> - 2023-05-27 03:20 +0200
Re: netmask question Greg Wooledge <greg@wooledge.org> - 2023-05-23 02:50 +0200
Re: netmask question "Tom Reed" <tom@dkinbox.com> - 2023-05-23 03:00 +0200
Re: netmask question Dan Ritter <dsr@randomstring.org> - 2023-05-23 03:20 +0200
Re: netmask question Tim Woodall <debianuser@woodall.me.uk> - 2023-05-23 08:30 +0200
Re: netmask question Timothy M Butterworth <timothy.m.butterworth@gmail.com> - 2023-05-23 02:50 +0200
Page 2 of 2 — ← Prev page 1 [2]
| From | Dan Purgert <dan@djph.net> |
|---|---|
| Date | 2023-05-23 03:20 +0200 |
| Message-ID | <GyoQV-aMrM-5@gated-at.bofh.it> |
| In reply to | #258618 |
[Multipart message — attachments visible in raw view] — view raw
On May 22, 2023, gene heskett wrote: > On 5/22/23 15:04, tomas@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, tomas@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
[toc] | [prev] | [next] | [standalone]
| From | debian-user@howorth.org.uk |
|---|---|
| Date | 2023-05-23 12:50 +0200 |
| Message-ID | <GyxKx-aRVE-25@gated-at.bofh.it> |
| In reply to | #258630 |
Dan Purgert <dan@djph.net> wrote: > On May 22, 2023, gene heskett wrote: > > On 5/22/23 15:04, tomas@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, tomas@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)
[toc] | [prev] | [next] | [standalone]
| From | Dan Purgert <dan@djph.net> |
|---|---|
| Date | 2023-05-23 14:20 +0200 |
| Message-ID | <Gyz9D-aSWQ-7@gated-at.bofh.it> |
| In reply to | #258637 |
[Multipart message — attachments visible in raw view] — view raw
On May 23, 2023, debian-user@howorth.org.uk wrote: > Dan Purgert <dan@djph.net> 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
[toc] | [prev] | [next] | [standalone]
| From | tomas@tuxteam.de |
|---|---|
| Date | 2023-05-23 07:00 +0200 |
| Message-ID | <GyshP-aOvn-17@gated-at.bofh.it> |
| In reply to | #258618 |
[Multipart message — attachments visible in raw view] — view raw
On Mon, May 22, 2023 at 07:48:46PM -0400, gene heskett wrote: > On 5/22/23 15:04, tomas@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
[toc] | [prev] | [next] | [standalone]
| From | "Tom Reed" <tom@dkinbox.com> |
|---|---|
| Date | 2023-05-23 01:50 +0200 |
| Message-ID | <GynrP-aLuC-9@gated-at.bofh.it> |
| In reply to | #258611 |
> > 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/
[toc] | [prev] | [next] | [standalone]
| From | Greg Wooledge <greg@wooledge.org> |
|---|---|
| Date | 2023-05-23 02:10 +0200 |
| Message-ID | <GynLb-aLQd-5@gated-at.bofh.it> |
| In reply to | #258619 |
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.
[toc] | [prev] | [next] | [standalone]
| From | <tomas@tuxteam.de> |
|---|---|
| Date | 2023-05-23 06:40 +0200 |
| Message-ID | <GyrYt-aOnO-1@gated-at.bofh.it> |
| In reply to | #258620 |
[Multipart message — attachments visible in raw view] — view raw
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 <netmask> = NOT ( <network address> XOR <broadcast address>) with the customary bitwise operators NOT and XOR. Only Tom knows now :) Cheers -- t
[toc] | [prev] | [next] | [standalone]
| From | Dan Ritter <dsr@randomstring.org> |
|---|---|
| Date | 2023-05-23 02:30 +0200 |
| Message-ID | <Gyo4x-aLWm-11@gated-at.bofh.it> |
| In reply to | #258619 |
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-
[toc] | [prev] | [next] | [standalone]
| From | "Tom Reed" <tom@dkinbox.com> |
|---|---|
| Date | 2023-05-23 02:30 +0200 |
| Message-ID | <Gyo4x-aLWm-13@gated-at.bofh.it> |
| In reply to | #258622 |
> 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/
[toc] | [prev] | [next] | [standalone]
| From | Dan Ritter <dsr@randomstring.org> |
|---|---|
| Date | 2023-05-23 02:50 +0200 |
| Message-ID | <GyonT-aM2U-3@gated-at.bofh.it> |
| In reply to | #258623 |
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-
[toc] | [prev] | [next] | [standalone]
| From | <tomas@tuxteam.de> |
|---|---|
| Date | 2023-05-23 06:50 +0200 |
| Message-ID | <Gys89-aOrG-1@gated-at.bofh.it> |
| In reply to | #258625 |
[Multipart message — attachments visible in raw view] — view raw
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
[toc] | [prev] | [next] | [standalone]
| From | Andy Smith <andy@strugglers.net> |
|---|---|
| Date | 2023-05-27 03:10 +0200 |
| Message-ID | <GzQBr-bFTJ-1@gated-at.bofh.it> |
| In reply to | #258625 |
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: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> 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
[toc] | [prev] | [next] | [standalone]
| From | Greg Wooledge <greg@wooledge.org> |
|---|---|
| Date | 2023-05-27 03:10 +0200 |
| Message-ID | <GzQBr-bFTJ-3@gated-at.bofh.it> |
| In reply to | #258704 |
On Sat, May 27, 2023 at 12:59:59AM +0000, 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.
[toc] | [prev] | [next] | [standalone]
| From | Andy Smith <andy@strugglers.net> |
|---|---|
| Date | 2023-05-27 03:20 +0200 |
| Message-ID | <GzQL7-bFWP-1@gated-at.bofh.it> |
| In reply to | #258705 |
Hello, On Fri, May 26, 2023 at 09:07:23PM -0400, Greg Wooledge wrote: > On Sat, May 27, 2023 at 12:59:59AM +0000, 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
[toc] | [prev] | [next] | [standalone]
| From | Greg Wooledge <greg@wooledge.org> |
|---|---|
| Date | 2023-05-23 02:50 +0200 |
| Message-ID | <GyonT-aM2U-5@gated-at.bofh.it> |
| In reply to | #258623 |
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?
[toc] | [prev] | [next] | [standalone]
| From | "Tom Reed" <tom@dkinbox.com> |
|---|---|
| Date | 2023-05-23 03:00 +0200 |
| Message-ID | <Gyoxz-aM5T-1@gated-at.bofh.it> |
| In reply to | #258626 |
> 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/
[toc] | [prev] | [next] | [standalone]
| From | Dan Ritter <dsr@randomstring.org> |
|---|---|
| Date | 2023-05-23 03:20 +0200 |
| Message-ID | <GyoQV-aMrM-3@gated-at.bofh.it> |
| In reply to | #258628 |
> > 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) - FFFFFFF8 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-
[toc] | [prev] | [next] | [standalone]
| From | Tim Woodall <debianuser@woodall.me.uk> |
|---|---|
| Date | 2023-05-23 08:30 +0200 |
| Message-ID | <GytGV-aPAf-1@gated-at.bofh.it> |
| In reply to | #258628 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Timothy M Butterworth <timothy.m.butterworth@gmail.com> |
|---|---|
| Date | 2023-05-23 02:50 +0200 |
| Message-ID | <GyonT-aM2U-7@gated-at.bofh.it> |
| In reply to | #258623 |
[Multipart message — attachments visible in raw view] — view raw
On Mon, May 22, 2023 at 8:24 PM Tom Reed <tom@dkinbox.com> 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/ ⠈⠳⣄⠀⠀
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | linux.debian.user
csiph-web