I assumed that assigning a Secondary IP address to an interface in Juniper routers would be the same as we do it in Cisco by using the secondary keyword. But when it comes to Juniper, you better not assume things right away (like I do) :-P.
As shown below, when you put a question mark after the IP address you get an option to configure it as the primary address but there is no option which says anything about configuring it as a secondary IP address.
root@junos# set interfaces ge-1/0/0 unit 1 family inet address 10.2.2.2/24 ? Possible completions: <[Enter]> Execute this command +apply-groups Groups from which to inherit configuration data + apply-groups-except Don't inherit configuration data from these groups > arp Static Address Resolution Protocol entries broadcast Broadcast address preferred Preferred address on interface primary Candidate for primary address in system > vrrp-group VRRP group | Pipe through a command [edit]
So this is how its done…
In Cisco’s IOS:
ciscoasa#conf t ciscoasa(config)# interface FastEthernet0/0 ciscoasa(config-if)# ip address 10.1.1.2 255.255.255.0 ciscoasa(config-if)# ip address 10.2.2.2 255.255.255.0 secondary
In Juniper’s JunOS:
root@junos> edit Entering configuration mode root@junos# set interfaces ge-1/0/0 unit 1 family inet address 10.1.1.2/24 root@junos# set interfaces ge-1/0/0 unit 1 family inet address 10.2.2.2/24 root@junos# set interfaces ge-1/0/0 unit 1 family inet address 10.1.1.2/24 primary
Unlike IOS, JunOS does not replace the first configured IP address with the newly assigned IP address on that interface. It makes two separate entries for the different IPs instead of replacing it. However, you have to specify which one of them gets to be the primary IP address. The other one automatically becomes the secondary IP on that interface.
If you’re not familiar with JunOS CLI and don’t work on it that often, you would really want a JunOS CLI guide handy the next time you work on a Juniper router. ;-)