LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   How to have Virtual IP Address (https://www.linuxquestions.org/questions/linux-server-73/how-to-have-virtual-ip-address-4175440931/)

sunzeal 12-11-2012 03:45 AM

How to have Virtual IP Address
 
Hi

I have IP Address assigned via DHCP.

In all the guides i find that they have static IP Address but in my virtual machine, my ip address is via DHCP.

So any guide on how can i have a virtual ip address over single NIC so that i can use it for heartbeat.

Current Configuration of ETH0 :-

Code:

DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:0C:29:8F:BF:13
IPV6INIT=yes
NM_CONTROLLED=yes
ONBOOT=yes
TYPE=Ethernet
UUID="f29eae5a-60af-4705-8e89-3613bb83a499"
USERCTL=no


I tried and copy pasted it with ETH0:01 and upped that interface with command ifup eth0:01. Than did ifconfig but could not find anything, it just shows eth0 and lo.

blueh2o 12-11-2012 09:33 AM

Quote:

Originally Posted by sunzeal (Post 4846798)
I tried and copy pasted it with ETH0:01 and upped that interface with command ifup eth0:01.

You cannot use DHCP on an alias interface. You'll want to assign a static IP.

wpeckham 12-11-2012 01:07 PM

He said ti right, but ..
 
To make it clear, your physical interface CAN have a dynamic address and your alias a static. The other way does not work.
You need to assign an address and settings to the alias.

You might look at http://www.cyberciti.biz/tips/ubuntu...rk-device.html for details.

sunzeal 12-11-2012 03:33 PM

thanks blueh20 & wpeckham.

That method from cyberciti worked, but was wondering, the address which i create with ifconfig eth0:0 192.168.1.11 up can be considered as a virtual IP address ?

I am able to ping the address i create, but i cannot see it in : ifconfig -a


All times are GMT -5. The time now is 03:46 PM.