The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.
Difference between revisions of "Install/Network"
m (→Using wpa_supplicant: added forgotten step) |
(→Wi-Fi) |
||
Line 8: | Line 8: | ||
==== Wi-Fi ==== | ==== Wi-Fi ==== | ||
===== Using NetworkManager ===== | ===== Using NetworkManager ===== | ||
For laptop/mobile systems where you will be using Wi-Fi and connecting to various networks, NetworkManager is strongly recommended. The Funtoo version of NetworkManager is | For laptop/mobile systems where you will be using Wi-Fi and connecting to various networks, in these cases NetworkManager is strongly recommended, especially for GUI environments. The Funtoo version of NetworkManager is not still stable from a command-line environment, so it's better to use it with X making use of the Network Manager applet. Here are the steps involved in setting up NetworkManager: | ||
<console> | <console> | ||
Line 29: | Line 29: | ||
===== Using wpa_supplicant ===== | ===== Using wpa_supplicant ===== | ||
If | If a wireless connection working even in a command-line environment is needed, a tool as wpa_supplicant is adviced. | ||
Before installing wpa_supplicant, we should first enable the wirelees flag (called <code>wps</code>)for the installation of the package: | |||
{{Note|In this scenario we are considering a raw command-line environment installation, if a GUI environment is considered it is adviced to enable even the <code>qt4</code> flag in order to be able to use wpa_gui}} | |||
<console> | <console> | ||
(chroot) ###i## echo '=net-wireless/wpa_supplicant wps' >> /etc/portage/package.use | |||
</console> | |||
Now, we can emerge dhcpcd and wpa_supplicant, by doing: | |||
<console> | |||
(chroot) ###i## emerge -a dhcpcd | |||
(chroot) ###i## emerge linux-firmware | (chroot) ###i## emerge linux-firmware | ||
(chroot) ###i## emerge -a wpa_supplicant | (chroot) ###i## emerge -a wpa_supplicant | ||
</console> | </console> | ||
Now, | Now we have to tell dhcpcd to use automatically wpa_supplicant, this can be done editing the file <code>/etc/conf.d/net </code>. | ||
<pre> | <pre> | ||
modules_wlan0="wpa_supplicant" | |||
config_wlan0="dhcp" | |||
</pre> | |||
Now, edit the wpa_supplicant configuration file, located at <code>/etc/wpa_supplicant/wpa_supplicant.conf </code>. | |||
The syntax is very easy (The example below refers to a connection to a WPA/WPA2 encrypted connection): | |||
<pre> | |||
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel | |||
#ap_scan=0 | |||
#update_config=1 | |||
network={ | network={ | ||
ssid=" | ssid="YourSSID" | ||
psk=" | psk="your-secret-key" | ||
scan_ssid=1 | |||
proto=RSN | |||
key_mgmt=WPA-PSK | |||
group=CCMP TKIP | |||
pairwise=CCMP TKIP | |||
priority=5 | |||
} | } | ||
</pre> | </pre> | ||
Note that you will need to add <code>dhcpcd</code> to the default runlevel, and it will automatically manage the connection through wpa_supplicant. <code>wpa_supplicant</code> will connect to your access point, and <code>dhcpcd</code> will acquire an IP address via DHCP: | |||
<console> | <console> | ||
(chroot) # ##i##rc-update add dhcpcd default | (chroot) # ##i##rc-update add dhcpcd default | ||
</console> | </console> | ||
Revision as of 01:54, June 3, 2015
This is a template that is used as part of the Installation instructions which covers: Network configuration. Templates are being used to allow multiple variant install guides that use most of the same re-usable parts.
Configuring your network
It's important to ensure that you will be able to connect to your local-area network after you reboot into Funtoo Linux. There are three approaches you can use for configuring your network: NetworkManager, dhcpcd, and the Funtoo Linux Networking scripts. Here's how to choose which one to use based on the type of network you want to set up.
Wi-Fi
Using NetworkManager
For laptop/mobile systems where you will be using Wi-Fi and connecting to various networks, in these cases NetworkManager is strongly recommended, especially for GUI environments. The Funtoo version of NetworkManager is not still stable from a command-line environment, so it's better to use it with X making use of the Network Manager applet. Here are the steps involved in setting up NetworkManager:
(chroot) # emerge linux-firmware (chroot) # emerge networkmanager (chroot) # rc-update add NetworkManager default
Above, we installed linux-firmware which contains a complete collection of available firmware for many hardware devices including Wi-Fi adapters, plus NetworkManager to manage our network connection. Then we added NetworkManager to the default
runlevel so it will start when Funtoo Linux boots.
After you reboot into Funtoo Linux, you will be able to add a Wi-Fi connection this way:
The following command will not work as long as you are in chroot environment. The reason for this is that addwifi will need dbus and rfkill to be set up. So don't forget to reboot!
root # addwifi -S wpa -K 'wifipassword' mywifinetwork
The addwifi
command is used to configure and connect to a WPA/WPA2 Wi-Fi network named mywifinetwork
with the password wifipassword
. This network configuration entry is stored in /etc/NetworkManager/system-connections
so that it will be remembered in the future. You should only need to enter this command once for each Wi-Fi network you connect to.
Using wpa_supplicant
If a wireless connection working even in a command-line environment is needed, a tool as wpa_supplicant is adviced.
Before installing wpa_supplicant, we should first enable the wirelees flag (called wps
)for the installation of the package:
In this scenario we are considering a raw command-line environment installation, if a GUI environment is considered it is adviced to enable even the qt4
flag in order to be able to use wpa_gui
(chroot) # echo '=net-wireless/wpa_supplicant wps' >> /etc/portage/package.use
Now, we can emerge dhcpcd and wpa_supplicant, by doing:
(chroot) # emerge -a dhcpcd (chroot) # emerge linux-firmware (chroot) # emerge -a wpa_supplicant
Now we have to tell dhcpcd to use automatically wpa_supplicant, this can be done editing the file /etc/conf.d/net
.
modules_wlan0="wpa_supplicant" config_wlan0="dhcp"
Now, edit the wpa_supplicant configuration file, located at /etc/wpa_supplicant/wpa_supplicant.conf
.
The syntax is very easy (The example below refers to a connection to a WPA/WPA2 encrypted connection):
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel #ap_scan=0 #update_config=1 network={ ssid="YourSSID" psk="your-secret-key" scan_ssid=1 proto=RSN key_mgmt=WPA-PSK group=CCMP TKIP pairwise=CCMP TKIP priority=5 }
Note that you will need to add dhcpcd
to the default runlevel, and it will automatically manage the connection through wpa_supplicant. wpa_supplicant
will connect to your access point, and dhcpcd
will acquire an IP address via DHCP:
(chroot) # rc-update add dhcpcd default
Desktop (Wired Ethernet)
For a home desktop or workstation with wired Ethernet that will use DHCP, the simplest and most effective option to enable network connectivity is to simply add dhcpcd
to the default runlevel:
(chroot) # rc-update add dhcpcd default
When you reboot, dhcpcd
will run in the background and manage all network interfaces and use DHCP to acquire network addresses from a DHCP server.
Server (Static IP)
For servers, the Funtoo Linux Networking scripts are recommended. They are optimized for static configurations and things like virtual ethernet bridging for virtualization setups. See Funtoo Linux Networking for information on how to use Funtoo Linux's template-based network configuration system.