Why one interface has two addresses [SOLVED]

I notice that my ethernet interface connected to ISP’s router has two ip addresses, like this:

3: enp6s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 30:5a:3a:47:07:72 brd ff:ff:ff:ff:ff:ff
inet 192.168.2.13/24 brd 192.168.2.255 scope global dynamic noprefixroute enp6s0
valid_lft 242739sec preferred_lft 242739sec
inet 192.168.2.18/24 brd 192.168.2.255 scope global secondary dynamic noprefixroute enp6s0
valid_lft 242748sec preferred_lft 210348sec

Only the 192.168.2.18 works for remote connections via port-forwarding. Why are there two IP addresses?

Two dhcp clients running? Check the usually suspects and make sure you are only using one.

1 Like

arp poisoning - reboot your network - that is power everything down - and power up in sequence starting with your router.

though not as exciting, I think xabbu is on the right track. Here from my logs:

Oct 30 08:58:17 gandalf NetworkManager[519]: [1604062697.6145] dhcp4 (enp6s0): option ip_address => ‘192.168.2.13’

and

Oct 30 08:58:24 gandalf dhcpcd[937]: enp6s0: leased 192.168.2.18 for 259200 seconds

If I disable networkmanager service then only .18 is assigned …

Do you know how to disable networkmanager’s dhcp client?

if you use network manager - disable dhcpcd

systemctl disable --now dhcpcd

If you use dhcpcd - disable network manager

systemctl disable --now NetworkManager
1 Like

Actually, if I disable both NetworkManager and dhcpcd I still get the 192.168.0.18 address at boot, the log shows:

Oct 30 09:13:49 gandalf dhcpcd[934]: enp6s0: leased 192.168.2.18 for 259200 seconds

What’s calling /usr/bin/dhcpcd I wonder ?

Check

systemctl status dhcpcd

the output of systemctl status dhcpcd:

dhcpcd.service - dhcpcd on all interfaces
Loaded: loaded (/usr/lib/systemd/system/dhcpcd.service; disabled; vendor preset: disabled)
Active: inactive (dead)

the service dhcpcd is not running but I guess something is calling the program dhcpcd at boot, if that makes any sense

Is dhcpd still running?

Check

systemctl status

If it is running, it should show which service started the binary.


You can also check the journal with -o verbose

For exmaple

journalctl -o verbose --since "09:13:40" --until "09:13:50" 

You guys are great :slight_smile:
The verbose logs show netctl calling dhcpcd according to the interface’s profile. So I don’t need networkmanager or dhcpcd service, which I like. All good, thanks. I’ll mark solved.

(Mod Note - while others assisted in finding the logs and such … your post best describes the issue, its cause, and possible response. So I have marked that as the solution for now.)

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.