Link to home
Start Free TrialLog in
Avatar of Peter Chan
Peter ChanFlag for Hong Kong

asked on

Issue of IP address

Hi,

I do not know why Ubuntu server is not getting IPV4 address well. Using the same cable, one other notebook is fine to get IPV4 address.

User generated image

Avatar of arnold
arnold
Flag of United States of America image

It looks as though IPv4 is disabled.
Avatar of Peter Chan

ASKER

I did no change ever on it. And do not know why IPv4 does become unavailable.
What do you have in /etc/network/interfaces for the eth0 device?
The OS is Ubuntu 20.04. I do not see interfaces inside /etc/network but the following.
User generated image
It is impossible to determine based on what you provided.

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

Is this a new install?

What changes were made?
look at /etc/sysconfig/networking or /etc/networking

can the system get out?

presumably the Ubuntu install is provided/accessible, add the net-tools software package

what happens if you set an IPv4 address on

the interface with the ipv6 address relfects that it is sending 8k data and receiving packets. 780+k data

apt install net-tools what happens?

you cut the image so it is not clear name interface and the options
I did no change to it. Before this, it was fine with proper IPv4 address. There is sysctl.d folder within /etc/ and no sysconfig there. 
Have you tried changing the ethernet adapter in the server? Is it a retail Server or just a PC used as a Server? Retail Servers usually have more than one ethernet Adapter, even many normal Mainboards have more than one...
It is PC running as the server. I did no change to the OS and did not also physically change anything.
Which system provides DHCP services on the network?

have you tried using ip to set an ipv4 address on the ensxxx interface and see what message you get.

The local interface reflect the inet (ipv4) localhost address, it is unclear why the betwork one is not showing anything.
IPs are assigned as follows for Ubuntu...

1) Maybe from DHCP.

2) Pre-Artful version - /etc/network/interfaces

3) Post-Artful version - /etc/netplan/some-file-name
Starting point info for debugging...

1) What Distro you're running as Pre-Artful + Post-Artful versions configure networking differently.

2) If you're expecting to run a static IP or dynamic IP (DHCP).

3) If this has ever worked, or this is a new Ubuntu install.
Thanks to all.
Arnold,
Can I have more details of your current way?
Can you post the result of

ip a
lsb_release -a
cat /etc/netplan/*

Open in new window

New versions ubuntu use netplan.

https://ubuntu.com/blog/ubuntu-bionic-netplan
 

ifconfig -i <interfacename> <ip_address> netmask <netmask> up

this presumes you install the net-tools.

The other option since you are in a GUI desktop is to follow:

https://www.linuxtechi.com/assign-static-ip-address-ubuntu-20-04-lts/

I suspect that the IPv4 instead of the IPv6 got disabled in error.
Thanks to all.
Yujin,
FYI
User generated imageUser generated image
You asked, "Can I have more details of your current way?"

Depends on your Distro.

First mention your Distro, to provide a 100% correct answer, as Ubuntu-pre-Artful + Ubuntu-Post-Artful all have different answers.
ASKER CERTIFIED SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Look like you have 2 netplan files. Can you show the full content of the file that has the network interface name in it? It is the last part in your screenshot, but that is not showing full content. We need that file edited. What was the IP you used to have before?

You can try editing the file, replace the content with something like following

network:
  version: 2
  renderer: networkd
  ethernets:
    enp1s0:
      addresses:
      - 192.168.1.10/24
      gateway4: 192.168.1.1

Open in new window


Replace 192.168.1 with your actual LAM IP range.

To apply changes,. run

sudo netplan apply

Open in new window





You have at lease 2 files in /etc/netplan, the 2nd one is showing:

network:
   ethernets:
     enpls0:
         dhcp4: true

Can you make sure the dhcp4: true line is in that file? If not then add it and then give the command: netplan apply

If you get any errors when running the netplan command, you can post them here.
@Peter Chan

You have closed the question which is fine of course but you have selected a comment that ends with a question. How can a comment that ends with a question be the solution? Can you explain that?

Thanks.