PDA

View Full Version : [SOLVED] Server 20.04 network configuration problems.



corollaattori
September 2nd, 2020, 04:27 PM
Configuration is as follows: Fortinet VPN router without DHCP that has direct internet access. Behind that is Switch and Ubuntu server with DHCP. I managed to get DHCP running and other computers connected to that switch gets ip and internet works. But server itself fails to connect internet and takes few minutes to boot because of that.

I tried configuring it with that guide, but no luck.

https://ubuntu.com/server/docs/network-configuration

Static IP Address AssignmentTo configure your system to use static address assignment, create a netplan configuration in the file /etc/netplan/99_config.yaml. The example below assumes you are configuring your first Ethernet interface identified as eth0. Change the addresses, gateway4, and nameservers values to meet the requirements of your network.
network:
version: 2
renderer: networkd
ethernets:
eth0:
addresses:
- 10.10.10.2/24
gateway4: 10.10.10.1
nameservers:
search: [mydomain, otherdomain]
addresses: [10.10.10.1, 1.1.1.1]
The configuration can then be applied using the netplan command.
sudo netplan apply





I now see that there are different guides with other netplan configs. Which is correct and simplest way to do it?
http://itprohelper.com/setting-up-static-ip-on-ubuntu-server-20-04-lts/

https://i.postimg.cc/Y2PTHBQs/Whats-App-Image-2020-09-02-at-17-55-54.jpg
If i share wired network from my Ubuntu laptop it works fine, so only static config is flawed.

Server also runs when finished Mate desktop and is Samba fileserver with WXP and W10 in virtualbox. Is Ubuntu Server best choice, or should i install desktop version of Ubuntu Mate instead, and add server components to that? Stability is most important. Main function is to use those windowses remotely with RDP and to be DHCP and file server.

The Cog
September 2nd, 2020, 05:22 PM
Please post the netplan config again, this time putting it in code tags (use go advanced, then highlight the text and click the # button at the top). Indentation is critical with netplan configs.

corollaattori
September 2nd, 2020, 06:02 PM
Please post the netplan config again, this time putting it in code tags (use go advanced, then highlight the text and click the # button at the top). Indentation is critical with netplan configs.

Sorry that previous was just the quote from the link.

This is the config i made.


network:
version: 2
renderer: networkd
ethernets:
eth0:
addresses:
- 10.150.200.10/24
gateway4: 10.150.200.1
nameservers:
search: [mydomain, otherdomain]
addresses: [8.8.8.8, 8.8.4.4]

TheFu
September 2nd, 2020, 06:34 PM
dhcp4: false
dhcp6: false
at the same level as

addresses:

Then run

sudo netplan generate
sudo netplan apply --debug

corollaattori
September 2nd, 2020, 06:43 PM
dhcp4: false
dhcp6: false
at the same level as

addresses:

Then run

sudo netplan generate
sudo netplan apply --debug

So like this?
I'll try tomorrow when i get back to office.


network: version: 2
renderer: networkd
ethernets:
eth0:
addresses:
dhcp4: false
dhcp6: false
- 10.150.200.10/24
gateway4: 10.150.200.1
nameservers:
search: [mydomain, otherdomain]
addresses: [8.8.8.8, 8.8.4.4]

TheFu
September 2nd, 2020, 10:12 PM
No. At the same level. BTW, do not use tabs in this file. Be 100% consistent following the YAML standard.

addresses:
- 10.150.200.10/24
dhcp4: false
dhcp6: false
Don't split up a subsection from the parent.

math492m
September 3rd, 2020, 02:30 PM
use server 18.04 instead that was the only thing that fixed my problem

TheFu
September 3rd, 2020, 02:33 PM
use server 18.04 instead that was the only thing that fixed my problem

I haven't had any issues with 20.04 simplistic networking using a fairly short netplan.yaml file for static IPs. Now, doing more complex network steps didn't work on 18.04 until sometime in 2020 (they didn't work in fall 2019), but since around Feb'20, the netplan stuff in 18.04 and 20.04 have worked for simple, bridged, bonded, and a few other network configurations using single and multiple NICs.

I've been using yaml config files for a long time, so netplan was not the first introduction to them. Ansible, Ruby and Perl use yaml easily. Sure, I had the interfaces working perfectly already and would have preferred no change, but as changes go, 2-4 yrs after first introduces, netplan hasn't been too bad. resolvconf and systemd.resolved have been far worse over the years.

IMHO.

corollaattori
September 8th, 2020, 05:23 PM
Tried all kinds of things unsuccesfully. Finally i re-installed it, and there was network settings in the setup and gave it static ip there and problem solved.

TheFu
September 8th, 2020, 05:39 PM
Glad you got it working, but I suspect it was just an indentation problem between spaces vs tabs. Just because the indentation appears to be the same, if spaces and tabs are mixed, they are not the same. People unfamiliar with YAML often have the issue.