This applies to any Linux Dist. using Wicked as the network manager
Configure network interface in Wicked

In this tutorial we will not be using YaST, YaST should be pretty self explanitory as it is a GUI interface. Instead we will focus on setting up interfaces via the command line. We will focus on creating a static and dynamic configuration for a wired interface. The subnet i will be using will be 172.16.32.0/29 with the gateway of 172.16.32.6.

New to Linux?

If you are here and are actually new to Linux, maybe stop by and pick up a book to get started learning Linux!

1. Lets go into the directory where WICKED stores network interface configurations.

cd /etc/sysconfig/network/

2. Lets first get the name of our interface by running the below command.

ip addr

On my openSUSE machine i get 2 interfaces listed below as lo and eth0, it may be different for you. For now, im interested in eth0 so we will use that as the name.

1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
  link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
  inet 127.0.0.1/8 scope host lo
    valid_lft forever preferred_lft forever
  inet6 ::1/128 scope host
    valid_lft forever preferred_lft forever
2: eth0: mtu 1500 qdisc noop state DOWN group default qlen 1000
  link/ether 52:54:00:e7:e5:a2 brd ff:ff:ff:ff:ff:ff

3. Still in the /etc/sysconfig/network/ directory, using your favorite text editor you will create a new file using the format ifcfg-<interface name>, Ex. ifcfg-eth0.

sudo vim ifcfg-eth0

In our new config, add the following as a template:

BOOTPROTO=''
STARTMODE=''
ZONE=''
IPADDR=''
NETMASK=''
Static Configuration

1. Using our template, for a static configuration you will need to setup the variables as such:

BOOTPROTO='static'
STARTMODE='hotplug'
ZONE='public'
IPADDR='172.16.32.5'
NETMASK='255.255.255.248'

NOTE: The ZONE variable applies to a zone in your firewall that supports firewal extension scripts such as firewalld. I am using firewalld and my zone would be public.

Save Changes.

2. Next we need to create a configuration file to put our routes for the interface.

There are 2 confguration files you can create, either a global configuration that will contain routes for all interfaces or interface specific routes. Both configuration files use the same format for routes. We will be adding an interface specific configuration. The configuration file format for the 2 are as follows:

  • Global Routes: routes
  • Interface Specific: ifroute-<interface name>

The format of the routes are as follows:

Destination   [Gateway]     -         Interface

Using your favorite text editor, create the file ifroute-eth0 but using your interface name. 

sudo vim ifroute-eth0

Since my default route will be 172.16.32.6, my route file will look as follows:

default 172.16.32.6 - eth0

If you need to add a route for a specific host or network, instead of using default you will use the CIDR of the network:

192.168.0.0/24 172.16.32.6 - eth0

Save Changes

3. Now to apply changes we need to restart the wickedd service to load the new configuration files and then bring the interface up using the wicked command.

sudo systemctl restart wickedd.service

Check the status of wickedd to make sure there were no errors in the configuration file.

sudo systemctl status wickedd.service

If no issues appeared, lets proceed to enabling the interface.

sudo wicked ifup eth0

4. Lets see if our IP Address applied by checking our interfaces again using the ip addr command.

linuxman@linux-m4u5:/etc/sysconfig/network> ip addr
<--Output Omitted-->
2: eth0: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
  link/ether 52:54:00:e7:e5:a2 brd ff:ff:ff:ff:ff:ff
  inet 172.16.32.5/29 brd 172.16.32.7 scope global eth0
    valid_lft forever preferred_lft forever
  inet6 fe80::5054:ff:fee7:e5a2/64 scope link
    valid_lft forever preferred_lft forever

Here we see that the interface state is UP and our static IP Address has been applied. Now lets check the routes using the ip route command.

linuxman@linux-m4u5:/etc/sysconfig/network> ip route
default via 172.16.32.6 dev eth0

If everything seems good so far, lets attept to ping an address outside of our network to make sure we have internet access. I will be pinging CloudFare’s DNS IP Address.

linuxman@linux-m4u5:/etc/sysconfig/network> ping -c 4 1.1.1.1
PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
64 bytes from 1.1.1.1: icmp_seq=1 ttl=52 time=35.7 ms
64 bytes from 1.1.1.1: icmp_seq=2 ttl=52 time=39.4 ms
64 bytes from 1.1.1.1: icmp_seq=3 ttl=52 time=40.2 ms
64 bytes from 1.1.1.1: icmp_seq=4 ttl=52 time=46.2 ms

--- 1.1.1.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 35.763/40.411/46.201/3.752 ms

5. So far we have everything working except out DNS Server. In the same location as we are now, using your favorite text editor, edit the file config.

sudo vim config

In this file, search for the line NETCONFIG_DNS_STATIC_SERVERS="", and add your preferred DNS Server in the quotes.

NETCONFIG_DNS_STATIC_SERVERS="1.1.1.1"

Restart wickedd.

sudo systemctl restart wickedd.service

Now lets try to resolve Google.com with our DNS Server added.

linuxman@linux-m4u5:/etc/sysconfig/network> nslookup google.com
Server: 1.1.1.1
Address:  1.1.1.1#53

Non-authoritative answer:
Name:  google.com
Address: 172.217.9.174
Name:  google.com
Address: 2607:f8b0:4000:806::200e
DHCP Configuration

1. Using our template, for a DHCP configuration you will need to setup the variables as such:

BOOTPROTO='dhcp'
STARTMODE='hotplug'
ZONE='public'
IPADDR=''
NETMASK=''

NOTE: The ZONE variable applies to a zone in your firewall that supports firewal extension scripts such as firewalld. I am using firewalld and my zone would be public.

Save Changes.

2. Now to apply changes we need to restart the wickedd service to load the new configuration files and then bring the interface up using the wicked command.

sudo systemctl restart wickedd.service

Check the status of wickedd to make sure there were no errors in the configuration file.

sudo systemctl status wickedd.service

If no issues appeared, lets proceed to enabling the interface.

sudo wicked ifup eth0

3. Lets see if we received an IP Address by checking our interfaces again using the ip addr command.

linuxman@linux-m4u5:/etc/sysconfig/network> ip addr
<--Output Omitted-->
2: eth0: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
  link/ether 52:54:00:e7:e5:a2 brd ff:ff:ff:ff:ff:ff
  inet 172.16.32.2/29 brd 172.16.32.7 scope global eth0
    valid_lft forever preferred_lft forever
  inet6 fe80::5054:ff:fee7:e5a2/64 scope link
    valid_lft forever preferred_lft forever

Here we see that the interface state is UP and our DHCP Server has leased an IP Address to our interface. Now lets check the routes using the ip route command.

linuxman@linux-m4u5:/etc/sysconfig/network> ip route
default via 172.16.32.6 dev eth0

If everything seems good so far, lets attept to ping an address outside of our network to make sure we have internet access. I will be pinging CloudFare’s DNS IP Address.

linuxman@linux-m4u5:/etc/sysconfig/network> ping -c 4 1.1.1.1
PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
64 bytes from 1.1.1.1: icmp_seq=1 ttl=52 time=35.7 ms
64 bytes from 1.1.1.1: icmp_seq=2 ttl=52 time=39.4 ms
64 bytes from 1.1.1.1: icmp_seq=3 ttl=52 time=40.2 ms
64 bytes from 1.1.1.1: icmp_seq=4 ttl=52 time=46.2 ms

--- 1.1.1.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 35.763/40.411/46.201/3.752 ms

4. So far we have everything working except our DNS Server. In the same location as we are now, using your favorite text editor, edit the file config.

sudo vim config

In this file, search for the line NETCONFIG_DNS_STATIC_SERVERS="", and add your preferred DNS Server in the quotes.

NETCONFIG_DNS_STATIC_SERVERS="1.1.1.1"

Restart wickedd.

sudo systemctl restart wickedd.service

Now lets try to resolve Google.com with our DNS Server added.

linuxman@linux-m4u5:/etc/sysconfig/network> nslookup google.com
Server: 1.1.1.1
Address:  1.1.1.1#53

Non-authoritative answer:
Name:  google.com
Address: 172.217.9.174
Name:  google.com
Address: 2607:f8b0:4000:806::200e

This concludes the configuration of a new interface in Wicked. For more configuration variables and interface types, reference the man pages.


0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *