Initializing network after system installation

Ladies and gentlemen, sorry for a silly question but I am absolutely new to the Linux world and therefore need help.
I installed Rocky Linux 9.2 yesterday. However at that time computer’s Ethernet ports were disconnected from the network, and therefore I did not configure the network options at all. Now I would like to set up the network/Internet access, that is enable DHCP and all… but I do not know how to. Is there any document describing adding the network configuration after the system installation - in enough details so that even a novice like myself could follow it?
Thank you in advance,
Mike F

1 Like

Plug in the cable and then run in terminal nmcli
What does it show?

(In other words, the network ought to auto-configure; use of DHCP is the default.)

Hi jlehtone,
thiis is what I would assume. However the nmcli says:
image
As you can see it says “disconnected” despite that the lights on the both sides of the network cable are blinking like they are supposed to…
Thank you!
Mike F

Hi jlehtone,
one more thing. Here kis what “nmcli connection show” and “nmcli device show” commands return:


I think - maybe it is that the driver for this adapter was not installed?
Thank you again,
Mike F

I think if driver is not installed then device itself will not show up. Try bring up the NIC by running nmcli con up ens1f0np0. If this did not help, then try to set static IP like this for example :

# nmcli con mod ens1f0np0 ipv4.addresses "192.168.1.4/24" gw4 192.168.1.1
# nmcli con mod ens1f0np0 ipv4.method manual
# nmcli con mod ens1f0np0 ipv4.dns "192.168.1.1"
# nmcli con up ens1f0np0

(change the static IP and dns IP to match your LAN)

1 Like

You do have two connections defined, but they are down for some reason. Within the output of these:

nmcli -f connection con show ens1f0np0
nmcli -f connection con show ens1f1np1

… should be field “autoconnect”. That field tells whether NetworkManager attempts to start connections automatically (on boot & on link).

You also have two devices (note, the nmcli device state or nmcli d s for short shows more compact version than the show).
They would not show up, if you had no driver. Without driver you see something only with lspci.
With lspci -nn there is also device ID (in brackets). The ID is precise description of the device.

You can also look at logs (of service) with:

sudo journalctl -u NetworkManager

Thank you jlehtone and prasad! The things continue to surprise me:

  1. Trying to auto-connect by setting the connection up fails, however as soon as I set a static IP address the connection was successful:
    image
    However a subsequent attempt switching to the dynamic IP (as long as I understand this is what autoconnect parameter does) failed again. What can cause this?
  2. OK, I seem to be connected according to the nmcli report - but all my attempts pinging another network nodes (except for the self, by 127.0.0.1) fail. What might that be?
  3. I tried using the journalct1 command only to be kicked off with the “command not found”. Should I install this service additionally somehow?
    Thank you once again,
    Mike F

journalctl is installed by default. The last character is a lower case “L” and not a numeral 1 as observed in your post.

jbkt23, thank you! My bad! Still, this is the secondary issue…

The 'man nm-settings writes:

connection settings
autoconnect
Whether or not the connection should be automatically connected by NetworkManager when the resources for the connection are available. TRUE to automatically activate the connection, FALSE to require manual intervention to activate the connection.

and:

ipv4 settings
method
IP configuration method.

NMSettingIP4Config and NMSettingIP6Config both support “disabled”, “auto”, “manual”, and “link-local”. See the subclass-specific documentation for other values.

In general, for the “auto” method, properties such as “dns” and “routes” specify information that is added on to the information returned from automatic configuration. The “ignore-auto-routes” and “ignore-auto-dns” properties modify this behavior.

In other words:

  • connection.autoconnect says whether connection should start on boot, regardless of method. You want yes there
  • ipv4.method says how to configure IPv4 settings (auto = with DHCP, manual = static values)

The machine/port does not seem to be connected and the issue is not the IPv4 config.

What is the output of lspci -nn | grep -i net ? (The device ID that is in brackets?)

I appreciate the enthusiasm!
I look forward to new additions!
But I don’t understand why after registering in this forum the first article is not reviewed?

Not sought and seen what it says here:
https://docs.rockylinux.org/gemstones/nmtui/
With a direct link and an answer to your question.

Hi jlehtone,
here is the output of the suggested lspci command:

Now what I found out is that the assigned static IP cannot be pinged from the outside, which tells me that there is still something wrong in thte network configuration. Will try to investigate as much as possible…

Best regards,
Mike F

Xino, thank you! Didn’t help unfortunately :frowning:
The external nodes are not visible, and this machine cannot be pinged from another nodes as well…

Regards,
Mike F

On the contrary!
This is the solution.
The question is whether you know what is required for the network setup of this host in question.
Since you don’t say what you see and/or have set up in nmtui
Is there at least a default gateway set up?
Is there a specified DNS?
Is there a working firewall?
It is incorrect to say that you were not provided with documentation as you requested.
Please answer the question, do you know what is required and necessary for the network this host is running on.
For example: it is enough to enter a wrong mask and your host will never be accessible from outside.
For this, please help with correct information, we will also help you.
Regards,

Looks like the host has trouble getting IP from DHCP. Remove the static IP and run dhclient ens1f0np0 command. If the interface no IP assigned then you need to check your LAN network for firewall or NAT issues.

Successful dhclient command will emit logs something like below output to /var/log/messages file :

messages:Jul 12 18:21:05 desktop dhclient[4863]: DHCPOFFER of 192.168.1.152 from 192.168.1.1
messages:Jul 12 18:21:05 desktop dhclient[4863]: DHCPREQUEST for 192.168.1.152 on enp4s0 to 255.255.255.255 port 67 (xid=0x26dbaa74)
messages:Jul 12 18:21:05 desktop dhclient[4863]: DHCPACK of 192.168.1.152 from 192.168.1.1 (xid=0x26dbaa74)
messages:Jul 12 18:21:07 desktop NET[4913]: /usr/sbin/dhclient-script : updated /etc/resolv.conf
messages:Jul 12 18:21:07 desktop dhclient[4863]: bound to 192.168.1.152 -- renewal in 3578 seconds.```

Let me add something for DHCP client of NetworkManager
The built-in DHCP client does not work correctly with relayed DHCP servers in to large network of ISP.
I highly recommend install dhclient - ISC DHCP
dnf install dhclient
Not forgetting to tell NetworkManager to use it.
Regards,

1 Like

Hi Xino and prasad, thank you so much for your input. I was away from the case these days unfortunately but now i am slowly (ugh!) getting back to it. Now to answer your questions.

  1. Yes, I know how to set up network in general - did it zillion times on Windows machines;
  2. The configuration I was using - in nmtui - looks like follows:

    I believe this is a legit configuration.
  3. Now I followed prasad’s advice and turned off static IP assignment. The nmtui screen displays as In the next post (I cannot post more than one attachment)
  4. It changed nothing as far as I am concerned. However when I tried running the dhclient command like: dhclient ens1f0np0, the response was like in the second following post
  5. I ran nmcli and this is what I saw I will post in the third post after this
  6. Still, I cannot ping anything (both external addresses and the server itself from the outside).
  7. Yes, theoretically the physical connection may be at fault (I will double-check it when in the office :)) but I am using a brand new cable and it is connected through a dump 4-port hub, all other ports of it work just fine…

Best regards,
Mike F.

DL380_Nmtui_002

image

image