<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kwinsch</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kwinsch"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Kwinsch"/>
	<updated>2026-05-06T19:47:22Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Configure_Networking&amp;diff=28992</id>
		<title>Configure Networking</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Configure_Networking&amp;diff=28992"/>
		<updated>2025-02-12T16:08:10Z</updated>

		<summary type="html">&lt;p&gt;Kwinsch: /* Interface configuration */ Added link to syntax documentation of ifupdown-ng&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page documents the various networking options available in Alpine Linux. This page helps to configure your network and to [[#Connectivity testing|test]] your Internet access.&lt;br /&gt;
&lt;br /&gt;
== Network setup-scripts ==&lt;br /&gt;
&lt;br /&gt;
Among the alpine setup scripts that are installed as part of &amp;lt;code&amp;gt;alpine-conf&amp;lt;/code&amp;gt;, the following network related scripts are available. &lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;setup-hostname&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;setup-interfaces&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;setup-dns&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;setup-proxy&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;setup-ntp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All the above utilities are interactive. {{:Ethernet}}&lt;br /&gt;
&lt;br /&gt;
For a versatile networking front end refer [[NetworkManager]]. If your networking needs are more advanced, you have to refer to the following detailed guide for manual network configuration. &lt;br /&gt;
&lt;br /&gt;
== Setting hostname ==&lt;br /&gt;
&lt;br /&gt;
To set the system hostname:{{Cmd|# echo &amp;quot;shortname&amp;quot; &amp;gt; /etc/hostname}}&lt;br /&gt;
&lt;br /&gt;
Then, to activate the change: {{Cmd|# hostname -F /etc/hostname}}&lt;br /&gt;
&lt;br /&gt;
If you&#039;re using IPv6, you should also add the following special IPv6 addresses to your {{path|/etc/hosts}} file:{{cat|/etc/hosts|...&lt;br /&gt;
::1             localhost ipv6-localhost ipv6-loopback&lt;br /&gt;
fe00::0         ipv6-localnet&lt;br /&gt;
ff00::0         ipv6-mcastprefix&lt;br /&gt;
ff02::1         ipv6-allnodes&lt;br /&gt;
ff02::2         ipv6-allrouters&lt;br /&gt;
ff02::3         ipv6-allhosts&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Tip|If you&#039;re going to use automatic IP configuration, such as IPv4 DHCP or IPv6 Stateless Autoconfiguration, you can skip ahead to [[#Configuring_DNS|Configuring DNS]].  Otherwise, if you&#039;re going to use a static IPv4 or IPv6 address, continue below.}}&lt;br /&gt;
&lt;br /&gt;
For a static IP configuration, it&#039;s common to also add the machine&#039;s hostname you just set (above) to the {{path|/etc/hosts}} file.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s an IPv4 example:{{cat|/etc/hosts|...&lt;br /&gt;
192.168.1.150   shortname.domain.com&lt;br /&gt;
...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
And here&#039;s an IPv6 example:{{cat|/etc/hosts|...&lt;br /&gt;
2001:470:ffff:ff::2   shortname.domain.com&lt;br /&gt;
...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Configuring DNS ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|&#039;&#039;&#039;For users of IPv4 DHCP:&#039;&#039;&#039; Please note that {{path|/etc/resolv.conf}} will be completely overwritten with any nameservers provided by DHCP.&lt;br /&gt;
If DHCP does not provide any nameservers, then {{path|/etc/resolv.conf}} will still be overwritten, but will not contain any nameservers!}}&lt;br /&gt;
&lt;br /&gt;
For a static IP address and static nameservers, use one of the following examples.&lt;br /&gt;
&lt;br /&gt;
For IPv4 nameservers, edit your {{path|/etc/resolv.conf}} file to look like this:&amp;lt;br /&amp;gt;&lt;br /&gt;
The following example uses [https://en.wikipedia.org/wiki/Google_Public_DNS Google&#039;s Public DNS servers].&lt;br /&gt;
{{cat|/etc/resolv.conf|nameserver 8.8.8.8&lt;br /&gt;
nameserver 8.8.4.4&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
For IPv6 nameservers, edit your {{path|/etc/resolv.conf}} file to look like this:&amp;lt;br /&amp;gt;&lt;br /&gt;
The following example uses [https://www.he.net/ Hurricane Electric&#039;s] public DNS server.&lt;br /&gt;
{{cat|/etc/resolv.conf|nameserver 2001:470:20::2}}&lt;br /&gt;
You can also use Hurricane Electric&#039;s public IPv4 DNS server:&lt;br /&gt;
{{cat|/etc/resolv.conf|nameserver 74.82.42.42}}&lt;br /&gt;
&lt;br /&gt;
{{Tip|If you decide to use Hurricane Electric&#039;s nameserver, be aware that it is &#039;Google-whitelisted&#039;. What does this mean?  It allows you access to many of Google&#039;s services via IPv6. (Just don&#039;t add other, non-whitelisted, nameservers to {{path|/etc/resolv.conf}} — ironically, such as Google&#039;s Public DNS Servers.) Read [https://www.google.com/intl/en/ipv6/ here] for more information.}}&lt;br /&gt;
&lt;br /&gt;
== Interface configuration ==&lt;br /&gt;
{{Note|Before configuring any interfaces via {{path|/etc/network/interfaces}}, check the type of network manager used in your system. You may check so via the command &amp;lt;code&amp;gt;ifquery --version&amp;lt;/code&amp;gt;. On recent Alpine Linux versions, it is likely that ifupdown-ng is configured. The corresponding documentation can be found here: https://github.com/ifupdown-ng/ifupdown-ng/blob/main/doc/ADMIN-GUIDE.md}}&lt;br /&gt;
&lt;br /&gt;
=== Loopback configuration  ===&lt;br /&gt;
&lt;br /&gt;
{{Note|The loopback configuration is mandatory and must appear first in {{path|/etc/network/interfaces}} to prevent networking issues.}}&lt;br /&gt;
&lt;br /&gt;
To configure loopback, add the following to a new file {{path|/etc/network/interfaces}}: {{cat|/etc/network/interfaces|...&lt;br /&gt;
auto lo&lt;br /&gt;
iface lo inet loopback&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The above works to set up the IPv4 loopback address (127.0.0.1), and the IPv6 loopback address (&amp;lt;code&amp;gt;::1&amp;lt;/code&amp;gt;) — if you enabled IPv6.&lt;br /&gt;
&lt;br /&gt;
=== Wireless configuration ===&lt;br /&gt;
&lt;br /&gt;
Alpine Linux supports two wireless daemons i.e [[Wi-Fi#wpa_supplicant|wpa_supplicant]] and [[iwd]]. &amp;lt;code&amp;gt;setup-interfaces&amp;lt;/code&amp;gt; script uses  [[Wi-Fi#wpa_supplicant|wpa_supplicant]] to configure wireless interface. &lt;br /&gt;
&lt;br /&gt;
{{Note| Using both wireless daemons simultaneously lead to conflicts.}}&lt;br /&gt;
&lt;br /&gt;
=== Ethernet configuration ===&lt;br /&gt;
&lt;br /&gt;
For the following Ethernet configuration examples, we will assume that you are using Ethernet device &amp;lt;code&amp;gt;eth0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Initial configuration ====&lt;br /&gt;
Add the following to the file {{path|/etc/network/interfaces}}, above any IP configuration for &amp;lt;code&amp;gt;eth0&amp;lt;/code&amp;gt;:&lt;br /&gt;
{{cat|/etc/network/interfaces|...&lt;br /&gt;
auto eth0&lt;br /&gt;
...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==== IPv4 DHCP configuration ====&lt;br /&gt;
Add the following to the file {{path|/etc/network/interfaces}}, below the &amp;lt;code&amp;gt;auto eth0&amp;lt;/code&amp;gt; definition:&lt;br /&gt;
{{cat|/etc/network/interfaces|...&lt;br /&gt;
iface eth0 inet dhcp&lt;br /&gt;
...&lt;br /&gt;
}}&lt;br /&gt;
By default, the busybox DHCP client (udhcpc) requests a static set of options from the DHCP server. If you need to extend this set, you can do so by setting some additional command line options for the DHCP client, via the &amp;lt;code&amp;gt;udhcpc_opts&amp;lt;/code&amp;gt; in your interface configuration. The following example requests&lt;br /&gt;
&amp;lt;code&amp;gt;domain-search&amp;lt;/code&amp;gt; option:&lt;br /&gt;
{{cat|/etc/network/interfaces|...&lt;br /&gt;
iface eth0 inet dhcp&lt;br /&gt;
    udhcpc_opts -O search&lt;br /&gt;
...&lt;br /&gt;
}}&lt;br /&gt;
For a complete list of command line options for udhcpc, see [https://busybox.net/downloads/BusyBox.html#udhcpc this document].&lt;br /&gt;
&lt;br /&gt;
==== IPv4 Static Address Configuration ====&lt;br /&gt;
Add the following to the file {{path|/etc/network/interfaces}}, below the &amp;lt;code&amp;gt;auto eth0&amp;lt;/code&amp;gt; definition:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/network/interfaces|...&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
        address 192.168.1.150&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
        gateway 192.168.1.1&lt;br /&gt;
...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Since Alpine 3.13 (and only if you have &amp;lt;code&amp;gt;ifupdown-ng&amp;lt;/code&amp;gt; installed) must be:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/network/interfaces|...&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
        address 192.168.1.150/24&lt;br /&gt;
        gateway 192.168.1.1&lt;br /&gt;
...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===== Additional IP addresses =====&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/network/interfaces|...&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
        address 192.168.1.150&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
        address 192.168.1.151/24&lt;br /&gt;
...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Since Alpine 3.13 (and only if you have &amp;lt;code&amp;gt;ifupdown-ng&amp;lt;/code&amp;gt; installed) must be:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/network/interfaces|...&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
        address 192.168.1.150/24&lt;br /&gt;
        gateway 192.168.1.1&lt;br /&gt;
&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
        address 192.168.1.151/24&lt;br /&gt;
...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==== IPv6 DHCP Configuration ====&lt;br /&gt;
Alpine&#039;s use of ifupdown-ng supports three DHCP clients: udhcpc, dhclient, and dhcpcd. Of these, only dhcpcd can interact with both DHCP and DHCPv6 from the same process, which ifupdown-ng requires. Thus the IPv4 DHCP configuration given above will also result in the use of DHCPv6, but only if you install the dhcpcd package. (The ifupdown-ng scripts prioritize dhclient over udhcpc, and they prioritize dhcpcd over dhclient; see {{path|/usr/libexec/ifupdown-ng/dhcp}}.)&lt;br /&gt;
&lt;br /&gt;
==== IPv6 Stateless Autoconfiguration ====&lt;br /&gt;
Add the following to the file {{path|/etc/network/interfaces}}, below the &amp;lt;code&amp;gt;auto eth0&amp;lt;/code&amp;gt; definition:&lt;br /&gt;
{{cat|/etc/network/interfaces|...&lt;br /&gt;
iface eth0 inet6 auto&lt;br /&gt;
...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==== IPv6 Static Address Configuration ====&lt;br /&gt;
Add the following to the file {{path|/etc/network/interfaces}}, below the &amp;lt;code&amp;gt;auto eth0&amp;lt;/code&amp;gt; definition:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/network/interfaces|...&lt;br /&gt;
iface eth0 inet6 static&lt;br /&gt;
        address 2001:470:ffff:ff::2&lt;br /&gt;
        netmask 64&lt;br /&gt;
        gateway 2001:470:ffff:ff::1&lt;br /&gt;
        pre-up echo 0 &amp;gt; /proc/sys/net/ipv6/conf/eth0/accept_ra&lt;br /&gt;
...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Since Alpine Linux 3.13 (and only if you have &amp;lt;code&amp;gt;ifupdown-ng&amp;lt;/code&amp;gt; installed) must be as:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/network/interfaces|...&lt;br /&gt;
iface eth0 inet6 static&lt;br /&gt;
        address 2001:470:ffff:ff::2/64&lt;br /&gt;
        gateway 2001:470:ffff:ff::1&lt;br /&gt;
        pre-up echo 0 &amp;gt; /proc/sys/net/ipv6/conf/eth0/accept_ra&lt;br /&gt;
...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Example: Dual-Stack Configuration ===&lt;br /&gt;
&lt;br /&gt;
This example shows a dual-stack configuration.&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/network/interfaces|auto lo&lt;br /&gt;
iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
auto eth0&lt;br /&gt;
&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
        address 192.168.1.150&lt;br /&gt;
       netmask 255.255.255.0&lt;br /&gt;
        gateway 192.168.1.1&lt;br /&gt;
&lt;br /&gt;
iface eth0 inet6 static&lt;br /&gt;
        address 2001:470:ffff:ff::2&lt;br /&gt;
        netmask 64&lt;br /&gt;
        gateway 2001:470:ffff:ff::1&lt;br /&gt;
        pre-up echo 0 &amp;gt; /proc/sys/net/ipv6/conf/eth0/accept_ra&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Take care since Alpine 3.13 (and only if you have &amp;lt;code&amp;gt;ifupdown-ng&amp;lt;/code&amp;gt; installed) must be as:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/network/interfaces|auto lo&lt;br /&gt;
iface lo inet loopback&lt;br /&gt;
&lt;br /&gt;
auto eth0&lt;br /&gt;
&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
        address 192.168.1.150/24&lt;br /&gt;
        gateway 192.168.1.1&lt;br /&gt;
&lt;br /&gt;
iface eth0 inet6 static&lt;br /&gt;
        address 2001:470:ffff:ff::2/64&lt;br /&gt;
        gateway 2001:470:ffff:ff::1&lt;br /&gt;
        pre-up echo 0 &amp;gt; /proc/sys/net/ipv6/conf/eth0/accept_ra&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Networking service ==&lt;br /&gt;
&lt;br /&gt;
Changes made to {{path|/etc/network/interfaces}} can be activated by running: {{Cmd|# rc-service networking restart}}&lt;br /&gt;
To &#039;&#039;&#039;start&#039;&#039;&#039; (or &#039;&#039;&#039;restart&#039;&#039;&#039;) the networking service: {{Cmd|# rc-service networking --quiet start &amp;amp;}}&lt;br /&gt;
To add networking service so that it starts on boot: {{Cmd|# rc-update add networking boot}}&lt;br /&gt;
&lt;br /&gt;
== Firewall==&lt;br /&gt;
&lt;br /&gt;
Alpine Linux provides multiple firewall software. Some of the prominent ones are listed below:&lt;br /&gt;
* [https://git.alpinelinux.org/awall/about/ Alpine Wall User&#039;s Guide]&lt;br /&gt;
* [[Iptables]]&lt;br /&gt;
* [[nftables]]&lt;br /&gt;
* [[Uncomplicated Firewall]]&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Connectivity testing ===&lt;br /&gt;
&lt;br /&gt;
Test if networking is configured properly by attempting to ping out:&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;$ ping www.google.com&lt;br /&gt;
PING www.l.google.com (74.125.47.103) 56(84) bytes of data.&lt;br /&gt;
64 bytes from yw-in-f103.1e100.net (74.125.47.103): icmp_seq=1 ttl=48 time=58.5 ms&lt;br /&gt;
64 bytes from yw-in-f103.1e100.net (74.125.47.103): icmp_seq=2 ttl=48 time=56.4 ms&lt;br /&gt;
64 bytes from yw-in-f103.1e100.net (74.125.47.103): icmp_seq=3 ttl=48 time=57.0 ms&lt;br /&gt;
64 bytes from yw-in-f103.1e100.net (74.125.47.103): icmp_seq=4 ttl=48 time=60.2 ms&lt;br /&gt;
^C&lt;br /&gt;
--- www.l.google.com ping statistics ---&lt;br /&gt;
4 packets transmitted, 4 received, 0% packet loss, time 3007ms&lt;br /&gt;
rtt min/avg/max/mdev = 56.411/58.069/60.256/1.501 ms&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
For an IPv6 traceroute run &amp;lt;code&amp;gt;traceroute6&amp;lt;/code&amp;gt;:&lt;br /&gt;
{{Cmd|$ traceroute6 ipv6.google.com&lt;br /&gt;
traceroute to ipv6.l.google.com (2001:4860:8009::67) from 2001:470:ffff:ff::2, 30 hops max, 16 byte packets&lt;br /&gt;
 1  2001:470:ffff:ff::1 (2001:470:ffff:ff::1)  3.49 ms  0.62 ms  0.607 ms&lt;br /&gt;
 2  *  *  *&lt;br /&gt;
 3  *  *  *&lt;br /&gt;
 4  pr61.iad07.net.google.com (2001:504:0:2:0:1:5169:1)  134.313 ms  95.342 ms  88.425 ms&lt;br /&gt;
 5  2001:4860::1:0:9ff (2001:4860::1:0:9ff)  100.759 ms  100.537 ms  89.907 ms&lt;br /&gt;
 6  2001:4860::1:0:5db (2001:4860::1:0:5db)  115.563 ms  102.946 ms  106.191 ms&lt;br /&gt;
 7  2001:4860::2:0:a7 (2001:4860::2:0:a7)  101.754 ms  100.475 ms  100.512 ms&lt;br /&gt;
 8  2001:4860:0:1::c3 (2001:4860:0:1::c3)  99.272 ms  111.989 ms  99.835 ms&lt;br /&gt;
 9  yw-in-x67.1e100.net (2001:4860:8009::67)  101.545 ms  109.675 ms  99.431 ms&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== iproute2 ===&lt;br /&gt;
&lt;br /&gt;
Install the {{pkg|iproute2}} package which provides the &#039;ss&#039; command which is an alternate to netstat.: {{Cmd|# apk add iproute2}}&lt;br /&gt;
&lt;br /&gt;
Show listening tcp ports:{{Cmd|$ ss -tl}}&lt;br /&gt;
Show listening tcp ports and associated processes:{{Cmd|$ ss -ptl}}&lt;br /&gt;
Show listening and established tcp connections:{{Cmd|$ ss -ta}}&lt;br /&gt;
Show socket usage summary:{{Cmd|$ ss -s}}&lt;br /&gt;
Show more options:{{Cmd|$ ss -h}}&lt;br /&gt;
&lt;br /&gt;
=== drill ===&lt;br /&gt;
&lt;br /&gt;
Install {{pkg|drill}} (it will also install the &#039;ldns&#039; package) which is a superior replacement for nslookup and dig etc: {{Cmd|# apk add drill}}&lt;br /&gt;
&lt;br /&gt;
Then use it as you would for dig: {{Cmd|$ drill alpinelinux.org @8.8.8.8}}&lt;br /&gt;
To perform a reverse lookup (get a name from an IP) use the following syntax: {{Cmd|$ drill -x 8.8.8.8 @208.67.222.222}}&lt;br /&gt;
&lt;br /&gt;
=== Missing interface === &lt;br /&gt;
&lt;br /&gt;
Sometimes networking interface will not be detected by the installation media. Refer to the steps to [[Wi-Fi#Prerequisites|check interface]]. &lt;br /&gt;
Refer to [[Wi-Fi#Troubleshooting|Wifi troubleshooting]] page for issues related to wireless interfaces. If nothing works, you may have to use an alternate interface for installation (e.g. a usb to ethernet adapter).&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
You may also wish to review the following network related articles:&lt;br /&gt;
* [[NetworkManager]] - Front-end to Networking&lt;br /&gt;
* [[VLAN|VLAN setup]]&lt;br /&gt;
* [[Bonding|Bonding setup]]&lt;br /&gt;
* [[Bridge|Network bridge setup]]&lt;br /&gt;
* [[udhcpc|udhcpc configuration]]&lt;br /&gt;
* [[Wifi#wpa_supplicant|wpa_supplicant]] - Default wifi daemon&lt;br /&gt;
* [[Iwd|iwd]] - An alternate wifi daemon&lt;br /&gt;
&lt;br /&gt;
[[Category:Networking]]&lt;/div&gt;</summary>
		<author><name>Kwinsch</name></author>
	</entry>
</feed>