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
Secondary Virtual dynamic (DHCP) Private IP is getting flushed out in every reboot
I am trying to add a secondary virtual dynamic (DHCP) private IP address on azure 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 :(
Azure Virtual Machines
2 answers
Sort by: Most helpful
-
-
KarishmaTiwari-MSFT 20,782 Reputation points Microsoft Employee Moderator
2023-05-01T15:04:21.5866667+00:00 @Rasool SB I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this!
Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer. Accepted answers show up at the top, resulting in improved discoverability for others.
Issue: Secondary Virtual dynamic (DHCP) Private IP is getting flushed out in every reboot.
If I reboot the VM by 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.
Solution: Instead of using ifconfig, please use nmcli. Commands I used to solve my issue are:
1. nmcli con add con-name eth0 type ethernet +ipv4.addresses 192.168.1.5/26
2. nmcli con up eth0
If you have further questions, please let us know in the comments how we can assist. We are here to help you and strive to make your experience better and greatly value your feedback.