Talk:Netctl

From ArchWiki
(Redirected from Talk:Netcfg)
Jump to: navigation, search

Ifplugd.conf interface name

Under the configuration section, there is a note stating that the interface name most probably needs to be changed in the netctl profile because of udev naming rules. When using ifplugd to automatically manage wired profile switching, there is another place to check the interface name. /etc/ifplugd/ifplugd.conf contains the line:

INTERFACES="eth0"

The interface should match the one used in the profile or ifplugd won't monitor the correct interface. You can include a space separated list of interfaces to monitor if more than one NIC is present. This info is in the man page for ifplugd, and in the ifplugd.conf file, is it worth adding here as well?

Erbrecht (talk) 15:50, 10 January 2014 (UTC)

I think it's worth adding it, maybe you can be more concise and point to the man pages for details on syntax and everything else. -- Kynikos (talk) 02:36, 11 January 2014 (UTC)

Hooks and interfaces explanations

I am looking for documentation on using /etc/netctl/hooks and /etc/netctl/interfaces but this wiki and the netctl man pages don't explain the format of the scripts well. I couldn't find a great resource through google. I think an example of running scripts when a profile comes up or down would be good. —This unsigned comment is by Seniorsassycat (talk) 07:06, 20 January 2014. Please sign your posts with ~~~~!

Not to give you the RTFM, but the netctl man page explains it pretty well. Interfaces at least are actually pretty simple, but I'm not sure about other hooks. Still, it might be worth adding a short section explaining the basics of creating hooks. As for running a script, you could probably use a systemd unit with WantedBy=network.target and Before=netctl@yourprofile.service/After=netctl@yourprofile.service. EscapedNull (talk) 22:22, 20 January 2014 (UTC)
I have RTFM and i see no explanation 'Variables available in scripts' or 'actions'. Captaincurrie (talk) 12:50, 26 December 2014‎ (UTC)
I have gone through the source and these variables only appear in /usr/lib/network/auto.action. This file is only used by netctl-auto. So these variables are not available for scripts...
They don't even need to be to do everything you wan tCaptaincurrie (talk) 07:48, 27 December 2014 (UTC)

Profile Names

Perhaps I am missing something as I have been fighting networking stuff for at least 2 weeks. (Not all netctl, I'm glad to say.) But the eduroam profiles given here seem to be inconsistent with the advice not to name profiles with strings which include hyphens. Am I missing something? (By the way, it would be handy to know what *is* safe. Presumably [a-z], probably [A-Z0-9]. Anything else?) --cfr (talk) 03:56, 3 March 2014 (UTC)

Everything is safe to use, hyphens are just more prone to PEBKAC errors. When you use directly netctl to manage profiles (i.e. you run netctl enable profile instead of systemctl enable netctl@profile), nothing bad will ever happen even when there is a hyphen in the profile name.
Yes, the hyphens are encoded into \x2d when the symlink in /etc/systemd/system/ is created, but there is nothing more than that. Searching the forums thread mentioned in the note on this page, several other threads and relevant man pages, the only reference to hyphens being really special is in path units, where they substitute /, which obviously can't be used in file name. Especially there are no "connection drop issues" because of hyphens.
-- Lahwaacz (talk) 07:25, 3 March 2014 (UTC)

Wireless/Wired failover dependency management.

When I set up wireless failover, I needed to create a custom dependency to avoid the "already up" problem. Thought I would share:

/etc/systemd/system/netctl@failover.service.d/dependencies.conf

   [Unit]
   Wants=dhcpcd@bond0.service
   Wants=wpa_supplicant@wlan0.service
   Before=dhcpcd@bond0.service
   Before=wpa_supplicant@wlan0.service

This made sure that the interfaces were bonded and up before anything else attempted to use the device; isolates this dependency to the failover (so other profiles *may* work) profile and allows the AP association to happen before DHCPCd times out. —This unsigned comment is by Greyson (talk) 16:55, 5 November 2014. Please sign your posts with ~~~~!

Yes,this is a problem that I also had, when starting the bond just with the wireless interface up. I've been studying a solution to this problem, and yours, while being correct, is parcial. If there isn't any dhcp server on the wireless network, it will timeout anyway. I played a while, and I believe the solution is to set the dhcpcd timeout to zero and, instead of having netctl calling it, create a different systemd service for the bond0 interface, so if it dies for any reason, systemd will restart it. I haven't had the time to test this solution, if you can test, please share here so we can change the wiki page.
Grazzolini (talk) 17:05, 5 November 2014 (UTC)

Conceptual understanding

The fact that netctl is written in bash is extremely important in order to understand how everything works. For example, it directly explains the syntax of profiles, hooks, and interfaces. The fact that setting options is equivalent to declaring a bash variable allowed me to understand what was going on. Before that, i was lost in confusion. I believe this knowledge should be made more explicit as it cleared a lot of things up for me.

Can it be added somewhere on this page? Captaincurrie (talk) 07:58, 27 December 2014 (UTC)

Sure. If you want to add a general sentence: the netctl#Usage section historically links to Jouke's github already, you could add a sentence under the links to the manpages. That should be phrased like "If interested, browse the source code in the repository." or something though.
If you want to add something specific for the hook section, why not crosslink in your latest edit to [1]. --Indigo (talk) 09:48, 27 December 2014 (UTC)

Explain WPAConfigSection

It would be nice if there were an additional example using Security=wpa-configsection that explained each line in the example (/etc/netctl/examples/wireless-wpa-configsection). I'd imagine I'm not the first person discouraged from using netctl-auto because of this. -- Ryne Everett (talk) 16:28, 21 June 2015 (UTC)

As stated in the netctl.profile(5) man page, the WPAConfigSection variable is an array of config lines passed to wpa_supplicant. See example wpa_supplicant.conf (shipped with the Arch package at /etc/wpa_supplicant/wpa_supplicant.conf) for detailed explanation. -- Lahwaacz (talk) 19:20, 21 June 2015 (UTC)
Thanks, I wouldn't have guessed that would be the file to explain those values. If/When I figure it out I may add an additional example section explaining just the required values. (Surely all 10 in the example aren't required?) This is too common of a need (required for netctl-auto) to require so much studying. -- Ryne Everett (talk) 19:38, 21 June 2015 (UTC)
Remember that you are configuring wpa_supplicant, not netctl, so the info belongs to WPA supplicant (it may already be there). -- Lahwaacz (talk) 20:27, 21 June 2015 (UTC)

DHCP clients

I had the problem described under "Job for netctl@wlan(...).service failed", and changing my netctl profiles to use dhclient solved it. My /etc/dhcpcd.conf was unchanged from the version in the package, and my /etc/dhclient.conf was based on /usr/share/dhclient/dhclient.conf.example from the dhclient client package. These request different options from the DHCP server:

/etc/dhcpcd.conf
...
# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# A ServerID is required by RFC2131.
require dhcp_server_identifier

and

/etc/dhclient.conf
...
request subnet-mask, broadcast-address, time-offset, routers,
	domain-name, domain-name-servers, host-name;
require subnet-mask, domain-name-servers;

I removed DHCPClient='dhclient' from my netctl profiles, and made dhcpcd request the extra options by adding

option subnet_mask, broadcast_address, time_offset, routers

to /etc/dhcpcd.conf, and netctl works O.K. with dhcpcd as the DHCP client.

I don't know why requesting the extra options should make a difference, and I haven't tried any tests to see which of them are necessary.--Pdc (talk) 19:41, 25 August 2015 (UTC)