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
Note: See below how to install net-tools.
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:
# ip addr add 192.168.0.10/24 broadcast 192.168.0.255 dev em1
Then add your gateway IP address:
# ip route add default via 192.168.0.1
For example:
# ip link set em1 up
# ip addr add 192.168.0.10/24 broadcast 192.168.0.255 dev em1
# ip route add default via 192.168.0.1
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
Note: ifconfig is depreciated in some versions of ArchLinux.
Bring up interface with 192.168.0.10
# ifconfig em1 192.168.0.10/24 up
Troubleshooting
Flush interface
Then remove any assigned gateway:
And finally disable the interface:
Calculating Addresses
Search ArchLinux packages for ipcalc
# pacman -Ss | grep ipcalc
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
Note: IP address 192.168.0.10 is a C class private internet address.
Setting Static Address (Optional but not manual)
# cd /etc/netctl
# cp examples/ethernet-static ./enp1s0
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')
Enable at boot
or disable interface
Bring down the interface and flush IP config:
# sudo ifcfg enp0s11 stop
# sudo ip link set enp0s11 down
# sudo ip addr flush enp0s11
Disabling DHCP client daemon and Network Manager service:
# sudo systemctl stop dhcpcd
# sudo systemctl disable dhcpcd
# sudo systemctl stop NetworkManager
# sudo systemctl disable NetworkManager
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
# hostnamectl set-hostname domains.linuxsecrets.com
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
# ip addr add 192.168.0.10/24 dev eth0 label eth0:1
To remove a given alias execute
# ip addr del 192.168.0.10/24 dev eth0:1
Promiscuous mode
# vim /etc/systemd/system/promiscuous@.service
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
# systemctl enable promiscuous@em1.service
Setup DHCP
Install dhcpd
Start dhcpcd manually, run the following command:
Wired adapter using DHCP
# vim /etc/systemd/network/50-wired.network
[Match]
Name=ens1f0
[Network]
DHCP=ipv4
Running DHCP at Boot time
# rc-update add dhcpcd default
Wired adapter using a static IP
# vim /etc/systemd/network/25-wired.network
[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.
# vim /etc/systemd/network/25-wireless.network
[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