I cannot figure out why ubuntu 18.04 is assigning a ip address of 127.0.0.1
I set my netplan
network:
version: 2
renderer: networkd
ethernets:
enp3s0:
dhcp4: true
any tips welcome
I cannot figure out why ubuntu 18.04 is assigning a ip address of 127.0.0.1
I set my netplan
network:
version: 2
renderer: networkd
ethernets:
enp3s0:
dhcp4: true
any tips welcome
127.0.0.1 is a loopback adress. Every machine has it (windows, linux, mac, android, litterly every device). It is called localhost and it is used quite often.
Example 1 (let's assume server ip adress is 192.168.2.15):
You have a web server on a computer running and you want to view the website it's hosting. From a different computer, you go to
192.168.2.15:80
in google and you'll see the webpage your server is hosting.Now you want to access the webpage from the server (aka access the webpage the server is hosting, from that server). Instead of typing the ip adress of the server (which will make the server connect to itself ofcourse), you can just type
127.0.0.1:80
and that will give you access. Because 127.0.0.1 (aka localhost) is... the server itself. You can also typelocalhost:80
.Example 2:
You have Prometheus (gathers info about your computer) and Grafana (makes nice graphs out of the info of Prometheus) installed. While setting up Grafana, you need to make a connection to Prometheus so that Grafana can use the info Prometheus is gathering to show it in a nice graph. When you have Prometheus and Grafana installed on the same computer, you can type
localhost:9100/metrics
in grafana to make a connection to Prometheus.Example 3:
You have a Minecraft server running on a computer. Now you want to play on your new cool minecraft server ofcourse. If you want to play on the computer that the server is being run on, when adding a server, you can just type
localhost
and it will connect to the minecraft server running on itself.If you understand it correctly, you should be able to understand this:
"
ping localhost
will always work."Just remember:
localhost = 127.0.0.1 = itself