You are not logged in.

#1 2021-06-14 19:20:25

b0ss_
Member
Registered: 2021-01-16
Posts: 83

[SOLVED] DHCPCD Issues (DHCPCD as network manager)

Hello fellas, I hope you're all having a nice day. I've been working on this little pet project of mine, but it has always had issues with networking.

So. Jumping all the details, I'll go to the issue I have at the moment. I stopped using NetworkManager because the server was having issues with some services, issues I got
to fix using dhcpcd (as a utililitie) and giving the server a propper IPv4 address and configuration. With a bit of research, I learned that it was an issue because it's either NetworkManager or DHCPCD. I went for DHCPCD.

I disabled NetworkManager for obvious reasons, and enabled dhcpcd@enp4s0 (my Ethernet NIC). I started reading the man pages for dhcpcd.conf and started to work on my config file for DHCPCD. After all that, well, I'm having troubles with the DNS, shown at the fact that I try to ping archlinux.org and receive a Temporary Failure in name resolution. Alright, then it may be a problem in resolv.conf. Before editing the file, I pinged my gateway, and get a Host Unreachable. I'll type my config files.

/etc/dhcpcd.conf:

hostname
clientid
persistent
vendorclassid
option domain_name_servers, domain_name, domain_search
option classless_static_routers
option interface_mtu
option host_name
option rapid_commit
nohook resolv.conf
nooption domain_name_servers
slaac hwaddr
noipv6rs
noipv6
interface enp4s0
ipv4
static ip_address=192.168.1.130/24

/etc/resolv.conf

nameserver 1.1.1.1
nameserver 8.8.8.8
nameserver 8.8.4.4

Output of ip link:

2: enp4s0 <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 00:25:ab:32:86:7c ff:ff:ff:ff:ff:ff:ff

Output of ip address:

2: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 00:25:ab:32:86:7c ff:ff:ff:ff:ff:ff:ff
    inet 192.168.1.130/24 brd 192.168.1.255 scope global noprefixroute enp4s0
        valid_lft forever preferred_lft forever
    inet6 fe80::225:abff:fe32:867c/64 scope link
        valid_lft forever preferred_lft forever

Thanks for reading!

Last edited by b0ss_ (2021-06-15 15:52:38)

Offline

#2 2021-06-14 21:46:53

seth
Member
Registered: 2012-09-03
Posts: 50,957

Re: [SOLVED] DHCPCD Issues (DHCPCD as network manager)

You're using dhcpcd to configure a static IP - is this actually what you want?
Is there a dhcp server in the network?

sudo nmap --script broadcast-dhcp-discover

Do you have a route?

ip r

Can you ping the (likely) gateway by IP? Broadcast? Google?

ping 192.168.1.1
ping -b 192.168.1.255
ping 8.8.8.8

Offline

#3 2021-06-14 22:28:47

b0ss_
Member
Registered: 2021-01-16
Posts: 83

Re: [SOLVED] DHCPCD Issues (DHCPCD as network manager)

From the server, the output of ip r is the following:

192.168.1.0/24 dev enp4s0 proto dhcp scope link src 192.168.1.130 metric 1002

Pinging 192.168.1.1 from my main Arch machine works as expected, now I tried to ping 192.168.1.1 from the faulty networking machine and... I get a response.
Although just from the gateway and the broadcast (that is, I believe, .255)

Trying to ping 8.8.8.8 gives me a Network is unreachable. I can ping from my PC to the server and the server to my PC. So I guess it's working, at least inside the network.

The output of the nmap --script broadcast-dhcp-discover:

sudo nmap --script broadcast-dhcp-discover
Starting Nmap 7.91 ( https://nmap.org ) at 2021-06-14 18:14 -04
Pre-scan script results:
| broadcast-dhcp-discover:
|   Response 1 of 1:
|     Interface: enp2s0
|     IP Offered: 192.168.1.92
|     DHCP Message Type: DHCPOFFER
|     Server Identifier: 192.168.1.1
|     IP Address Lease Time: 8h00m00s
|     Subnet Mask: 255.255.255.0
|     Router: 192.168.1.1
|_    Domain Name Server: 200.28.4.130, 200.28.4.129
WARNING: No targets were specified, so 0 hosts scanned.
Nmap done: 0 IP addresses (0 hosts up) scanned in 10.89 seconds

And although I have my own reasons to believe that the actual broadcast is 192.168.1.85, as it's the IPv4 I get redirected to when I run a ping 192.168.1.255 (from the server and from my PC).

PS: I made sure that the network was working inside and/or outside the network via accessing of the services the server provides being inside the network and outside of it. It's just local at the moment.
PS2: I'm running noip2

Thanks for reading!

Offline

#4 2021-06-15 05:21:07

seth
Member
Registered: 2012-09-03
Posts: 50,957

Re: [SOLVED] DHCPCD Issues (DHCPCD as network manager)

the actual broadcast is 192.168.1.85

It's the IP that responds (you're *broad*casting, the broadcast IP is *.255)

Since there's a dhcp server and it offers you a lease, why do you try to use a static IP?
Is the router configured to allow that at all?

noip is unlikely the issue here (since it's a dyndns service; it'll use the WAN IP of the NAT'ing router anyway)

I assume the dhcpcd.conf is "stuff I found on the interwebz and threw against the wall because it didnt work?"
Unless you've specific reasons for at least some of the lines there and know what they do, please replace it w/ the default config, stop the dhcpcd.service and run "sudo dhcpcd -Bd"
The post its output as well as "ip a; ip r" and check whether you can ping 192.168.1.1 and 8.8.8.8

Offline

#5 2021-06-15 14:43:23

b0ss_
Member
Registered: 2021-01-16
Posts: 83

Re: [SOLVED] DHCPCD Issues (DHCPCD as network manager)

The config I sent you was mostly the default one (without the comments). The only lines I added were:

nohook resolv.conf (the file it's chattr +i so I don't let dhcpcd touch it)
nooption domain_name_servers
slaac hwaddr
noipv6 (because many times when using DHCPCD it asks for a IPv6 addr instead of an IPv4 addr)
noipv6rs
interface enp4s0
ipv4
static ip_address=yadda yadda

The reason I'm using an static IP address is because I have some ports open on this specific machine and well, in need of port forwarding I don't want to be changing my router's port mapping once a week or month (or even day) because I want it to work as it is. With an static IP address.

While reading more about dhcpcd.conf(5) I saw that maybe I could just use "ipv4only":

ipv4only
             Only configure IPv4.

I will try to run your command. I did, and nothing has changed (I didn't delete my config since I know what I'm doing (partially)). I am still able to ping my gateway with success, but unable to ping 8.8.8.8 and 8.8.4.4.

PS: I have systemd-revolved disabled and stopped. Should it be enabled/started?

Offline

#6 2021-06-15 15:05:03

seth
Member
Registered: 2012-09-03
Posts: 50,957

Re: [SOLVED] DHCPCD Issues (DHCPCD as network manager)

If it's your router, pin the IP to your MAC there and let dhcp manage the IP.
Also the idea was to post the dhcpcd output.

resolved should not be used but it's also not the present obstacle. As long as you can't ping WAN IPs, DNS is not the issue.

Offline

#7 2021-06-15 15:13:17

b0ss_
Member
Registered: 2021-01-16
Posts: 83

Re: [SOLVED] DHCPCD Issues (DHCPCD as network manager)

Oh damn I read that wrong, I will send the output:

$ sudo dhcpcd -Bd
dhcpcd-9.4.0 starting
udev: starting
dev: loaded udev
spawned privileged actioneer on PID 15128
spawned network proxy on PID 15130
spawned controller proxy on PID 15131
DUID 00:04:0b:58:fd:80:8a:5a:c3:15:8c:3c:73:2a:e2:f4:e4:22
sandbox: seccomp
lo: ignoring due to interface type and no config
enp4s0: executing /usr/lib/dhcpcd/dhcpcd-run-hooks PREINIT
enp4s0: executing /usr/lib/dhcpcd/dhcpcd-run-hooks CARRIER
enp4s0: using ClientID 01:00:25:ab:32:86:7c
enp4s0: using static address 192.168.1.130/24
enp4s9: adding route to 192.168.1.0/24
enp4s0: ARP announcing 192.168.1.130 (1 of 2), next in 2.0 seconds
enp4s0: executing /usr/lib/dhcpcd/dhcpcd-run-hooks STATIC
enp4s0: ARP announcing 192.168.1.130 (2 of 2)

And then it freezes there. I can ^C, change TTY, and I can ping the server from my main machine.

Offline

#8 2021-06-15 15:33:29

seth
Member
Registered: 2012-09-03
Posts: 50,957

Re: [SOLVED] DHCPCD Issues (DHCPCD as network manager)

It doesn't freeze but just doesn't do anything (which is ok) - there's no problem, but - leaving aside that the profile is likely insufficient, https://wiki.archlinux.org/title/Dhcpcd#Static_profile - if the IP is in the dynamic block of your router, it can just silently fail there.

Offline

#9 2021-06-15 15:52:16

b0ss_
Member
Registered: 2021-01-16
Posts: 83

Re: [SOLVED] DHCPCD Issues (DHCPCD as network manager)

YEEEAH! IT WAS THAT! HOW DUMB AM I!

I just had to add the options but as STATIC! Not only the network itself works, but the DNS and everything else does! Thank you mate!
Even although now I have issues getting to use my multimedia server outside the network, that's something I can take care of.

Thanks!

Offline

Board footer

Powered by FluxBB