What significance does the subnet mask have for a public IP address?
The difference is that your ISP has an assigned IP range of 254 addresses (or maybe more than one but this is the subnet you are in). Every ISP has that. This differenciates his subnet from those of other ISPs. Imagine the internet as just a network like every other.
Plus you always need a gateway, too because without it you would be the only member of this subnet with no one to communicate with.
In reality subnets smaller than /30 cannot be used in the internet because you need minimum 4 addresses per subnet: 1) network address 2) gateway 3) host 4) broadcast
Related videos on Youtube
boot4life
Updated on September 18, 2022Comments
-
boot4life over 1 year
Our hoster has assigned us multiple public IP addresses. They are individual non-contiguous addresses e.g. 1.1.1.50 and 1.1.1.222. According to them the correct subnet mask to use is 255.255.255.0.
I do not understand why that is. My understanding is that the subnet mask is supposed to designate which addresses are considered part of the local network. But these are individual public IP addresses. There is no local network or subnet associated with them.
In my opinion the mask should be 255.255.255.255. What difference does this make?
-
Michael Hampton over 5 yearsYou are probably not privy to the details of how your hoster has set up their local network. How, then, can you know what the correct netmask is? There are many ways this might be done, and only some of them will result in a point to point /32 that you seem to be expecting.
-
boot4life over 5 years@MichaelHampton I do not question their information at all and will do as they tell me. But I want to understand what's going on. I wonder why the question was downvoted.
-
Tommiie over 5 yearsWhy would you say these IP addresses are "individual"? The ISP probably has a network of which you are given two IP addresses to use. I assume your ISP also gave you a default gateway to use, another indication that your two IP addresses are part of a "local network".
-
boot4life over 5 yearsYes, surely the entire C block is in use somehow. But from the point of view of my own server none of the other addresses seem to matter for routing (in my understanding).
-
womble over 5 yearsI'm voting to close this question as off-topic because if you want to know how your ISP has configured their network, you should ask them.
-
boot4life over 5 years@womble Why do you think I need more information from my ISP? I have all the values I need, which I said in my question. I want to understand the significance of those values for the networking on my own server.
-
-
boot4life over 5 yearsCan you clarify one thing for me... What negative consequences does it have if I configure the wrong subnet mask? I do not see what effect the mask has in my case.
-
boot4life over 5 yearsI thought this 255.255.255.255 would mean that the subnet consists of just this one IP address, no?
-
guzzijason over 5 yearsBecause your default gateway needs to reside in the same subnet as your local interface. If you set a /32 (255.255.255.255) mask, your gateway will be unreachable. It's just how IP works.
-
guzzijason over 5 yearsAlso, if you configure the wrong mask, then your other host(s) that are in the same subnet will no longer be directly reachable - your host will try to route through a gateway to get to them instead of simply talking to them directly.
-
guzzijason over 5 yearsRight, and a network of a single host is not really a network at all.
-
Tommiie over 5 yearsWhy would you configure a subnet mask other than the one provided to you by your ISP?
-
boot4life over 5 yearsThe default gateway being unreachable is a good point. Besides that, is it fair to say that the subnet mask does not matter if there is only one NIC? Then, all traffic will go to that NIC because the default gateway is on that NIC.
-
Humberto Castellon over 5 years@boot4life, No. All bits to cero means that's the network address and all bits set to 1 means it's the broadcast address.
-
Tommiie over 5 yearsThe subnet mask determines which IP addresses are considered local to your network, i.e. for which to send out ARP requests. For IP addresses outside your local network you will send the packet to the MAC address of your default gateway which will route the packet to its destination. You should read a book about basic networking (no offense meant).
-
boot4life over 5 years@Tom Your point about ARP is important, I will look into that. There's a lot of vague explanation on the web like "you should do x" but they don't explain why and what happens if it's done otherwise. I guess this question is too "noob" for this site? I am not entirely new to networking and I did my research. I could not clarify these points from my own research. Not every server administrator is a network expert.
-
spacenomyous over 5 yearsAs said before, it's simply for localizing your network traffic. The reason people use "should" is because it will probably still work, however you're now throwing packets everywhere instead of just where they need to. It'll slow down your networking and probably won't affect you, but if everybody did it, the network would become over-saturated and collisions would occur; basically DDoSing your entire network
-
A.B over 5 yearssorry if this will bring more confusion but,1/ the broadcast can be set to the network address,sparing one ip.2/ with "peer" mechanism (eg on Linux:
ip address add dev eth0 192.0.2.1 peer 198.51.100.1;ip route add default via 198.51.100.1
. gateway's settings must match(even with a /24)),as long as the layer two (ethernet-like) can find the gateway with the given settings, even a /32 can be routed on layer 3. Except those 2 points, I agree with most of the comments and this answer. It's the same with my home's IP provided by my isp (it's a /23).Why would it be different in the business case? -
boot4life over 5 years@A.B I understand the need to subnet from the hosters perspective. What was unclear to me is why this subnetting affects my own server. I thought, no matter what I configure my packets will always be sent over the only NIC and correctly routed. I now understand that my server needs this subnet info to correctly ARP and to correctly pick the link to send on in case there are multiple links. I think if the hoster used a switch instead of a router then the ARP problem would actually cause other local computers to be unreachable. Because they use a router this should not be the case.Hope I got it.
-
Broco over 5 years@boot4life If you want to have an easy image: think of the internet as a bunch of different countries. Each country has a different language and has a border, which determines its size (subnet), a country name (network address), a public radio service (broadcast) and a translator who is responsible for communicating with other countries (gateway). All citizens of your country can talk to each other but if you want to communicate with the outside world you need the translator, otherwise you're not able to do so.