LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-01-2023, 10:41 PM   #1
killingthemonkey
Member
 
Registered: Mar 2011
Location: Winston-Salem, NC
Distribution: Fedora, CentOS, Linux Mint
Posts: 259

Rep: Reputation: 24
Fedora 38 - IP Keeps Changing


I have an Alienware Alpha that I am using as a Monero miner. It is running Fedora 38. This is my uname -a:

Code:
Linux localhost.localdomain 6.2.14-300.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Mon May  1 00:55:28 UTC 2023 x86_64 GNU/Linux
I connect to it via SSH and leave it running in the morning. I come back later and see in the terminal it says there was a broken pipe and I see the local prompt. I attempt to reconnect and there is no path. I do a quick nmap and see that the IP has changed.

My first thought is that it has updated, and rebooted, (something I want to prevent), but uptime shows I've been up for three days.

How do I check why my IP changed?
 
Old 07-02-2023, 12:13 AM   #2
lvm_
Senior Member
 
Registered: Jul 2020
Posts: 1,014

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
Search for dhcp in system logs.
 
Old 07-02-2023, 08:57 AM   #3
killingthemonkey
Member
 
Registered: Mar 2011
Location: Winston-Salem, NC
Distribution: Fedora, CentOS, Linux Mint
Posts: 259

Original Poster
Rep: Reputation: 24
OK, I run journalctl -b | grep lease and get this:

Code:
Jul 02 05:54:00 localhost.localdomain NetworkManager[841]: <info>  [1688291640.4016] dhcp4 (wlp4s0): state changed no lease
Jul 02 05:54:00 localhost.localdomain NetworkManager[841]: <info>  [1688291640.4137] dhcp4 (wlp4s0): state changed new lease, address=192.168.4.130
Jul 02 05:54:34 localhost.localdomain NetworkManager[841]: <info>  [1688291674.9626] dhcp4 (wlp4s0): state changed no lease
Jul 02 05:54:34 localhost.localdomain NetworkManager[841]: <info>  [1688291674.9764] dhcp4 (wlp4s0): state changed new lease, address=192.168.4.130
Jul 02 07:39:20 localhost.localdomain NetworkManager[841]: <info>  [1688297960.9899] dhcp4 (wlp4s0): state changed new lease, address=192.168.4.130
Jul 02 09:13:46 localhost.localdomain NetworkManager[841]: <info>  [1688303626.4009] dhcp4 (wlp4s0): state changed no lease
Jul 02 09:13:46 localhost.localdomain NetworkManager[841]: <info>  [1688303626.4133] dhcp4 (wlp4s0): state changed new lease, address=192.168.4.130
Jul 02 09:13:46 localhost.localdomain NetworkManager[841]: <info>  [1688303626.7066] dhcp4 (wlp4s0): state changed no lease
Jul 02 09:13:46 localhost.localdomain NetworkManager[841]: <info>  [1688303626.7251] dhcp4 (wlp4s0): state changed new lease, address=192.168.4.130
Jul 02 09:13:46 localhost.localdomain NetworkManager[841]: <info>  [1688303626.9906] dhcp4 (wlp4s0): state changed no lease
Jul 02 09:13:47 localhost.localdomain NetworkManager[841]: <info>  [1688303627.0020] dhcp4 (wlp4s0): state changed new lease, address=192.168.4.130
Jul 02 09:13:48 localhost.localdomain NetworkManager[841]: <info>  [1688303628.1246] dhcp4 (wlp4s0): state changed no lease
Jul 02 09:13:48 localhost.localdomain NetworkManager[841]: <info>  [1688303628.1504] dhcp4 (wlp4s0): state changed new lease, address=192.168.4.130
Jul 02 09:14:04 localhost.localdomain NetworkManager[841]: <info>  [1688303644.3566] dhcp4 (wlp4s0): state changed no lease
Jul 02 09:14:04 localhost.localdomain NetworkManager[841]: <info>  [1688303644.5946] dhcp4 (wlp4s0): state changed no lease
Jul 02 09:14:06 localhost.localdomain NetworkManager[841]: <info>  [1688303646.6083] dhcp4 (wlp4s0): state changed new lease, address=192.168.4.130
Jul 02 09:14:39 localhost.localdomain NetworkManager[841]: <info>  [1688303679.1636] dhcp4 (wlp4s0): state changed no lease
Jul 02 09:14:39 localhost.localdomain NetworkManager[841]: <info>  [1688303679.1798] dhcp4 (wlp4s0): state changed new lease, address=192.168.4.130
Jul 02 09:31:35 localhost.localdomain NetworkManager[841]: <info>  [1688304695.0366] dhcp4 (wlp4s0): state changed no lease
Jul 02 09:31:35 localhost.localdomain NetworkManager[841]: <info>  [1688304695.0449] dhcp4 (wlp4s0): state changed new lease, address=192.168.4.130
Jul 02 09:32:08 localhost.localdomain NetworkManager[841]: <info>  [1688304728.6556] dhcp4 (wlp4s0): state changed no lease
Jul 02 09:32:08 localhost.localdomain NetworkManager[841]: <info>  [1688304728.6707] dhcp4 (wlp4s0): state changed new lease, address=192.168.4.130
Jul 02 09:48:36 localhost.localdomain NetworkManager[841]: <info>  [1688305716.6026] dhcp4 (wlp4s0): state changed no lease
Jul 02 09:48:36 localhost.localdomain NetworkManager[841]: <info>  [1688305716.6113] dhcp4 (wlp4s0): state changed new lease, address=192.168.4.130

There is more of the same. But it looks like it's renewing the lease repeatedly. Several times in the same minute.

I am going to try and set a static IP later.
 
Old 07-02-2023, 04:37 PM   #4
killingthemonkey
Member
 
Registered: Mar 2011
Location: Winston-Salem, NC
Distribution: Fedora, CentOS, Linux Mint
Posts: 259

Original Poster
Rep: Reputation: 24
Now, I have two IPs on same adapter:

Code:
inet 192.168.4.100/24 brd 192.168.4.255 scope global noprefixroute wlp4s0
inet 192.168.4.133/22 brd 192.168.7.255 scope global dynamic noprefixroute wlp4s0
I used nmcli to set the .100 address. The .133 is the one assigned by DHCP.

Do I use nmcli to delete the DHCP connection. I am able to SSH to the .100.
 
Old 07-02-2023, 08:04 PM   #5
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,174

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
check lease time:

sudo grep dhclient /var/log/syslog

or check the output of this, I believe it will also show lease time.

nmcli -f ipv4.method con show "`nmcli -t -f NAME connection `"
 
Old 07-02-2023, 10:09 PM   #6
killingthemonkey
Member
 
Registered: Mar 2011
Location: Winston-Salem, NC
Distribution: Fedora, CentOS, Linux Mint
Posts: 259

Original Poster
Rep: Reputation: 24
Quote:
Originally Posted by JJJCR View Post
nmcli -f ipv4.method con show "`nmcli -t -f NAME connection `"
About to display my ignorance here.

What goes in place of NAME?

I've tried a couple different things with no luck. eg. UUID, SSID, wlp4s0
 
Old 07-03-2023, 09:28 AM   #7
jkirchner
Member
 
Registered: Apr 2007
Location: West Virginia
Distribution: Pop!_OS
Posts: 945

Rep: Reputation: 297Reputation: 297Reputation: 297
If you enter the code into command line as shown it will give you the name of your connection. I tested it.

Code:
nmcli -f ipv4.method con show "`nmcli -t -f NAME connection `"
 
Old 07-03-2023, 10:03 AM   #8
killingthemonkey
Member
 
Registered: Mar 2011
Location: Winston-Salem, NC
Distribution: Fedora, CentOS, Linux Mint
Posts: 259

Original Poster
Rep: Reputation: 24
Quote:
Originally Posted by jkirchner View Post
If you enter the code into command line as shown it will give you the name of your connection. I tested it.

Code:
nmcli -f ipv4.method con show "`nmcli -t -f NAME connection `"
Thank you for that.
My problem, the first time I ran it, I typed it but didn't see the single quotes. Copy/Pasta and it worked.

The return:
Code:
Error: <SSID>
lo

Last edited by killingthemonkey; 07-03-2023 at 01:49 PM.
 
Old 07-04-2023, 03:59 PM   #9
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,905
Blog Entries: 1

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Fedora offers systemd-networkd rpm. All my F38s use it only, and only it for static IP setup. They don't need network "management". They never leave the premises.
Code:
# uname -r
6.3.11-200.fc38.x86_64
# rpm -qa | grep -E 'netw|solv' | sort
glib-networking-2.76.1-1.fc38.x86_64
kf5-networkmanager-qt-5.107.0-1.fc38.x86_64
libsolv-0.7.22-4.fc38.x86_64
network-scripts-10.19-1.fc38.x86_64
systemd-networkd-253.5-1.fc38.x86_64
systemd-resolved-253.5-1.fc38.x86_64
# systemctl list-unit-files | grep -E 'net|solv' | sort
dbus-org.freedesktop.network1.service   alias           -
network-online.target                   static          -
network-pre.target                      static          -
network.service                         generated       -
network.target                          static          -
systemd-network-generator.service       enabled         enabled
systemd-networkd-wait-online.service    enabled         disabled
systemd-networkd-wait-online@.service   disabled        disabled
systemd-networkd.service                enabled         disabled
systemd-networkd.socket                 enabled         disabled
systemd-resolved.service                masked          enabled
# cat /etc/systemd/network/eth0.network
[Match]
PermanentMACAddress=##:##:##:##:##:##

[Network]
Address=xxx.xxx.xxx.zzz/24
DNS=xxx.xxx.xxx.xxx yyy.yyy.yyy.yyy
Gateway=xxx.xxx.xxx.xxx
IPv6AcceptRA=no
LinkLocalAddressing=no
#
 
1 members found this post helpful.
Old 07-05-2023, 06:33 AM   #10
killingthemonkey
Member
 
Registered: Mar 2011
Location: Winston-Salem, NC
Distribution: Fedora, CentOS, Linux Mint
Posts: 259

Original Poster
Rep: Reputation: 24
Quote:
Originally Posted by mrmazda View Post
Fedora offers systemd-networkd rpm. All my F38s use it only, and only it for static IP setup. They don't need network "management". They never leave the premises.
Code:
# uname -r
6.3.11-200.fc38.x86_64
# rpm -qa | grep -E 'netw|solv' | sort
glib-networking-2.76.1-1.fc38.x86_64
kf5-networkmanager-qt-5.107.0-1.fc38.x86_64
libsolv-0.7.22-4.fc38.x86_64
network-scripts-10.19-1.fc38.x86_64
systemd-networkd-253.5-1.fc38.x86_64
systemd-resolved-253.5-1.fc38.x86_64
# systemctl list-unit-files | grep -E 'net|solv' | sort
dbus-org.freedesktop.network1.service   alias           -
network-online.target                   static          -
network-pre.target                      static          -
network.service                         generated       -
network.target                          static          -
systemd-network-generator.service       enabled         enabled
systemd-networkd-wait-online.service    enabled         disabled
systemd-networkd-wait-online@.service   disabled        disabled
systemd-networkd.service                enabled         disabled
systemd-networkd.socket                 enabled         disabled
systemd-resolved.service                masked          enabled
# cat /etc/systemd/network/eth0.network
[Match]
PermanentMACAddress=##:##:##:##:##:##

[Network]
Address=xxx.xxx.xxx.zzz/24
DNS=xxx.xxx.xxx.xxx yyy.yyy.yyy.yyy
Gateway=xxx.xxx.xxx.xxx
IPv6AcceptRA=no
LinkLocalAddressing=no
#
I followed you right to here:
Code:
# cat /etc/systemd/network/eth0.network
My /etc/systemd/network/ folder is empty.

I've already got the static IP set via [i]network management[/] and it is stable. And this box is in the same status as yours. Never moves. Is there any bonus to me messing with the setup now? If so, should I create the file, or is there a generator for it?
 
Old 07-05-2023, 11:26 AM   #11
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,905
Blog Entries: 1

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Quote:
Originally Posted by killingthemonkey View Post
I followed you right to here:
Code:
# cat /etc/systemd/network/eth0.network
My /etc/systemd/network/ folder is empty.
Until you wish to use systemd-networkd and create a file within it, there's no need for it to exist. When I wanted to make the switch, Google found multiple howtos, e.g. in the ArchLinux Wiki.

Quote:
I've already got the static IP set via [i]network management[/] and it is stable. And this box is in the same status as yours. Never moves. Is there any bonus to me messing with the setup now? If so, should I create the file, or is there a generator for it?
I've never used "network management". It sounds like a GUI tool for using NetworkManager. The only relationship between NetworkManager and systemd-networkd that I'm aware of is they are both capable of configuring networking.
 
Old 07-06-2023, 04:26 AM   #12
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,174

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
This folder exist:

cat /var/lib/dhcp/dhclient.leases

If yes check the lease time.

If not try this:

dhcp-lease-list

or this:

nmcli -f DHCP4 device show "wlp4s0"
 
Old 07-07-2023, 05:05 PM   #13
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Quote:
Originally Posted by killingthemonkey View Post
I have an Alienware Alpha that I am using as a Monero miner. It is running Fedora 38. This is my uname -a:

Code:
Linux localhost.localdomain 6.2.14-300.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Mon May  1 00:55:28 UTC 2023 x86_64 GNU/Linux
I connect to it via SSH and leave it running in the morning. I come back later and see in the terminal it says there was a broken pipe and I see the local prompt.
Fedora 38 by default automatically suspends after 15 minutes of no desktop activity (defined as keyboard or mouse) and ssh connections are victims of that behavior. Even VMs were killed by that behavior on the host.

On my fedora machine I halted that behavior by doing
Code:
systemctl mask {hibernate,sleep,suspend,hybrid-sleep}.service
There are other ways to disable the auto-suspend but it worked for me.

On the askfedora forum there were many complaints about that change since users running services or connecting remotely were being automatically disconnected as you describe.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Fedora 9 -system/desktop clock keeps changing smurthy Linux - General 15 02-23-2009 10:47 PM
icon name keeps changing beckwith Linux - Newbie 6 09-23-2003 12:43 AM
time keeps changing mcd Linux - Newbie 2 08-22-2003 08:12 AM
Time keeps changing eternity1700 Linux - General 2 02-17-2003 12:06 AM
WHY DOES /dev/cdrom KEEP CHANGING?? CD ROM DRIVE DEVICE KEEPS MOVING?? falcon56215 Linux - General 0 01-23-2002 02:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration