0

In the past, whenever I have set up a new install, I haven't had to configure the IP manually, because the IP configures automatically.

Not so in this case.

This time around I took a new server and plugged it in and installed CentOS, but on boot IP was not set up. I had to open a session in IPMI since no way to access ssh yet.

I followed this guide, but unfortunately could not get it to connect to the internet, even though it outputs that my setup is correct and it's connected.

enter image description here

enter image description here

Problem is, that despite appearing connected, the server cannot access the internet.

enter image description here

What could be the problem here and how can it get connected to the internet?

1 Answers1

0

I solved the problem, finally.

Problem was that I was using the IP from 777.777.7.777/30 as the main IP of 777.777.7.777 with a gateway of 777.777.7.778, but the main IP should have been 777.777.7.779 because 777.777.7.777 was the network ip, not the usable ip. That's why it wouldn't connect.

That IP above is obviously not a real IP, but in sequence, a /30 subnet will have this type of sequence:

777.777.7.777/30

777.777.7.777 = network IP
777.777.7.778 = gateway
777.777.7.779 = usable ip

and use the usable ip as the main IP of the server.

so for example, if your ip is
192.168.1.104/30
then your main ip for the server should be
192.168.1.106
and your gateway should be:
192.168.1.105

Hope this helps someone! I could not find this answer anywhere and it simply dawned on me when I was looking at some of my previous ip ranges.

Now, there was some problem I don't understand because previously I didn't have to manually configure the IP, and this server could not set it up automatically for some reason. But, I did solve the answer to this question, so I hope it helps.

  • The gateway in your network can be any IP address your ISP decides as long as it is a usable address in the specified subnet. Your assumption that the gateway in the network is always the first usable IP address is not correct. – Krasi Feb 12 '20 at 08:10
  • @krasi, interesting, I didn't know that because there seems to be a formula which is why there are calculators to find the gateway etc. Do you mean the datacenter could choose it but rarely do? Because it seems there's a formula for it –  Feb 12 '20 at 14:48
  • There is a formula to calculate the usable IP addresses in a subnet. Usually the address of the gateway is the first one or the last one of these but it definitely is not a requirement. This is usually done out of simpler way to remember. As long as the IP address is valid and is part of the subnet it can be used as a gateway. – Krasi Feb 13 '20 at 07:18
  • @Krasi the problem wasn't what was used as the gateway, but rather the primary IP. You can't use a gateway as a primary IP. Not sure if it works the other way around or not. –  Feb 13 '20 at 15:23
  • What you describe is setting the gateway's address on your device. This is not possible. There is no way for more than one device on the same Layer 2 segment to have the same IP address. You have a /30 subnet which has only 2 usable IP addresses. I believe it is obvious that one of them is dedicated to the gateway and the other one is the only one which you can use on your device. – Krasi Feb 13 '20 at 15:30
  • What are you talking about? You just told me what I said to you and the opposite of your first statement. I already told you that you can't use the gateway as the main IP. Why did you just say one thing and then say you were wrong about it and say something else? –  Feb 13 '20 at 17:51