1

We are trying to get a new server running 18.04 LTS to connect to the internet, but no luck thus far. The router doesn't distribute DHCP, so we have a static IP assigned to the port the server is connected to. We tried following the instructions here: https://www.howtoforge.com/linux-basics-set-a-static-ip-on-ubuntu

That didn't work - still no network connection. Note that there was no file named 01-netcfg.yaml in /etc/netplan. There was another yaml file that was named 50-netcfg.yaml and that's the file we edited.

network:
  version: 2
  renderer: networkd
  ethernets:
    eno1:
      dhcp4: no
      dhcp6: no
      addresses: [204.xxx.xxx.108/25]
      gateway4: 204.xxx.xxx.1
      nameservers:
        addresses: [8.8.8.8,8.8.4.4]
  • 1
    you should put the yml file in question in your question, so we can have a look at it. (You can mask the IP address with Xs) – Sebastian Stark Jun 11 '18 at 17:51
  • network: version: 2 renderer: networkd ethernets: eno1: dhcp4: no dhcp6: no addresses: [204.xxx.xxx.xxx/25] gateway4: 204.xxx.xxx.xxx nameservers: addresses: [8.8.8.8,8.8.4.4] – Serdar Uckun Jun 11 '18 at 17:58
  • Spacing and indentation are very important and we can't proofread it in a comment. Paste the exact file here and give us the link: http://paste.ubuntu.com – chili555 Jun 11 '18 at 18:01
  • https://paste.ubuntu.com/p/2xSM5fDgmZ/ – Serdar Uckun Jun 11 '18 at 18:03
  • 1
    The gateway should be the router IP address. With a /25 netmask that is 255.255.255.128 which would mean that whatever 204.XXX.XXX.whatever the last three are would have to match. In that mask, 126 would be the last IP of the subnet meaning that 127 is the broadcast IP and 129 would be the start of the next one with 128 being the network and 255 being the broadcast. So, if the gateway is not in the IP address range it will not work. Use http://www.subnet-calculator.com/subnet.php?net_class=C for figuring out IP addresses. – Terrance Jun 11 '18 at 18:16
  • The static IP is 204.xxx.xxx.108 and GW is 204.xxx.xxx.1, so they are in the same subnet. – Serdar Uckun Jun 11 '18 at 18:23
  • Please show ip a, so that we can see how the system has configured the network. – AlexP Jun 11 '18 at 18:37
  • Was there any complaint from: sudo netplan apply ? – chili555 Jun 11 '18 at 18:38
  • You could try file name and syntax and indents as per the Ubuntu serverguide, which is a little different. – Doug Smythies Jun 11 '18 at 19:08
  • First, the only file in the /etc/netplan directory was called 50-cloud-init.yaml. That is the file that we edited. Was that wrong? Should we create a file named 01-netcfg.yaml instead?

    Second, here is what is returned by ip -a:

    – Serdar Uckun Jun 11 '18 at 19:48
  • Second, here is what is returned by ip -a: https://paste.ubuntu.com/p/RXYrPzHn8V/ – Serdar Uckun Jun 11 '18 at 19:58
  • Third, sudo netplan apply simply hangs. – Serdar Uckun Jun 11 '18 at 19:58
  • After rebooting, sudeo netplan --debug apply returns the following: https://paste.ubuntu.com/p/MqWSzGYDbp/ – Serdar Uckun Jun 11 '18 at 20:10
  • Now does ip addr show give the correct IP address, 204.XXX.XXX.108? Can you ping the gateway? Can you ping 8.8.8.8? – chili555 Jun 11 '18 at 20:28
  • ip addr show still doesn't show the correct IP address. We cannot ping anything. We also changed the syntax of the yaml file to make it adhere to the Ubuntu server guide, but no luck. – Serdar Uckun Jun 12 '18 at 17:03
  • Is any of you local to the Boston, MA area by any chance? We are willing to pay someone to come and fix this problem. Sadly, ssh is not an option because we cannot connect the server to the internet! – Serdar Uckun Jun 12 '18 at 17:04
  • Problem solved! Apparently we had connected the ethernet cable to the IPMI RJ-45 port on the server instead of one of the regular ethernet ports. Rather embarrassing. Thanks to everyone who helped! – Serdar Uckun Jun 13 '18 at 15:12
  • This POST is how to set static IP in ubuntu 18.04 terminally. – Benyamin Jafari Oct 23 '18 at 07:54

0 Answers0