cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
11434
Views
10
Helpful
5
Replies

how to swap primary and secondary ip address?

liaolugesi
Level 1
Level 1

we need to change the IP address of our VLAN, and I configured the new IP address as secondary IP address,now I want to improve the secondary address as the primary and delete the old ones,how to do that ?

Thank you!

1 Accepted Solution

Accepted Solutions

ivillegas
Level 6
Level 6

Try these commands:

no ip address secondary

ip address

ip address secondary

View solution in original post

5 Replies 5

ivillegas
Level 6
Level 6

Try these commands:

no ip address secondary

ip address

ip address secondary

Tahnk you very much for your help!

This is just a further cosmetic explanation of earlier provided correct answer.

 

no ip address <ip address1, subnet mask1> secondary

ip address <ip address1, subnet mask1>

      !  it ll overwrite the existing primary ip address.

ip address <ip address2, subnet mask2> secondary

 

 

End Reslt

-------------

IP Address 1 became primary and 2 became secondary

CCIE 37523

SiliconBrian
Level 1
Level 1

If you only have a single mgmt interface, you may be able to swap them by combining both commands on a single line joined with ';' (semicolon).

e.g. current config:

interface mgmt0
ip address 192.168.1.1/24
ip address 10.10.10.1/24 secondary


NOTE: for safety, run from console or connected in via a different VLAN SVI IP if possible... :)

Steps required:
1) Remove current secondary IP (not allowed to have main or secondary IPs conflict/duplicated)
2) Replace current IP with old secondary IP
3) add old IP as secondary IP

Combine all 3 commands into a single command joined with ';' (semicolon), e.g.:

no ip address 10.10.10.1/24 secondary ; ip address 10.10.10.1/24 ; ip address 192.168.1.1/24 secondary


Resulting config:

interface mgmt0
ip address 10.10.10.1/24
ip address 192.168.1.1/24 secondary


I looked into using configuration session/commit, but this does not support interface IP change.

Brian

@SiliconBrian are you sure about the need to remove secondary IP before adding it as primary?  I lab'd it up in EVE-NG and was able to apply the secondary as primary in one command. Running - ip address 10.10.10.1 255.255.255.0, made it primary and removed secondary even though 10.10.10.1 was currently set as secondary.