cancel
Showing results for 
Search instead for 
Did you mean: 
RasoolSB
Cadet
Cadet
  • 1,196 Views

Secondary Virtual (DHCP) Private IP is getting flushed out in every reboot

Jump to solution

I am trying to add a secondary virtual dynamic (DHCP) private IP address on Azure customized Linux virtual machine using "ifconfig eth0 add 192.168.1.6" and it is successfully added as soon I ran the command (hurray). before running the above command to add secondary virtual IP address inside OS, I have added the secondary virtual IP address through Azure portal followed by the steps (NIC -> IP Configuration -> Add). Here my issue starts, if I reboot the machine, it is getting flushed out (deleted). then again I have to run the same command to add secondary virtual IP to make it available. Am I missing something to update any file ? or to modify any file, so that it will be saved permanently ? Sorry, I am newbie, please bare with my illogical or stupid question if it is

I have 2 DHCP IPs assigned to same NIC (NIC1) on single VM, one is default Primary IP (ifconfig1) 192.168.1.4 and the second IP which is created as "Virtual IP" and the address is 192.168.1.5. Default primary IP address is working perfect and it gives no error. the secondary IP which is created as "Virtual IP address" is not able to ping by default. to solve this issue, I have added the secondary virtual IP address inside Azure customized Linux operating system by following the command "ifconfig eth0 add 192.168.1.5" and it is added successfully and it starts to ping the server with 192.168.1.5.

Here my issue starts, If I reboot the VM by Azure portal or by OS, whatever the command I ran (ifconfig eth0 add 192.168.1.5) to make the server ping through this IP address 192.168.1.5 is getting flushed out. if I run "ifconfig" after reboot, it shows only one IP address and it is default one "192.168.1.4". Azure customized Linux Operating system is resetting the ipconfig file at the time of loading operating system. hence it is getting flushed out.

Kindly help me!

Labels (3)
1 Solution

Accepted Solutions
RasoolSB
Cadet
Cadet
  • 1,176 Views

My above described issue has been resolved, by running below commands.

Instead of using ifconfig, please use nmcli.

Commands I used to solve my issue is:

1.   nmcli con add con-name eth0 type ethernet +ipv4.addresses 192.168.1.5/26

2.   nmcli con up eth0

View solution in original post

1 Reply
RasoolSB
Cadet
Cadet
  • 1,177 Views

My above described issue has been resolved, by running below commands.

Instead of using ifconfig, please use nmcli.

Commands I used to solve my issue is:

1.   nmcli con add con-name eth0 type ethernet +ipv4.addresses 192.168.1.5/26

2.   nmcli con up eth0

Join the discussion
You must log in to join this conversation.