Wednesday, October 9, 2013

Setting up network with netctl

The first thing to do with Raspberry Pi after the system was installed, was to configure the network connection. For this I used netctl package, which is Arch specific CLI network configuration tool replacing earlier netcfg tool.

Configuring network with netctl is quite easy, you just need to understand how it works. Netctl is using profiles which you can configure and start/stop or enable it in systemd to be started automatically during boot.

In this first step, I've configured wireless connection for my WPA2 encrypted home network. The default folder where you can create your profiles is /etc/netctl, where you can find some sample configurations in the example folder. Following file is my profile file named wlan0.

RaspPI # cat /etc/netctl/wlan0
Description='Krisko WPA2 AES Wireless lan network'
Interface=wlan0
Connection=wireless
Security=wpa
IP=dhcp
#DHCPClient='dhclient'
ESSID=KrisKo-WiFi
Key='PASSWD'

Now you can list your profiles with netctl list and try to start it with netctl start wlan0.
When you succeeded to connect, you can easily enable your profile to be started during system boot with command netctl enable wlan0.

Next profile (called eth0) enables interface eth0 with static IP address.

RaspPI krisko # cat /etc/netctl/eth0
Description='A basic static ethernet connection'
Interface=eth0
Connection=ethernet
IP=static
Address=('172.16.0.1/24')
#Routes=('192.168.0.0/24 via 192.168.1.2')
#Gateway='172.16.0.1'
DNS=('8.8.8.8')

NOTE: I don't use Gateway directive, as the default GW is distributed via DHCPD, which setup I'll post later in Raspberry Pi section.



No comments:

Post a Comment