Difference between revisions of "Netctl (简体中文)"

From ArchWiki
Jump to: navigation, search
(Configuration)
(Added ES translation link)
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
{{Lowercase title}}
 
{{Lowercase title}}
[[Category:Networking]]
+
[[Category:Networking (简体中文)]]
 +
[[en:Netctl]]
 
[[fr:Netctl]]
 
[[fr:Netctl]]
[[zh-CN:Netctl]]
+
[[es:Netctl]]
 
{{Article summary start}}
 
{{Article summary start}}
 
{{Article summary text|用netctl和网络配置脚本设置网络的指南。}}
 
{{Article summary text|用netctl和网络配置脚本设置网络的指南。}}
 
{{Article summary end}}
 
{{Article summary end}}
 +
{{TranslationStatus (简体中文)|Netctl|2013-04-11|253699}}
 
Netctl 是 Arch Linux 中基于命令行的网络管理器,它是 Arch 的新项目,会替换掉 [[netcfg]]
 
Netctl 是 Arch Linux 中基于命令行的网络管理器,它是 Arch 的新项目,会替换掉 [[netcfg]]
  
Line 40: Line 42:
 
  # netctl reenable <profile>
 
  # netctl reenable <profile>
  
===Migrating from netcfg===
+
===netcfg 迁移的方法===
  
{{ic|netctl}} uses {{ic|/etc/netctl}} to store its profiles, ''not'' {{ic|/etc/network.d}} ({{ic|netcfg}}'s profile storage location).
+
{{ic|netctl}} 使用 {{ic|/etc/netctl}} 保存配置,而'''不是''' {{ic|/etc/network.d}} ({{ic|netcfg}}保存配置的位置).
  
In order to migrate from netcfg, at least the following is needed:
+
netcfg 迁移,请执行:
*Move network profile files to the new directory.
+
*将老的网络配置移动到新目录
*Rename variables therein according to netctl.profile(5) (most have only become CamelCase i.e CONNECTION= becomes Connection=).
+
*根据 netctl.profile(5) 修改变量名称(主要是大小写变化,例如 CONNECTION= 变成 Connection=).
*Unquote interface variables and other variables that don't strictly need quoting (this is mainly a style thing).
+
*接口变量和其他变量不再需要引号(这仅仅是风格变化).
*Run {{ic|netctl enable <profile>}} for every profile in the old NETWORKS array. 'last' doesn't work this way, see netctl.special(7).
+
*为每一个配置执行{{ic|netctl enable <profile>}} 'last' 工作方式有变化,参阅 netctl.special(7).
*Use {{ic|netctl list}} / {{ic|netctl start <profile>}} instead of netcfg-menu. wifi-menu remains available.
+
*使用 {{ic|netctl list}} / {{ic|netctl start <profile>}} 替换 netcfg-menu. wifi-menu 依然保留。
  
===Password encryption (256-bit PSK)===
+
===密码加密(256-bit PSK)===
  
Users ''not'' wishing to have their passwords stored in ''plain text'' have the option of generating a 256-bit Encrypted PSK.
+
不想'''用明文保存密码'''的用户可以使用 256 位加密 PSK.
  
If you have not done so already, install {{pkg|wpa_actiond}} from the [[Official Repositories#&#91;core&#93;|&#91;core&#93;]] repository using [[pacman]]
+
先用[[Pacman|pacman]] 安装[[Official Repositories#&#91;core&#93;|&#91;core&#93;]]软件仓库中的{{pkg|wpa_actiond}}。
  # pacman -S wpa_actiond
+
  
Next, generate your 256-bit Encrypted PSK using [[WPA_supplicant#Configuration_file|wpa_passphrase]]:
+
然后用[[WPA_supplicant#Configuration_file|wpa_passphrase]]生成256位加密 PSK:
 
{{hc|Usage: wpa_passphrase [ssid] [passphrase]|
 
{{hc|Usage: wpa_passphrase [ssid] [passphrase]|
 
2=$ wpa_passphrase archlinux freenode|
 
2=$ wpa_passphrase archlinux freenode|
Line 66: Line 67:
 
   psk=64cf3ced850ecef39197bb7b7b301fc39437a6aa6c6a599d0534b16af578e04a
 
   psk=64cf3ced850ecef39197bb7b7b301fc39437a6aa6c6a599d0534b16af578e04a
 
}
 
}
{{Note|This information will be used in your profile so do not close the terminal}}
 
 
}}
 
}}
 +
{{注意|这些信息会在配置中使用,请不要关闭终端。}}
  
In a second terminal window copy the example file {{ic|wireless-wpa}} from {{ic|/etc/netctl/examples}} to {{ic|/etc/netctl}}.
+
在第二个终端将{{ic|/etc/netctl/examples/wireless-wpa}} 复制到 {{ic|/etc/netctl}}
 
  # cp /etc/netctl/examples/wireless-wpa /etc/netctl/wireless-wpa
 
  # cp /etc/netctl/examples/wireless-wpa /etc/netctl/wireless-wpa
  
You will then need to edit {{ic|/etc/netctl/wireless-wpa}} using your favorite text editor and add the ''Encrypted Pre-shared Key'' that was generated earlier using wpa_passphrase, to the {{ic|'''Key'''}} variable of this profile.
+
编辑{{ic|/etc/netctl/wireless-wpa}},将之前生成的''Encrypted Pre-shared Key''设置到{{ic|'''Key'''}}
  
Once completed your network profile {{ic|wireless-wpa}} containing a 256-bit Encrypted PSK should resemble:
+
完成后的{{ic|wireless-wpa}}应该类似于:
 
{{hc|/etc/netctl/wireless-wpa|2=
 
{{hc|/etc/netctl/wireless-wpa|2=
 
Description='A simple WPA encrypted wireless connection using 256-bit Encrypted PSK'
 
Description='A simple WPA encrypted wireless connection using 256-bit Encrypted PSK'
Line 84: Line 85:
 
Key=\"64cf3ced850ecef39197bb7b7b301fc39437a6aa6c6a599d0534b16af578e04a
 
Key=\"64cf3ced850ecef39197bb7b7b301fc39437a6aa6c6a599d0534b16af578e04a
 
}}
 
}}
{{Note|1=Make sure to use the '''special non-quoted rules''' for Key= that are explained at the end of [https://github.com/joukewitteveen/netctl/blob/master/docs/netctl.profile.5.txt netctl.profile(5)]}}
+
{{注意|1=请使用'''special non-quoted rules''' 设置 Key=,参阅 [https://github.com/joukewitteveen/netctl/blob/master/docs/netctl.profile.5.txt netctl.profile(5)]}}
  
==Support==
+
==支持==
Official announcement thread: https://bbs.archlinux.org/viewtopic.php?id=157670
+
官方通知帖: https://bbs.archlinux.org/viewtopic.php?id=157670
  
==Tips and Tricks==
+
==提示和技巧==
As of April 2013 there is no netctl alternative to 'netcfg current'. If you relied on it for something, like a status bar for a tiling window manager, you can now use:
+
目前还没有功能能够替换 'netcfg current'. 如果需要,请使用:
 
  netctl list|grep \*|sed 's/\*//'|sed 's/\ //'
 
  netctl list|grep \*|sed 's/\*//'|sed 's/\ //'

Revision as of 23:54, 12 April 2013

Summary help replacing me
用netctl和网络配置脚本设置网络的指南。
翻译状态: 本文是英文页面 Netctl翻译,最后翻译时间:2013-04-11,点击这里可以查看翻译后英文页面的改动。

Netctl 是 Arch Linux 中基于命令行的网络管理器,它是 Arch 的新项目,会替换掉 netcfg

安装

netctl 软件包已经进入[core]. 安装 netctl 会替换掉无人维护的netcfg

建议阅读

开发者为了完善 man 文档投入了大量的精力,建议用户使用前阅读如下文档:

  • netctl
  • netctl.profile
  • netctl.special

配置

netctl 可以用来检查和控制 systemd 网络配置管理服务的状态。软件提供了一些配置文件的示例以供参考。这些示例位于/etc/netctl/examples/,包括:

  • ethernet-dhcp
  • ethernet-static
  • wireless-wpa
  • wireless-wpa-static

要使用示例配置,将他们从/etc/netctl/examples/<profile>复制到/etc/netctl/<profile>然后进行修改:

# cp /etc/netctl/examples/wireless-wpa /etc/netctl/my-wireless-wpa

创建完配置后,通过如下方法建立连接:

# netctl start <profile>

如果命令出错,可以使用 journalctl -xnnetctl status <profile> 检查出错原因。修正重新设置。

配置成功启动后,可以用 netctl enable <profile> 启用. 此命令会建立正确的软链接供netctl-auto@.service使用。

注意: 需要启用netctl-auto@<interface>.service才能在系统启动时自动配置无线连接。

如果需要修改当前启用的配置,请执行

# netctl reenable <profile>

从 netcfg 迁移的方法

netctl 使用 /etc/netctl 保存配置,而不是 /etc/network.d (netcfg保存配置的位置).

从 netcfg 迁移,请执行:

  • 将老的网络配置移动到新目录
  • 根据 netctl.profile(5) 修改变量名称(主要是大小写变化,例如 CONNECTION= 变成 Connection=).
  • 接口变量和其他变量不再需要引号(这仅仅是风格变化).
  • 为每一个配置执行netctl enable <profile> 'last' 工作方式有变化,参阅 netctl.special(7).
  • 使用 netctl list / netctl start <profile> 替换 netcfg-menu. wifi-menu 依然保留。

密码加密(256-bit PSK)

不想用明文保存密码的用户可以使用 256 位加密 PSK.

先用pacman 安装[core]软件仓库中的wpa_actiond

然后用wpa_passphrase生成256位加密 PSK:

Usage: wpa_passphrase [ssid] [passphrase]
$ wpa_passphrase archlinux freenode
注意: 这些信息会在配置中使用,请不要关闭终端。

在第二个终端将/etc/netctl/examples/wireless-wpa 复制到 /etc/netctl

# cp /etc/netctl/examples/wireless-wpa /etc/netctl/wireless-wpa

编辑/etc/netctl/wireless-wpa,将之前生成的Encrypted Pre-shared Key设置到Key

完成后的wireless-wpa应该类似于:

/etc/netctl/wireless-wpa
Description='A simple WPA encrypted wireless connection using 256-bit Encrypted PSK'
Interface=wlp2s2
Connection=wireless
Security=wpa
IP=dhcp
ESSID=archlinux
Key=\"64cf3ced850ecef39197bb7b7b301fc39437a6aa6c6a599d0534b16af578e04a
注意: 请使用special non-quoted rules 设置 Key=,参阅 netctl.profile(5)

支持

官方通知帖: https://bbs.archlinux.org/viewtopic.php?id=157670

提示和技巧

目前还没有功能能够替换 'netcfg current'. 如果需要,请使用:

netctl list|grep \*|sed 's/\*//'|sed 's/\ //'