Recently I got into problem to assign 2 IPs on one physical NIC.

There was nothing mentioned in official documentation so I did some research and find the solution.

It is really simple if you are not afraid from command line and VI editor. Unfortunately I did not find a GUI.

Here it is:

  1. Go to command prompt
  2. Be sure that you are root. Otherwise type su - to become.
  3. Type - cd /etc/sysconfig/network-scripts/
  4. Then type ls to see the contents - you should have file ifcfg-eth0 if you have just one interface otherwise if you have multiple interfaces there you’ll find other files like ifcfg-eth1…n.
  5. Then we will copy the file to different name - cp ifcfg-eth0 ifcfg-eth0:0
  6. Next step is to edit newly created file and put the IP we needed.
  7. If needed repeat steps 5 and 6 with different numbers after”:” (1,2,…) to add additional addresses.
  8. If you issue ifconfig you will not see newly created interface, because it is no activated - you need to restart network /etc/init.d/network restart will do it for you.
  9. That’s it.

Comments are welcome.

Share/Save/Bookmark

Comments

Leave a Reply