Ethernet does not work with Ubuntu Server 20.04
Netplan is the tool for configuring networks now.
- It's very easy to use, and here's whole page full of examples.
Step 1. Use ip addr
to locate your interface name
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
2: enp3s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
3: wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
- Here, you can see that my ethernet interface is named enp3s0.
Step 2. Modify the netplan YAML file. Here's an easy example:
- This requires a text editor and sudo, of course.
-
Tip: Proper indentation is critical, Use spaces, NOT tabs.
# This is a comment line - lines starting with # are ignored. network: version: 2 renderer: networkd ethernets: enp3s0: # Here is where that interface name goes! dhcp4: true
Step 3: Run sudo netplan apply
. Netplan will parse and apply the new config, including requesting a new dhcp address.
After this, your network should be up.
- This config is for a server without GUI (networkd) using a wired ethernet (enp3s0) and dhcp. If you need a different configuration, check that page full of examples. What you want is probably in there.
Related videos on Youtube
CodingM
I like making apps in android studio. I work with Java. I also like editing posts and try to answer questions.
Updated on September 18, 2022Comments
-
CodingM over 1 year
I want to install some packages via Ethernet, but it does not seem to be working. I want a DHCP connection.
Here is what I tried:
ifconfig
(net-tools was installed via usb)Which only gives LoopBack
Trying to modify the
etc/network/interfaces
file usingcat etc/network/interfaces
:cat: /etc/network/interfaces: No such file or directory
I tried looking in the
etc/network
folder only to find that there are only 3 files:if-post-down.d if-pre-up.d and if-up.d
Looking at /etc/netplan/00-installer-config.yaml it shows this:
network: ethernets: {} version: 2
How can I solve this?
-
CodingM almost 4 years@user535733 I have looked in the
/etc/netplan
to find a file called 00-installer-config.yaml. Is this it? I have tried looking at it in vi. -
CodingM almost 4 years@user535733 I would like to try both, but for now I will try DHCP. I will edit the question to show the .yaml file.
-