Difference between revisions of "Netcfg (Español)"

From ArchWiki
Jump to: navigation, search
(37 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Lowercase title}}
#REDIRECT [[Netctl (Español)]]
{{Article summary start}}
{{Article summary text|Una guia para configurar la red usando netcfg y scripts de perfiles de red.}}
{{Article summary heading|Overview}}
{{Article summary text|{{Networking overview}}}}
{{Article summary heading|Resources}}
{{Article summary wiki|Netcfg Tips}}
{{Article summary wiki|Netcfg Troubleshooting}}
{{Article summary link|Netcfg network scripts repository|https://projects.archlinux.org/netcfg.git/}}
{{Article summary end}}
Netcfg es usado para configurar y manejar las conexiones de red vía perfiles.Soporta varios tipos de conexión, como wireless, Ethernet, [[Wikipedia:Point-to-point_protocol|PPP]]. También es capaz de iniciar/detener conexiones muchas-a-una, esto es, múltiples conexiones dentro del mismo perfil, opcionalmente unidas. Además, es útil para los usuarios que buscan un medio sencillo y robusto de la gestión de múltiples configuraciones de red (por ejemplo, los usuarios de portátiles). Con la eliminación del soporte a {{Pkg|initscripts}}/SysV, netcfg es una de las opciones disponibles para que los usuarios puedan gestionar la conectividad bajo [[systemd]].
{{Note|1={{Pkg|netcfg}} >= 2.8.9 elimina la compatibilidad con  {{ic|/etc/[[rc.conf]]}}. Los usuarios de Netcfg deberán configurar todas las interfaces en {{ic|/etc/conf.d/netcfg}} en lugar de en {{ic|/etc/rc.conf}}.}}
== Preparation ==
In the simplest cases, users must at least know the name of their network interface(s) (e.g. {{ic|eth0}}, {{ic|wlan0}}). If configuring a static IP address, the IP addresses of the default gateway and name server(s) must also be known.
If connecting to a wireless network, have some basic information ready. For a wireless network this includes what type of security is used, the network name (ESSID), and any passphrase or encryption keys. Additionally, ensure the proper drivers and firmware are installed for the wireless device, as described in [[Wireless Setup]].
== Installation ==
The {{Pkg|netcfg}} package is available in the [[Official Repositories|official repositories]]. As of {{Pkg|netcfg}} version 2.5.x, optional dependencies include {{Pkg|wpa_actiond}}, which is required for automatic/roaming wireless connections, and {{Pkg|ifplugd}}, which is required for automatic Ethernet configuration. See [https://www.archlinux.org/news/487/ the announcement].
Users wanting [[Bash]] completion support for netcfg, install the {{Pkg|bash-completion}} package from the official repositories.
== Configuration ==
Network profiles are stored in {{ic|/etc/network.d/}}. To minimize the potential for errors, copy an example configuration from {{ic|/etc/network.d/examples/}} to {{ic|/etc/network.d/mynetwork}}. The file name is the name of the network profile, and {{ic|mynetwork}} is used as an example throughout this article.
Depending on the connection type and security, use one of the following examples from {{ic|/etc/network.d/examples/}} as a base.
{{Warning|Be wary of examples found on the internet as they often contain deprecated options that may cause problems!}}
{| class="wikitable" align="center"
! Connection !! Type !! Example Profile !! Information
| rowspan="3"| '''Wired'''
| Dynamic IP || {{ic|ethernet-dhcp}} ||
| Static IP || {{ic|ethernet-static}} ||
| Routed || {{ic|ethernet-iproute}} || Can be checked with {{ic|route}} from the {{Pkg|net-tools}} package.
| rowspan="3"| '''Wireless'''
| WPA-Personal
| {{ic|wireless-wpa}} || Uses a passphrase/pre-shared key.
| rowspan="2"| WPA-Enterprise
| {{ic|wireless-wpa-config}} || The {{Pkg|wpa_supplicant}} configuration is external.
| {{ic|wireless-wpa-configsection}} || The {{Pkg|wpa_supplicant}} configuration is stored as a string.
Modify the new configuration file, {{ic|/etc/network.d/mynetwork}}:
* Set {{ic|INTERFACE}} to the correct wireless or Ethernet interface. This can be checked with {{ic|ip link}} and {{ic|iwconfig}}.
* Ensure the {{ic|ESSID}} and {{ic|KEY}} (passphrase) are set correctly for wireless connections. Typos in these fields are common errors.
** Note that WEP ''string'' keys (not ''hex'' keys) must be specified with a leading {{ic|s:}} (e.g. {{ic|1=KEY="s:''somepasskey''"}}).
{{Note|Netcfg configurations are valid Bash scripts. Any configuration involving special characters such as {{ic|$}} or {{ic|\}} needs to be quoted correctly otherwise it will be interpreted by Bash. To avoid interpretation, use single quotes or backslash escape characters where appropriate.}}
{{Note|Network information (e.g. wireless passkey) will be stored in plain text format, so users may want to change the permissions on the newly created profile (e.g. {{ic|chmod 0600 /etc/network.d/mynetwork}}) to make it readable by root only.}}
{{Note|For WPA-Personal, it is also possible to [[Wpa_supplicant#Classic_method:_.2Fetc.2Fwpa_supplicant.conf|encode the WPA passkey into a hexadecimal string]]. Save the new hexadecimal string into the wireless WPA profile in {{ic|/etc/network.d/mynetwork}} as the value of the {{ic|KEY}} variable (make sure this will be the only {{ic|KEY}} variable enabled), to look similar to this: {{ic|1=KEY='7b271c9a7c8a6ac07d12403a1f0792d7d92b5957ff8dfd56481ced43ec6a6515'}}. That should disable the need to reveal the passkey.}}
== Manual Operation ==
To connect a profile:
# netcfg mynetwork
To disconnect a profile:
# netcfg down mynetwork
If successful, users can configure netcfg to connect automatically or during boot. If the connection fails, see [[Netcfg Troubleshooting]] for solutions and for how to ask for help.
Additionally, see:
$ netcfg help
== Automatic Operation ==
=== Net-Profiles ===
Edit the {{ic|NETWORKS}} array in {{ic|/etc/conf.d/netcfg}} to refer to your network config file {{ic|/etc/network.d/mynetwork}}.
NETWORKS=(mynetwork yournetwork)}}
Start the service on startup:
# systemctl enable netcfg.service
Alternatively, the profiles that were active at last shutdown can be restored by setting the {{ic|NETWORKS}} array to {{ic|last}}.
Finally, {{ic|net-profiles}} can be configured to display a menu – allowing users to choose a desired profile – by setting the contents of the {{ic|NETWORKS}} array to {{ic|menu}}:
Additionally, the {{Pkg|dialog}} package is required.
{{Tip|Access the menu at any time by running {{ic|netcfg-menu}} in a terminal.}}
=== Net-Auto-Wireless ===
This allows users to automatically connect to wireless networks with proper roaming support. To use this feature, the {{Pkg|wpa_actiond}} package is required. Note that {{ic|wireless-wpa-config}} profiles do not work with {{ic|net-auto-wireless}}. Convert them to {{ic|wireless-wpa-configsection}} instead.
Specify the desired wireless interface with the {{ic|WIRELESS_INTERFACE}} variable in {{ic|/etc/conf.d/netcfg}} or define a list of wireless networks that should be automatically connected with the {{ic|AUTO_PROFILES}} variable in {{ic|/etc/conf.d/netcfg}}.
{{Note|If AUTO_PROFILES is not set, all wireless networks will be tried.}}
Enable the {{ic|net-auto-wireless.service}} so systemd manages it.
# systemctl enable net-auto-wireless.service
=== Net-Auto-Wired ===
This allows users to automatically connect to wired networks. To use this feature, the {{Pkg|ifplugd}} package is required.
Specify the desired wired interface with the {{ic|WIRED_INTERFACE}} variable in {{ic|/etc/conf.d/netcfg}}.
Enable the {{ic|net-auto-wired.service}} so systemd manages it.
# systemctl enable net-auto-wired.service
The daemon starts an {{ic|ifplugd}} process which runs {{ic|/etc/ifplugd/netcfg.action}} when the status of the wired interface changes (e.g. a cable is plugged in or unplugged). On plugging in a cable, attempts are made to start any profiles with {{ic|1=CONNECTION = "ethernet"}} or {{ic|"ethernet-iproute"}} and {{ic|1=INTERFACE = WIRED_INTERFACE}} until one of them succeeds.
{{Note|DHCP profiles are tried before static ones, which could lead to undesired results in some cases. However, one can tell netcfg to prefer a particular interface by adding {{ic|1=AUTO_WIRED=1}} to the desired profile.}}
{{Note|The {{ic|net-auto-wired}} daemon cannot start multiple ifplugd processes for multiple interfaces (unlike ifplugd's own {{ic|/etc/rc.d/ifplugd}} which can).}}
== FAQ ==
|question=Why doesn't netcfg do ''(some feature)''?
|answer=Netcfg does not need to; it connects to networks. Netcfg is modular and re-usable. See {{ic|/usr/lib/network}} for re-usable functions for custom scripts.}}
|question=Why doesn't netcfg behave in ''this'' way?
|answer=Netcfg does not enforce any rules; it connects to networks. Netcfg does not impose any heuristics, like "disconnect from wireless if Ethernet is connected". If you want such behavior, it should be simple to write a separate tool on top of netcfg. See the question above. Alternatively, you could be creative with the use of netcfg's {{ic|POST_UP}} functionality to handle some use cases.}}
|question=Do I need anything else if I'm using netcfg?
|answer=This question usually references {{ic|/etc/hosts}} and {{ic|/etc/hostname}}, which are both still required.}}

Latest revision as of 12:49, 18 July 2013

Redirect to: