-2

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?

boot4life
  • 279
  • 2
  • 5
  • 12
  • 1
    You 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. – Michael Hampton Sep 28 '18 at 17:29
  • @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. – boot4life Sep 28 '18 at 17:32
  • Why 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". – Tommiie Sep 28 '18 at 17:34
  • Yes, 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). – boot4life Sep 28 '18 at 17:46
  • I'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. – womble Sep 28 '18 at 22:28
  • @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 Sep 29 '18 at 10:47

3 Answers3

5

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

Broco
  • 1,999
  • 13
  • 21
  • Can 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 Sep 28 '18 at 16:59
  • Because 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 Sep 28 '18 at 17:27
  • Also, 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 Sep 28 '18 at 17:29
  • Why would you configure a subnet mask other than the one provided to you by your ISP? – Tommiie Sep 28 '18 at 17:30
  • The 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. – boot4life Sep 28 '18 at 17:30
  • @Tom I do not want to do that but I want to understand what's going on. – boot4life Sep 28 '18 at 17:31
  • The 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). – Tommiie Sep 28 '18 at 17:36
  • @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. – boot4life Sep 28 '18 at 17:58
  • As 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 – spacenomyous Sep 28 '18 at 18:41
  • sorry 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? – A.B Sep 28 '18 at 19:04
  • @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. – boot4life Sep 28 '18 at 20:20
  • @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. – Broco Sep 30 '18 at 00:57
0

The subnet mask advised by your hoster says that they're using /24 networks. The one you're saying shouldn't be the netmask can't be because that's the broadcast address (the first and last address of a network are not used).

Humberto Castellon
  • 879
  • 1
  • 7
  • 17
-1

If you don't have a mask assigned (larger than /32), you can't route traffic to/from it. IIRC, some ISPs like Verizon often give you IPs with a /24 mask, because the GW is somewhere in their CO as opposed to your location.

TPCoMatt
  • 67
  • 4