On Alpine Linux, you can configure a static IP address by editing the network configuration files.
- To view the current network configuration, you can use the command
ip a
orifconfig
. - To configure a static IP address, you need to edit the network configuration file located at /etc/network/interfaces. You can use a text editor such as nano or vim to edit the file.
- Add the following lines to configure a static IP address for the eth0 interface, replacing the IP address, netmask, gateway, and DNS server with your own values:
auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4
- Save the changes and exit the text editor.
- Restart the network service using the following command:
service networking restart
- To verify the new IP address configuration, you can use the command
ip a
orifconfig
again.
It is important to note that these steps are for configuring a static