Having trouble understanding why I don't get a connection on my static IP with netplan.

My ip is 98.xxx.xxx.xx My reserved address for my device is Ethernet interface: enp1s0.

This is currently what my 50-cloud-init.yaml file looks like.

  version: 2
  renderer: networkd
      dhcp4: no
      addresses: [98.xxx.xxx.xx/24]
      nameservers: [,]

With this I am not able to ping google.com. I get a Temporary failure in name resolution error and when I try to ping I get network is unreachable after applying my netplan. If I revert back to the generated yaml file I am able to ping both just fine after applying it.

After applying the netplan the ethernet interface does show my static ip as the address but I do not see my reserved address attached to it.

The spacing appears correct from my understanding for the yaml file. Only using spaces and no tabs and rebooting am still not able to get a connection.

Any suggestions or recommendations?

  • See netplan.io/examples – waltinator Jul 19 '19 at 1:47
  • 2
    "My ip is 98.xxx.xxx.xx" is that your public IP? I don't think you will be able to set a LAN IP address that is in a different subnet than your gateway – steeldriver Jul 19 '19 at 1:55
  • What does the server connect to? A modem or other internet device supplied by your ISP? I suspect that the modem gets the 98.xxx address from your ISP and then hands out 192.168.1.x addresses to all the computers connected to it. Is this true? Please clarify your environment. Welcome to Ask Ubuntu. – chili555 Jul 19 '19 at 1:56
  • The default gateway has to be in the same subnet as the device. You are violating this, and it won't work. Do you want to set a static IP of on your computer? – vidarlo Jul 19 '19 at 4:55

You seem to misunderstand how to use your your public ip-address (98.xxx.xxx.xx/24) for your computer.

The public address is the address of your modem/ router. This device has (at least) two connections, a WAN (internet) and a LAN (your local network). The WAN connection is using the public ip 98.xxx.xxx.xx/24. On the LAN side there usually is a subnet with 256 ip numbers of which you can use 253, to

The gateway, is the ip numbet of the LAN connection on your rout/modem.

Only ip numbers thtough can be used by devices on you LAN.

If you want your ubuntu machine to listen for incoming connections from the internet on your public ip address you have to configure that on your router/modem. You can make your router/modem listen on tcp ports and pass incoming connections to tcp ports on your ubuntu machine.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.