Add secondary IP

In rare cases, a second IP might be required. To add a secondary IP, the network configuration file will need to be manually edited.

  1. Download a copy of the network configuration file. These are stored in /etc/netctl and are share the same name as the interface. If you are using enp2s0 to access the gateway, then you'll need to download /etc/netctl/enp2s0.

  2. Edit the file in a Unix compatible text editor. Most modern editors will work (Atom, VSCode, Sublime Notepad++), but avoid older programs like Notepad.

  3. Add the following line to the end of the file, replacing the IP address and interface name with your required values. Essentially these strings are passed directly to the ip command. Routes and tertiary addresses can also be added by adding more strings to the array.

    IPCustom=('add 192.168.1.20/24 dev enp2s0 brd +')
  4. Save the changes and upload the file to the device, replacing the old configuration file

  5. Restart the interface, e.g. netctl restart enp2s0

Last updated