where is the static IP address stored after graphical configured?

1. Background

I installed Debian 11.8 with desktop environment and GNOME in VMware Workstation.
After installation, I configured a static IP using the graphical interface.
One day, when the Debian server started in command line mode, I sought to modify the static IP but was unable to locate the configuration.

2. Process

1> I examined /etc/network/interfaces but found it devoid of any relevant entries.
2> I attempted to locate the configuration file using a Linux command, resulting in logs such as:
find / -type f -name "*.*" | xargs grep -n "192.168.1.6" 2>/dev/null

/var/log/daemon.log:159:avahi-daemon[428]: Joining mDNS multicast group on interface ens32.IPv4 with address 192.168.1.6.
/var/log/daemon.log:161:avahi-daemon[428]: Registering new address record for 192.168.1.6 on ens32.IPv4.

3> I referred to the Debian wiki and discovered four methods to configure the network.
Upon checking NetworkManager, I identified a connection labeled ‘Wired connection 1’.
(1)service NetworkManager status to check service status

● NetworkManager.service - Network Manager
     Loaded: loaded (/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2024-08-18 13:34:34 HKT; 14min ago
       Docs: man:NetworkManager(8)
   Main PID: 431 (NetworkManager)
      Tasks: 3 (limit: 1056)
     Memory: 9.3M
        CPU: 130ms
     CGroup: /system.slice/NetworkManager.service
             └─431 /usr/sbin/NetworkManager --no-daemon

device (ens32): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
device (ens32): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'managed')
device (ens32): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'managed')
device (ens32): state change: secondaries -> activated (reason 'none', sys-iface-state: 'managed')
manager: NetworkManager state is now CONNECTED_LOCAL
manager: NetworkManager state is now CONNECTED_SITE
policy: set 'Wired connection 1' (ens32) as default for IPv4 routing and DNS
device (ens32): Activation: successful, device activated.
manager: NetworkManager state is now CONNECTED_GLOBAL
manager: startup complete

(2) I invoked nmcli to ascertain the IP address:

ens32: connected to Wired connection 1
        "Intel 82545EM"
        ethernet (e1000), AA:BB:CC:DD:EE:FF, hw, mtu 1500
        ip4 default
        inet4 192.168.1.6/24
        route4 192.168.1.0/24
        route4 0.0.0.0/0

(3) I executed nmcli c show show to review the connection list:

Wired connection 1  aaaaaa-bbbb-cccc-dddd-eeeeeeeeee ethernet  ens32 

(4)/etc/NetworkManager/system-connections/Wired\ connection\ 1 found detail:

[connection]
id=Wired connection 1
uuid=aaaaaa-bbbb-cccc-dddd-eeeeeeeeee
type=ethernet
permissions=
timestamp=1705496932

[ethernet]
mac-address-blacklist=

[ipv4]
address1=192.168.1.6/24,192.168.1.2
dns=192.168.1.2;
dns-search=
ignore-auto-dns=true
method=manual

[ipv6]
addr-gen-mode=eui64
dns-search=
ip6-privacy=2
method=disabled

[proxy]

(5) how to modify

vi /etc/NetworkManager/system-connections/Wired\ connection\ 1  
nmcli c reload  
nmcli c up Wired\ connection\ 1  

3. Result

1> Thus, the answer is : the static ip is stored in ‘/etc/NetworkManager/system-connections/Wired connection 1’
2> When a filename contains spaces or lacks a suffix, the Linux command should be modified to:
find . -type f -name "*" -print0 | xargs -0 grep -n "192.168.1.6"

4. Reference

debian wiki
NetworkManager nmcli

Tags:

Categories:

Updated:

Comments