CentOS — Add IP Address

If you haven't already...
Set up an Affiliate Account or Set up a Small Business account.
Posted on November 19, 2017 by admin under CentOS
Leave a comment

Given that you have an ip address of 192.168.0.129 assigned to your system and want to add 192.168.0.130 to the same server, this procedure will show you how.

Manual Setup

  1. Edit the /etc/sysconfig/network-scripts/ifcfg-<devid> file. Note: <devid> is the id of the device, likely it starts with ens followed by a number.
  2. Add the lines below. Note that the names are the same as the defaults with a number after. Increment the number by 1 for every new ip you want to add.
    • IPADDR1=192.168.0.130
    • PREFIX1=24
  3. Save the file and restart the interface.

Using Network Manager

  1. Run the nmtui utility. The nmtui utility is a text interface to the network manager.
  2. Select Edit a connection
  3. Arrow down to the interface you want to edit and press Enter.
  4. Use the Tab key to move the cursor to highlight the <Add…> text and press Enter. This will add a new IPv4 address field
  5. In the IPv4 address field, enter 192.168.0.130/24.
  6. Use the Tab key to move the cursor and highlight the ok button and press Enter.
  7. Use the Tab key to highlight the <Back> text and press Enter.
  8. Use the Down Arrow to highlight the Quit text and press Enter.
  9. Restart the interface.

Leave a Reply

Please Login to comment
  Subscribe  
Notify of