ifconfig shows wrong ipadress

Topics about the Software of Revolution Pi
Post Reply
Peter_Platzer
Posts: 5
Joined: 18 Feb 2024, 12:37
Answers: 0

ifconfig shows wrong ipadress

Post by Peter_Platzer »

Hi!

I am using a RevPi Connect 4 with 2 network ports each connected to a DHCP server.
This is my test setup for tests with a modbus connection.
eth0 is running since several days. IP 10.0.0.48

eth1 I connected today to a network port on a Windows machine where I run a DHCP server.
I use this server https://www.dhcpserver.de/cms/ on the windows machine.

Log from the DHCP server:
[02/19/2024 14:55:00] DHCP Server V2.5.2.3 started as Application
[02/19/2024 14:55:00] NetworkAdapter Initialization returns 0
[02/19/2024 14:55:00] Adapter 0 with IP address 192.168.1.254 found (pAdap=0x0230b618)
[02/19/2024 14:55:00] Adapter 1 with IP address 10.0.0.20 found but not used
[02/19/2024 14:55:51] Adapter 0 has recognized an incoming DHCP request
[02/19/2024 14:55:51] DHCP message = DHCPREQUEST
[02/19/2024 14:55:51] requested options: 1 2 3 6 12 15 26 28 42 44 47 119 121
[02/19/2024 14:55:51] Lookup client data for physical address "C8-3E-A7-10-D8-F9" / client_id "C8-3E-A7-10-D8-F9"
[02/19/2024 14:55:51] Client C8-3E-A7-10-D8-F9 is configured with the IP address 192.168.1.1
[02/19/2024 14:55:51] Response: hand out the configured IP address (lease time = 86400)
[02/19/2024 14:55:51] Sending a broadcast response to the client
[02/19/2024 14:55:51] Connection 0: sending top queue packet

on the revpi is see:
pi@RevPi106990:~ $ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.0.48 netmask 255.255.255.0 broadcast 10.0.0.255
inet6 fe80::ca3e:a7ff:fe10:d8f8 prefixlen 64 scopeid 0x20<link>
ether c8:3e:a7:10:d8:f8 txqueuelen 1000 (Ethernet)
RX packets 1448805 bytes 165317668 (157.6 MiB)
RX errors 0 dropped 808342 overruns 0 frame 0
TX packets 114617 bytes 65735634 (62.6 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 169.254.228.33 netmask 255.255.0.0 broadcast 169.254.255.255
inet6 fe80::ca3e:a7ff:fe10:d8f9 prefixlen 64 scopeid 0x20<link>
ether c8:3e:a7:10:d8:f9 txqueuelen 1000 (Ethernet)
RX packets 94 bytes 10522 (10.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3702 bytes 173239 (169.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 12244 bytes 1035483 (1011.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 12244 bytes 1035483 (1011.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether c8:3e:a7:10:d8:fa txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

So eth1 does not show the correct address but it is possible to ping the revpi with IP 192.168.1.1

C:\>ping 192.168.1.1

Ping wird ausgeführt für 192.168.1.1 mit 32 Bytes Daten:
Antwort von 192.168.1.1: Bytes=32 Zeit<1ms TTL=64
Antwort von 192.168.1.1: Bytes=32 Zeit<1ms TTL=64
Antwort von 192.168.1.1: Bytes=32 Zeit<1ms TTL=64
Antwort von 192.168.1.1: Bytes=32 Zeit<1ms TTL=64

Ping-Statistik für 192.168.1.1:
Pakete: Gesendet = 4, Empfangen = 4, Verloren = 0
(0% Verlust),
Ca. Zeitangaben in Millisek.:
Minimum = 0ms, Maximum = 0ms, Mittelwert = 0ms
DHCP.jpg
Best regards,
Peter
User avatar
nicolaiB
KUNBUS
Posts: 877
Joined: 21 Jun 2018, 10:33
Answers: 8
Location: Berlin
Contact:

Re: ifconfig shows wrong ipadress

Post by nicolaiB »

Hi Peter,

what is the output of `nmcli` and `ip addr show eth1`?

Nicolai
Peter_Platzer
Posts: 5
Joined: 18 Feb 2024, 12:37
Answers: 0

Re: ifconfig shows wrong ipadress

Post by Peter_Platzer »

Hi Nicolai

nmcli

Code: Select all

pi@RevPi106990:~ $ nmcli
eth1: connected to Link-local eth1 (fallback)
        "Microchip LAN7800"
        ethernet (lan78xx), C8:3E:A7:10:D8:F9, hw, mtu 1500
        ip4 default
        inet4 192.168.1.1/24
        inet4 169.254.228.33/16
        route4 224.0.0.0/4
        route4 169.254.0.0/16
        route4 192.168.1.0/24
        route4 0.0.0.0/0
        inet6 fe80::ca3e:a7ff:fe10:d8f9/64
        route6 fe80::/64

eth0: connected to DHCP eth0
        "eth0"
        ethernet (bcmgenet), C8:3E:A7:10:D8:F8, hw, mtu 1500
        inet4 10.0.0.48/24
        route4 0.0.0.0/0
        route4 10.0.0.0/24
        inet6 fe80::ca3e:a7ff:fe10:d8f8/64
        route6 fe80::/64

wlan0: disconnected
        "Broadcom BCM43438 combo and Bluetooth Low Energy"
        wifi (brcmfmac), C8:3E:A7:10:D8:FA, hw, mtu 1500

p2p-dev-wlan0: disconnected
        "p2p-dev-wlan0"
        wifi-p2p, hw

lo: unmanaged
        "lo"
        loopback (unknown), 00:00:00:00:00:00, sw, mtu 65536

DNS configuration:
        servers: 10.0.0.254
        domains: fritz.box
        interface: eth0
und ip addr show eth1

Code: Select all

pi@RevPi106990:~ $ ip addr show eth1
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether c8:3e:a7:10:d8:f9 brd ff:ff:ff:ff:ff:ff
    inet 169.254.228.33/16 brd 169.254.255.255 scope link noprefixroute eth1
       valid_lft forever preferred_lft forever
    inet 192.168.1.1/24 brd 192.168.1.255 scope global dynamic eth1
       valid_lft 68119sec preferred_lft 68119sec
    inet6 fe80::ca3e:a7ff:fe10:d8f9/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
pi@RevPi106990:~ $
Peter
User avatar
nicolaiB
KUNBUS
Posts: 877
Joined: 21 Jun 2018, 10:33
Answers: 8
Location: Berlin
Contact:

Re: ifconfig shows wrong ipadress

Post by nicolaiB »

Hi Peter,

Thats what I thought. Your interface has got the ip from dhcp but uses the link local ip as default (probably because the dhcp server was not ready when the interface was connected).

Side note: ifconfig is a deprecated Linux tool since some years. The ip command is its even more powerful replacement. If you want to configure the interfaces permanently you can do this with nmcli or nmtui (frontend in terminal).

Nicolai
Peter_Platzer
Posts: 5
Joined: 18 Feb 2024, 12:37
Answers: 0

Re: ifconfig shows wrong ipadress

Post by Peter_Platzer »

Thanks Nicolai!
nicolaiB wrote: 19 Feb 2024, 20:47 probably because the dhcp server was not ready when the interface was connected
You are right this was the case, I first connected the network cable and started the dhcp server on the windows machine afterwards.
I did

Code: Select all

sudo dhclient eth1
on the revpi afterwards -> ifconfig did not show 192.168.1.1

Second test from today:
I started the dhcp server first and connected the network cable later. if config shows the IP address correct.

Code: Select all

pi@RevPi106990:~ $ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.0.48  netmask 255.255.255.0  broadcast 10.0.0.255
        inet6 fe80::ca3e:a7ff:fe10:d8f8  prefixlen 64  scopeid 0x20<link>
        ether c8:3e:a7:10:d8:f8  txqueuelen 1000  (Ethernet)
        RX packets 1495159  bytes 175507389 (167.3 MiB)
        RX errors 0  dropped 823443  overruns 0  frame 0
        TX packets 145137  bytes 99082092 (94.4 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.1  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::ca3e:a7ff:fe10:d8f9  prefixlen 64  scopeid 0x20<link>
        ether c8:3e:a7:10:d8:f9  txqueuelen 1000  (Ethernet)
        RX packets 3384  bytes 227306 (221.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 12035  bytes 702139 (685.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 12644  bytes 1071552 (1.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 12644  bytes 1071552 (1.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether c8:3e:a7:10:d8:fa  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
DHCP Server was asked several times for an IP address. Please see the log:

Code: Select all

[02/21/2024 10:10:38] DHCP Server V2.5.2.3 started as Application
[02/21/2024 10:10:38] NetworkAdapter Initialization returns 0
[02/21/2024 10:10:38] Adapter 0 with IP address 10.0.0.20 found but not used
[02/21/2024 10:11:41] DHCP Server is terminating (ignore error messages that follow)
[02/21/2024 10:11:41] DHCP Server terminated
[02/21/2024 10:11:41] DHCP Server V2.5.2.3 started as Application
[02/21/2024 10:11:41] NetworkAdapter Initialization returns 0
[02/21/2024 10:11:41] Adapter 0 with IP address 192.168.1.254 found (pAdap=0x0232b618)
[02/21/2024 10:11:41] Adapter 1 with IP address 10.0.0.20 found but not used
[02/21/2024 10:11:43] Adapter 0 has recognized an incoming DHCP request
[02/21/2024 10:11:43] DHCP message = DHCPDISCOVER
[02/21/2024 10:11:43]    requested options: 1 2 3 6 12 15 17 26 28 33 40 41 42 119 121 249 252
[02/21/2024 10:11:43] Lookup client data for physical address "C8-3E-A7-10-D8-F9" / client_id "C8-3E-A7-10-D8-F9"
[02/21/2024 10:11:43] Client C8-3E-A7-10-D8-F9 is configured with the IP address 192.168.1.1
[02/21/2024 10:11:43] Response: offer the configured IP address (lease time = 86400)
[02/21/2024 10:11:43] Sending a broadcast response to the client
[02/21/2024 10:11:43] Connection 0: sending top queue packet
[02/21/2024 10:11:43] Adapter 0 has recognized an incoming DHCP request
[02/21/2024 10:11:43] DHCP message = DHCPREQUEST
[02/21/2024 10:11:43]    requested options: 1 2 3 6 12 15 17 26 28 33 40 41 42 119 121 249 252
[02/21/2024 10:11:43] Lookup client data for physical address "C8-3E-A7-10-D8-F9" / client_id "C8-3E-A7-10-D8-F9"
[02/21/2024 10:11:43] Client C8-3E-A7-10-D8-F9 is configured with the IP address 192.168.1.1
[02/21/2024 10:11:43] Response: hand out the configured IP address (lease time = 86400)
[02/21/2024 10:11:43] Sending a broadcast response to the client
[02/21/2024 10:11:43] Connection 0: sending top queue packet
[02/21/2024 10:11:55] Adapter 0 has recognized an incoming DHCP request
[02/21/2024 10:11:55] DHCP message = DHCPDISCOVER
[02/21/2024 10:11:55]    requested options: 1 2 3 6 12 15 26 28 42 44 47 119 121
[02/21/2024 10:11:55] Lookup client data for physical address "C8-3E-A7-10-D8-F9" / client_id "C8-3E-A7-10-D8-F9"
[02/21/2024 10:11:55] Client C8-3E-A7-10-D8-F9 is configured with the IP address 192.168.1.1
[02/21/2024 10:11:56] Response: offer the configured IP address (lease time = 86400)
[02/21/2024 10:11:56] Sending a broadcast response to the client
[02/21/2024 10:11:56] Connection 0: sending top queue packet
[02/21/2024 10:11:56] Adapter 0 has recognized an incoming DHCP request
[02/21/2024 10:11:56] DHCP message = DHCPREQUEST
[02/21/2024 10:11:56]    requested options: 1 2 3 6 12 15 26 28 42 44 47 119 121
[02/21/2024 10:11:56] Lookup client data for physical address "C8-3E-A7-10-D8-F9" / client_id "C8-3E-A7-10-D8-F9"
[02/21/2024 10:11:56] Client C8-3E-A7-10-D8-F9 is configured with the IP address 192.168.1.1
[02/21/2024 10:11:56] Response: hand out the configured IP address (lease time = 86400)
[02/21/2024 10:11:56] Sending a broadcast response to the client
[02/21/2024 10:11:56] Connection 0: sending top queue packet
[02/21/2024 10:12:20] Adapter 0 has recognized an incoming DHCP request
[02/21/2024 10:12:20] DHCP message = DHCPDISCOVER
[02/21/2024 10:12:20]    requested options: 1 2 3 6 12 15 26 28 42 44 47 119 121
[02/21/2024 10:12:20] Lookup client data for physical address "C8-3E-A7-10-D8-F9" / client_id "C8-3E-A7-10-D8-F9"
[02/21/2024 10:12:20] Client C8-3E-A7-10-D8-F9 is configured with the IP address 192.168.1.1
[02/21/2024 10:12:20] Response: offer the configured IP address (lease time = 86400)
[02/21/2024 10:12:20] Sending a broadcast response to the client
[02/21/2024 10:12:20] Connection 0: sending top queue packet
[02/21/2024 10:12:20] Adapter 0 has recognized an incoming DHCP request
[02/21/2024 10:12:20] DHCP message = DHCPREQUEST
[02/21/2024 10:12:20]    requested options: 1 2 3 6 12 15 26 28 42 44 47 119 121
[02/21/2024 10:12:20] Lookup client data for physical address "C8-3E-A7-10-D8-F9" / client_id "C8-3E-A7-10-D8-F9"
[02/21/2024 10:12:20] Client C8-3E-A7-10-D8-F9 is configured with the IP address 192.168.1.1
[02/21/2024 10:12:20] Response: hand out the configured IP address (lease time = 86400)
[02/21/2024 10:12:20] Sending a broadcast response to the client
[02/21/2024 10:12:20] Connection 0: sending top queue packet
[02/21/2024 10:13:00] Adapter 0 has recognized an incoming DHCP request
[02/21/2024 10:13:00] DHCP message = DHCPDISCOVER
[02/21/2024 10:13:00]    requested options: 1 2 3 6 12 15 26 28 42 44 47 119 121
[02/21/2024 10:13:00] Lookup client data for physical address "C8-3E-A7-10-D8-F9" / client_id "C8-3E-A7-10-D8-F9"
[02/21/2024 10:13:00] Client C8-3E-A7-10-D8-F9 is configured with the IP address 192.168.1.1
[02/21/2024 10:13:00] Response: offer the configured IP address (lease time = 86400)
[02/21/2024 10:13:00] Sending a broadcast response to the client
[02/21/2024 10:13:00] Connection 0: sending top queue packet
[02/21/2024 10:13:00] Adapter 0 has recognized an incoming DHCP request
[02/21/2024 10:13:00] DHCP message = DHCPREQUEST
[02/21/2024 10:13:00]    requested options: 1 2 3 6 12 15 26 28 42 44 47 119 121
[02/21/2024 10:13:00] Lookup client data for physical address "C8-3E-A7-10-D8-F9" / client_id "C8-3E-A7-10-D8-F9"
[02/21/2024 10:13:00] Client C8-3E-A7-10-D8-F9 is configured with the IP address 192.168.1.1
[02/21/2024 10:13:01] Response: hand out the configured IP address (lease time = 86400)
[02/21/2024 10:13:01] Sending a broadcast response to the client
[02/21/2024 10:13:01] Connection 0: sending top queue packet
[02/21/2024 10:14:24] Adapter 0 has recognized an incoming DHCP request
[02/21/2024 10:14:24] DHCP message = DHCPDISCOVER
[02/21/2024 10:14:24]    requested options: 1 2 3 6 12 15 26 28 42 44 47 119 121
[02/21/2024 10:14:24] Lookup client data for physical address "C8-3E-A7-10-D8-F9" / client_id "C8-3E-A7-10-D8-F9"
[02/21/2024 10:14:24] Client C8-3E-A7-10-D8-F9 is configured with the IP address 192.168.1.1
[02/21/2024 10:14:24] Response: offer the configured IP address (lease time = 86400)
[02/21/2024 10:14:24] Sending a broadcast response to the client
[02/21/2024 10:14:24] Connection 0: sending top queue packet
[02/21/2024 10:14:24] Adapter 0 has recognized an incoming DHCP request
[02/21/2024 10:14:24] DHCP message = DHCPREQUEST
[02/21/2024 10:14:24]    requested options: 1 2 3 6 12 15 26 28 42 44 47 119 121
[02/21/2024 10:14:24] Lookup client data for physical address "C8-3E-A7-10-D8-F9" / client_id "C8-3E-A7-10-D8-F9"
[02/21/2024 10:14:24] Client C8-3E-A7-10-D8-F9 is configured with the IP address 192.168.1.1
[02/21/2024 10:14:24] Response: hand out the configured IP address (lease time = 86400)
[02/21/2024 10:14:24] Sending a broadcast response to the client
[02/21/2024 10:14:24] Connection 0: sending top queue packet
Thanks for you help!
BR Peter
Post Reply