Finding Out What IP Addresses Are Used on the Router
Problem
You want to find out the IP addresses assigned to router interfaces.
Solution
Use the following command to find out what IP addresses have been assigned on the router:
aviva@RouterB> show interfaces terse Interface Admin Link Proto Local Remote fe-0/0/0 up up fe-0/0/0.0 up up inet 10.0.24.2/24 gr-0/0/0 up up ip-0/0/0 up up ls-0/0/0 up up lt-0/0/0 up up mt-0/0/0 up up pd-0/0/0 up up pe-0/0/0 up up sp-0/0/0 up up sp-0/0/0.16383 up up inet fe-0/0/1 up up fe-0/0/1.0 up up inet 10.0.29.2/24 t1-0/0/2 up up t1-0/0/2.0 up down inet 10.0.31.1/24 t1-0/0/3 up down dsc up up gre up up ipip up up lo0 up up lo0.0 up up inet 192.168.14.1 --> 0/0 lo0.16385 up up inet 10.0.0.1 --> 0/0 10.0.0.16 --> 0/0 lsi up up mtun up up pimd up up pime up up pp0 up up tap up up
Another way to display IP addresses quickly is to always include the interface's IP address when configuring the interfaces:
[edit interfaces] aviva@RouterD# set fe-0/0/0 description "10.0.24.2/24; to RouterH's fe-1/0/1"
Then use the following command to list the addresses:
aviva@RouterD> show interfaces descriptions Interface Admin Link Description fe-0/0/0 up up 10.0.24.2/24; to RouterH's fe-1/0/1 fe-0/0/1 up up 10.0.29.2/24; to RouterC's fe-0/0/1 t1-0/0/2 up up 10.0.31.1/24; to RouterF's t1-0/0/2 lo0 up up 192.168.14.1/32; local loopback
Discussion
When you are modifying a router configuration or trying to debug a problem, sometimes you need a quick way to find out what IP addresses are configured on the router. You can read through the interfaces portion of the configuration file, which is where all IP addresses are configured, but if you have a number of PICs and ports or if you have many logical interfaces, the information will likely be spread out over many screens. A simple way to get a list of configured IP addresses is to use the show interfaces terse command. The IP address is shown in the Local column. The output in this recipe shows IP addresses for three network interfaces, fe-0/0/0, fe-0/0/1, and t1-0/0/2, and for the lo0 interface.
Another strategy for displaying IP addresses quickly is to always include the inter-face's IP address in the description statement when configuring the interfaces. Then use the show interfaces descriptions command to list all interface IP addresses.
The output of the show interfaces terse command also provides a quick view of which slot each of the PICs is installed in. When PICs are installed in the router, the JUNOS software detects their presence and displays them in the output of the show interfaces command. In this example, the router (a J-series box) has two Fast Ethernet PICs in slot 0 (interfaces fe-0/0/0 and fe-0/0/1) and two serial cards in slot 0 (interfaces se-0/0/2 and se-0/0/3).
You can confirm the presence of these PICs with the show chassis hardware command, but this command does not tell you which slot the PICs are in:
aviva@RouterB> show chassis hardware Hardware inventory: Item Version Part number Serial number Description Chassis JN002447AA J2300 Routing Engine REV 07 750-009992 AA04350171 RE-J.1 FPC 0 REV 04 750-010739 AC04430288 FPC PIC 0 2x FE, 2x Serial
Some of the interfaces (gr-0/0/0, ip-0/0/0, ls-0/0/0, lt-0/0/0, mt-0/0/0, pd-0/0/0, and pe-0/0/0) are virtual interfaces that are used for tunneling. They are virtual in that they are not necessarily tied to a specific network card. gr-0/0/0 and ip-0/0/0 are for unicast tunnels with GRE or IP-IP encapsulation, ls-0/0/0 is a link services interface, lt-0/0/0 is a logical tunnel interface, mt-0/0/0 is a multicast tunnel, and pd-0/0/0 and pe-0/0/0 are PIM tunnels. lo is the loopback interface (see Recipe 7.3), and the remaining are nonconfigurable interfaces used internally by the JUNOS software (see Recipe 7.23).
See Also
Recipes 7.3 and 7.23