Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?


Perform Initial Configuration on the MX304 Router

The router is shipped with the Junos operating system (OS) preinstalled and ready to be configured when the router is powered on. Two 16-MB internal NAND Flash memory devices are located on the baseboard for BIOS storage. The USB storage device can be inserted into the slot in the Routing Engine panel faceplate. The system also supports two M.2-based solid-state drive (SSD) slots. These two SSD devices act as the primary boot devices (sda and sdb). When the router boots, it first attempts to start the Junos OS image on the USB Flash memory drive if it detects one. If a USB flash drive is not inserted into the router, or the attempt otherwise fails, the router next tries the primary boot device, and then tries the secondary boot device.

The MX304 router ships with factory-default settings that enable some zero touch provisioning (ZTP) functions. These settings load as soon as you power on the switch. In our case we configure the router manually, so we remove the ZTP settings as part of our initial configuration.

When ZTP is not used you must perform the initial configuration of an MX304 router through the console port (CON) using the Junos OS command-line interface (CLI). If your MX304 has dual Routing-Engines, you should perform these steps on each Routing-Engine, being sure to specify a unique management IP address for the management interface on each Routing-Engine. See Configuring Junos OS for the First Time on a Device with Dual Routing Engines for information on how to use configuration groups to share a single configuration file between both Routing-Engines.

Have the following information ready before you begin the initial configuration:
  • The router's host and domain name

  • IP address and subnet mask for the management and loopback interfaces

  • IP address of a default gateway for the management network

  • IP address of a DNS server

  • The root user's password

This procedure connects the router to the network but does not enable it to forward traffic. For complete information about enabling the router to forward traffic, including examples, see the Junos OS configuration guides.

To configure the software:

  1. Verify that the router is powered on.
  2. Note:

    You may see messages on the console relating to ZTP and DHCP. These messages stop once your remove the ZTP statements from the default configuration.

    Configure your serial port for 9600 bps/8-N-1, and attach the cable to the CON port of the desired Routing-Engine. Log in as the “root” user. No password is needed.
  3. Start the CLI.
  4. Enter configuration mode.
  5. Set the root authentication password by entering either a plain text password, an encrypted password, or an SSH public key string (ECDSA, ED25519 or RSA).



  6. Remove factory default configuration statements that relate to ZTP. After you commit these initial changes the ZTP process is stopped and the related console messages are no longer displayed.
  7. Configure the IP address and prefix length for the router’s management Ethernet interface (fxp0). You also configure an IPv4 address on the loopback interface in this step. Having a routible IP address on the loopback interface is a best practice and is generally needed later, when routing protocols are configured.
  8. Perform an initial commit to activate the modified configuration.
  9. Configure the router's host name. If the name includes spaces, enclose the name in quotation marks (“ ”).
  10. Configure the router’s domain name.
  11. Configure the IP address of a DNS server.
  12. Configure one or more static routes to remote subnets that have access to the management subnet. Without static routing, access to the management port is limited to devices attached to the management subnet. Static routing is needed to access the management interface from devices attached to remote subnets. For more information about static routes, see Configure Static Routes.

    In our example we define a single default static route to provide management network reachability to all possible remote destinations.

  13. Configure the IP address of a backup router. The backup router is only used while the routing protocol is not running. The primary use of the backup router is to provide routing capability for the management port on the backup Routing-Engine. This is because the backup Routing-Engine does not run the routing protocol daemon (rpd).
  14. In most cases the backup router is the same IP next hop as used for the management network's static routes. We again use a default route to provide the back up Routing-Engine with reachability for all possible remote destinations.
  15. Configure remote access for the root user over ssh. By default the root user is only able to log-in via the console port. The root-login allow statement permits remote log-in for the root user.
  16. (Optional) Display the configuration to verify it's correct.
  17. Commit the configuration to activate it on the router.
  18. When you've finished configuring the router, exit configuration mode.

    Congratulations. The initial configuration is complete. Remember to also configure the backup Routing Engine if your MX304 is equipped with redundant control planes. At this point you should be able to remotely access both of the Routing-Engines as the root user with ssh.