Search Blogs

5 minutes reading time (955 words)

Manually Setup ArchLinux Networking

Linux Cat
manually-setting-archlinux-network
The article doesn't cover wireless networking. If you need wireless support please install the below requirements. 

Please stay tuned for Wireless Network Guide in detail - Coming soon.

  • extra/wicd 1.7.4-1 - Wired and wireless network manager for Linux
  • extra/wicd-gtk 1.7.4-1 - Wired and wireless network manager for Linux - GTK client
  • community/wicd-openrc 20170401-1 (openrc-net) - OpenRC wicd script
  • community/connman 1.34-1 - Wireless LAN network manager
  • community/wpa_tui 0.3-1 - Script to easily setup systemd-networkd and connect to wireless networks

Requirements for Article

  • core/netctl 1.12-2 (base) - Profile based systemd network management
  • core/net-tools - Configuration tools for Linux networking
  • core/dhcpcd 6.11.5-1 (base) - RFC2131 compliant DHCP client daemon
  • community/dhcpcd-nosystemd 6.11.5-2 (base-nosystemd) - RFC2131 compliant DHCP client daemon
  • community/cmst 20170318-2 - A QT based GUI front end for the connman connection manager with systemtray icon
  • extra/networkmanager 1.8.2-1 (gnome) - Network connection manager and user applications

Anonymizing networks - Optional Privacy Services

  • Freenet — An encrypted network without censorship.
  • GNUnet — A framework for secure peer-to-peer networking.
  • I2P — A distributed anonymous network.
  • Tor — Anonymizing overlay network.

Install network management utility

Manual assignment

It is possible to manually set up a static IP using only the iproute2 package. This is a good way to test connection settings since the connection made using this method will not persist across reboots. First enable the network interface:

 Assign a temporary static IP address in the console:

Then add your gateway IP address:

For example:

You could use ifconfig (net-tools) to configure the network.

Install net-tools

Now you can either display the IP address or assign one

List interfaces or display IP assigned

Bring up interface with 192.168.0.10

Troubleshooting

Flush interface

Then remove any assigned gateway:

And finally disable the interface:

Calculating Addresses

Search ArchLinux packages for ipcalc

community/ipcalc 0.41-5
Now install ipcalc

Now we can calculate the IP address

Address: 192.168.0.10 11000000.10101000.00000000. 00001010
Netmask: 255.255.255.0 = 24 11111111.11111111.11111111. 00000000
Wildcard: 0.0.0.255 00000000.00000000.00000000. 11111111
=>
Network: 192.168.0.0/24 11000000.10101000.00000000. 00000000
HostMin: 192.168.0.1 11000000.10101000.00000000. 00000001
HostMax: 192.168.0.254 11000000.10101000.00000000. 11111110
Broadcast: 192.168.0.255 11000000.10101000.00000000. 11111111
Hosts/Net: 254 Class C, Private Internet
Setting Static Address (Optional but not manual)
Edit your network interface

Add below example lines

Description='A basic static ethernet connection'
Interface=enp1s0
Connection=ethernet
IP=static
Address=('192.168.0.10/24')
Gateway=('192.168.0.1')
DNS=('192.168.0.1' '8.8.8.8' '8.8.4.4')

 Start interface

Enable at boot
or disable interface

Bring down the interface and flush IP config:

 Disabling DHCP client daemon and Network Manager service:

Giving a static address

interface em0
static ip_address=192.168.0.10/24
static routers=192.168.0.1
static domain_name_servers=8.8.8.8 8.8.4.4
Save file and restart dhcpcd service like above example.

Set Hostname

To temporarily set the hostname until reboot

Changing Device Name

Adding Alias on Interfaces

Manually set an alias, for some NIC, use iproute2 to execute

To remove a given alias execute

Promiscuous mode

Add the below to set promiscuous mode
[Unit]
Description=Set %i interface in promiscuous mode
After=network.target

[Service]
Type=oneshot
ExecStart=/usr/bin/ip link set dev %i promisc on
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
Save the file and enable

Setup DHCP

Install dhcpd

Start dhcpcd manually, run the following command:

Wired adapter using DHCP

[Match]
Name=ens1f0

[Network]
DHCP=ipv4
Running DHCP at Boot time

Wired adapter using a static IP

[Match]
Name=ens1f0

[Network]
Address=10.1.10.9/24
Gateway=10.1.10.1
Address= can be used more than once to configure multiple IPv4 or IPv6 addresses. See #network files or systemd.network for more options.

Wireless adapter

wpa_supplicant is required. In this example, the corresponding systemd service file that needs to be enabled is wpa_supplicant@wlp2s0.service. This service will run wpa_supplicant with the configuration file /etc/wpa_supplicant/wpa_supplicant-wlp2s0.conf. If this file does not exist, the service will not start.

[Match]
Name=wlp2s1

[Network]
DHCP=ipv4

 Broadcasting DHCP Hostnames

Static hostname: arch-910
Icon name: computer-vm
Chassis: vm
Machine ID: d50001c6ad864f2b8dd89fb862e5e881
Boot ID: d4ab7fcd1dd14da996d6748c4eccedbc
Virtualization: qemu
Operating System: Manjaro Linux
Kernel: Linux 4.9.34-1-MANJARO
Architecture: x86-64
Make sure the below entry is in dhclient.conf

send host-name = gethostname();

By default the dhclient.conf should already this line above for broadcasting DHCP or STATIC hostname

Creating a Fallback Profile

Edit dhcpcd.conf and add the below to it. 

# define static profile
profile static_em0
static ip_address=192.168.0.10/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

# fallback static profile on em0
interface em0
fallback static_em0
That covers installing and assigning and configuring DHCP, static, fallback IP addresses and restarting/start network services on ArchLinux
    
1
Installing Development Tools