Explorar o código

VyOS and Junos notes

Håvard O. Nordstrand %!s(int64=4) %!d(string=hai) anos
pai
achega
80ad35fe28

+ 88 - 121
config/network/juniper-junos-general.md

@@ -6,7 +6,7 @@ breadcrumbs:
 ---
 {% include header.md %}
 
-**TODO** Clean up and add remaining stuff.
+**TODO** Clean up, reorganize and add remaining stuff.
 
 ### Related Pages
 {:.no_toc}
@@ -14,24 +14,71 @@ breadcrumbs:
 - [Juniper Hardware](../juniper-hardware/)
 - [Juniper Junos Switches](../juniper-junos-switches/)
 
-### Disclaimer
-{:.no_toc}
-This page is based mainly on the devices/series I own.
-Some content may be specific to those devices and should be moved away from this page.
+## Info
 
-## Usage
+- Based on FreeBSD.
+- Used on all Juniper devices.
+- Juniper's next-generation OS "Junos OS evolved" (not Junos OS) is based on Linux.
+
+## General
+
+### Usage
+
+- Controlling the CLI:
+    - Tab: Auto-complete.
+    - Space: Like tab, generally.
+    - `?`: Prints the allowed keywords.
+    - `|`: Can be used to filter the output.
+- Open CLI in operational mode (from shell): `cli`
+- Open shell (from oper mode):
+    - Local: `start shell`
+    - VC: `request session member <vc-member-id>`
+- Enter configuration mode (from oper mode): `configure`
+- Exit any mode: `exit`
+- Show configuration:
+    - From oper mode: `show configuration [statement]`
+    - From config mode: `show [statement]`
+    - Show changes: `show | compare`
+- Run oper command in config mode: `run <command>`
+- Navigate config mode:
+    - The config is structures as nested container statements and leaf statements.
+    - Change context to container statement: `edit <path>`
+    - Go up in context: `up` or `top`
+    - Show configuration for current level: `show`
+- Commit config changes: `commit [comment <comment>] [confirmed] [and-quit]`
+    - `confirmed` automatically rolls back the commit if it is not confirmed within a time limit.
+    - `and-quit` will quit configuration mode after a successful commit.
+
+### Booting
+
+The devices have two partitions; the primary and the backup.
+One of them will be designated as active and that choice will be remembered across reboots.
+When the active partition is damaged, the device will boot into the other partition.
+When the backup partition is the active partition, an alarm will be set and a banner shown.
+
+Change active partition and reboot: `request system reboot slice alternate media internal`
+
+### Shutting It Down
+
+The devices should be shut down gracefully instead of just pulling the power.
+This will prevent corrupting the file system.
+
+- Shell: `shutdown -h now` or `halt`
+- Op mode: `request system <halt|power-off> [local|all-members|member <member-id>]`
 
-### General
+Wait for the "The operating system has halted." text before pulling the power, so that system processess are stopped and disks are synchronized. The system LED turning off and the LCD saying "HALTING..." does *not* mean that the halting process is finished yet.
 
-Commands are in oper. mode unless otherwise specified.
+### Basics
 
-- Open shell: `start shell` (local) or `request session member <vc-member-id>` (VC)
-- Open CLI from shell: `cli` (shell)
+- Shut down or reboot: `request system <halt|reboot> [local|all-members]`
+    - For `halt`, it will print "please press any key to reboot" when halted.
+- Erase all configuration and data: `request system zeroize`
 - Show alarms: `show chassis alarms`
 - Show temperatures and fan speeds: `show chassis environment`
 - Show routing engine usage: `show chassis routing-engine`
-- Shut down: `request system <halt|power-off>`
-- Erase all configuration and data: `request system zeroize`
+
+### Interfaces
+
 - Show interfaces:
     - Overview: `show interfaces terse`
     - Simple overview: `show interfaces routing`
@@ -41,32 +88,41 @@ Commands are in oper. mode unless otherwise specified.
     - Physical details: `show interfaces media`
 - Show LLDP neighbors: `show lldp neighbors`
 
-### Configuration
+## Tasks
 
-Commands are in conf. mode unless otherwise specified.
+### Mount a USB Drive
 
-- Show configuration: `show configuration [statement]` (oper. mode) or `show [statement]` (conf. mode)
-    - Show changes: `show | compare`
-- Enter normal configuration mode: `configure` (oper. mode)
-- Run oper. command in conf. mode: `run [command]`
+Note: USB3 drives may not work properly. Use USB2 drives.
+
+1. Make sure the drive is formatted as FAT32 (MS-DOS) (or something else supported).
+1. Don't insert it in the Juniper device yet.
+1. Show current storage devices: `ls -l /dev/da*`
+1. Insert the drive. It should print a few lines to the console.
+1. Show current storage devices again and find the new device.
+1. Create a dir to mount it to: `mkdir /var/tmp/usb1`
+1. Mount it: `mount_msdosfs <device> /var/tmp/usb1`
+1. Do stuff with it.
+1. Unmount it: `umount /dev/tmp/usb1`
 
 ### Upgrade Junos Using a USB Drive
 
 1. Format the USB drive using FAT32.
 1. Copy the software file to the drive.
 1. Mount it to `/var/tmp/flash` (see [mount a USB drive](#mount-a-usb-drive)).
-1. Verify that the drive contains the software file: `ls -l /bar/tmp/flash`
+1. Verify that the drive contains the software file: `ls -l /var/tmp/flash`
 1. (Optional) Copy the file to internal storage (`/var/tmp/`) before installing it.
-1. Install: `request system software add <path> no-validate no-copy [partition] [reboot]`
+1. Install (oper mode): `request system software add <file> no-validate no-copy [partition] [reboot]`
     - If installing from internal storage, use the `partition` option.
-    - If not using the `reboot` option, manually reboot afterwards.
+    - If not using the `reboot` option, manually reboot afterwards to start the install.
 1. Wait for the install to finish.
-    - It may produce some minor errors in the process.
-1. Validate it:
-    - `show system storage partitions`
-    - `show system snapshot media internal`
-1. (Optional) Test that it's working.
-1. Overwrite the alternate root partition: See [Copy the Active Root Partition](#copy-the-active-root-partition)
+    - It will reboot first.
+    - It may produce some insignificant errors in the process (commands not found etc.).
+1. Verify that the system is booted from the active partition of the internal media: `show system storage partitions`
+1. Unmount and remove the USB drive.
+1. Copy to the alternate root partition: `request system snapshot slice alternate`
+    - May take several minutes.
+1. Verify that the active and backup partitions have the same Junos version: `show system snapshot media internal`
+    - If this fails, wait a bit and try again. The copy may still be processing.
 
 If the method above did not work, try this instead to completely format and flash the device.
 
@@ -78,14 +134,15 @@ If the method above did not work, try this instead to completely format and flas
 ### Copy the Active Root Partition
 
 This procedure clones the active partition to the alternate partition.
-This is also how you would clone to and boot from a USB device, but with `media external` instead of `media internal` and `slice alternate`.
+This is also how you would clone to and boot from a USB device, but with `media external` instead of both `media internal` and `slice alternate`.
 
 1. Clone the active partition to the alternate partition: `request system snapshot slice alternate`
     - This may not be completely finished when the command returns. If the below commands fail, wait and try again.
 1. Validate it:
     - `show system storage partitions`
     - `show system snapshot media internal`
-1. (Optional) Boot to the alternate partition: `request system reboot slice alternate media internal`
+
+To boot to the alternate partition, use `request system reboot slice alternate media internal`.
 
 ### Fix a Corrupt Root Partition
 
@@ -95,97 +152,7 @@ This can be fixed by cloning the new active partition to the alternate, corrupt
 
 See [Copy the Active Root Partition](#copy-the-active-root-partition) or [[EX] Switch boots from backup root partition after file system corruption occurred on the primary root partition (Juniper)](https://kb.juniper.net/InfoCenter/index?page=content&id=KB23180).
 
-### Mount a USB Drive
-
-Note: USB3 drives may not work properly. Use USB2 drives.
-
-1. Make sure the drive is formatted as FAT32 (MS-DOS) (or something else supported).
-1. Don't insert it in the Juniper device yet.
-1. Show current storage devices: `ls -l /dev/da*`
-1. Insert the drive. It should print a few lines to the console.
-1. Show current storage devices again and find the new device.
-1. Create a dir to mount it to: `mkdir /vat/tmp/usb1`
-1. Mount it: `mount_msdosfs <device> /var/tmp/usb1`
-1. Do stuff with it.
-1. Unmount it: `umount /dev/tmp/usb1`
-
-## Theory
-
-### About
-
-- Based on FreeBSD.
-- Used on all Juniper devices.
-- Juniper's next-generation OS "Junos OS evolved" (not Junos OS) is based on Linux.
-
-### Booting
-
-The devices have two partitions; the primary and the backup.
-One of them will be designated as active and that choice will be remembered across reboots.
-When the active partition is damaged, the device will boot into the other partition.
-When the backup partition is the active partition, an alarm will be set and a banner shown.
-
-Change active partition and reboot: `request system reboot slice alternate media internal`
-
-### Shutting It Down
-
-The devices should be shut down gracefully instead of just pulling the power.
-This will prevent corrupting the file system.
-
-- Shell: `shutdown -h now` or `halt`
-- Op mode: `request system <halt|power-off> [local|all-members|member <member-id>]`
-
-Wait for the "The operating system has halted." text before pulling the power, so that system processess are stopped and disks are synchronized. The system LED turning off and the LCD saying "HALTING..." does *not* mean that the halting process is finished yet.
-
-### The Configuration
-
-- Hierarchical.
-- Statements:
-    - Container statements: Contains statements. Surround child statements in curly braces.
-    - Leaf statements: Terminated with a semicolon.
-
-### CLI Modes
-
-- Shell: A CSH shell. Entered by default when logging in as root.
-- CLI operational mode (op mode).
-- CLI configuration mode (conf mode).
-
-### Using the CLI
-
-(Not the shell.)
-
-- Space: Like tab, generally.
-- Tab: Auto-complete.
-- `?`: Prints the allowed keywords.
-- `|`: Can be used to filter the output.
-- Commit configuration changes: See commit section.
-
-#### Configuration Mode
-
-- Enter configuration mode: `configure`
-- Exit configuration mode: `exit`
-- Statements can be changed by either entering the container statement and changing it locally, or by specifying the full path for the statement.
-- Enter the container statements: `edit <container-statement>`
-    - Changes the local position in the hierarchy.
-    - Multiple levels can be specified separated by space.
-- Go up one level: `up`
-- Go to the top: `top`
-- Run operational command: `run <command>`
-- Show configuration for current level: `show`
-
-### Making Changes
-
-Changes made in configuration mode are added to the candidate configuration and not immediately applied.
-To apply the candidate configuration to the active configuration, commit the changes.
-
-**TODO** which modes?
-
-- Show changes: `show | compare`
-- Commit the changes: `commit [comment <comment>] [confirmed] [and-quit]` (conf mode)
-    - Try to always add a short comment.
-    - `confirmed` automatically rolls back the commit if it is not confirmed within a time limit.
-    - `and-quit` will quit configuration mode after a successful commit.
-
-**TODO** Confirm how?
+## Miscellanea
 
 ### Interface Names
 
@@ -195,7 +162,7 @@ To apply the candidate configuration to the active configuration, commit the cha
 - `et`: 40G Ethernet.
 - `em` and `fxp`: Management, possibly OOB.
 
-### Fusion
+## Fusion
 
 **TODO**
 

+ 33 - 24
config/network/juniper-junos-switches.md

@@ -6,7 +6,7 @@ breadcrumbs:
 ---
 {% include header.md %}
 
-**TODO** Clean up and add remaining stuff.
+**TODO** Clean up, reorganize and add remaining stuff.
 
 ### Related Pages
 {:.no_toc}
@@ -24,22 +24,49 @@ breadcrumbs:
 
 This page is super not done. Just random notes for now.
 
-## Initial Setup
+## Resources
+
+- [Quieter fans for Juniper EX3300 switch (Jade.WTF)](https://jade.wtf/tech-notes/quiet-ex3300/)
 
-Enter configuration mode as necessary in the steps below with `configure` and `exit`.
+## Initial Setup
 
-1. Connect to the switch using serial (RS-232 w/ RJ45, baud 9600, 8 data bits, no parity, 1 stop bits, no flow contro).
+1. Connect to the switch using serial (RS-232 w/ RJ45, baud 9600, 8 data bits, no parity, 1 stop bits, no flow control).
 1. Login with username `root` and no password. You'll enter the shell.
 1. Enter the operation mode: `cli`
-1. Set hostname (conf mode): `set system host-name <hostname>`
+1. Enter configuration mode (implicit hereafter, use `exit` to return to CLI): `configure`
+1. Set hostname: `set system host-name <hostname>` (conf mode)
 
 **TODO**
 1. Setup root authentication.
 1. Disable DHCP auto image upgrade: `delete chassis auto-image-upgrade` (conf mode)
 1. Disable alarm for mgmt. port link down.
+1. Enable auto snapshotting and restoration on corruption: `set system auto-snapshot`
 1. Commit.
 
-## More Random Notes (TODO)
+## Virtual Chassis
+
+Virtual Chassis (VC) is a simple way of connecting multiple close or distant switches into a ring topology and managing them as a single logical device. All devices share a common management IP address. It simplifies loop prevention (otherwise using STP) and improves fault tolerance. A VC has one switch as master routing engine, one switch as backup routing engine and the remaining switches as linecards. The master is elected based on (in order) highest mastership priority, which member was master last time, which switch has been a member the longest, and which member has the lowest MAC address. You typically want to set the mastership priority to 255 for the two switches you want as master and backup routing engines.
+
+- Show status:
+    - Show overview: `show virtual-chassis`
+    - Show VC ports (VCPs): `show virtual-chassis vc-port`
+- Commit on both routing engines (always recommended for committing on VC): `commit synchronize`
+- Enable synchronized commit as default commit: `set system commit synchronize`
+- Remove virtual chassis ports (VCPs): `request virtual-chassis vc-port delete pic-slot <pic-slot> port <port-number>`
+- Set mastership: [Configuring Mastership of a Virtual Chassis (Juniper)](https://www.juniper.net/documentation/en_US/junos/topics/task/configuration/virtual-chassis-ex4200-mastership-cli.html)
+
+### Virtual Chassis Fabric
+
+Virtual Chassis Fabric (VCF) evolves VC into a spine-and-leaf architecture. While VC focuses on simplified management, VCF focuses on improved data center connectivity. Only certain switches (like the QFX5100) support this feature.
+
+## Miscellanea
+
+- Serial:
+    - RS-232 w/ RJ45 (Cisco-like).
+    - Baud 9600 (default).
+    - 8 data bits, no parity, 1 stop bits, no flow control.
+
+## Random Notes (TODO)
 
 - No "unit 0" on LACP slave interfaces.
 - `set virtual-chassis no-split-detection` (VC) (recommended for only 2 members) (The split and merge feature is enabled by default on EX Series and QFX Series Virtual Chassis. You can disable the split and merge feature by using the set virtual-chassis no-split-detection command.) (When disabled, both parts remain active after a split.)
@@ -56,22 +83,4 @@ Enter configuration mode as necessary in the steps below with `configure` and `e
 - Static route: `set routing-options static route 10.0.0.0/24 next-hop 10.0.1.1`
 - `show configuration [...] | display set`
 
-## Hardware
-
-### Serial
-
-- RS-232 w/ RJ45 (Cisco-like).
-- Default baud 9600.
-- 8 data bits, no parity, 1 stop bits, no flow control.
-
-### Modding
-
-- [Quieter fans for Juniper EX3300 switch (Jade.WTF)](https://jade.wtf/tech-notes/quiet-ex3300/)
-
-## Theory
-
-### Virtual Chassis
-
-**TODO**
-
 {% include footer.md %}

+ 29 - 0
config/network/vyos.md

@@ -0,0 +1,29 @@
+---
+title: VyOS
+breadcrumbs:
+- title: Configuration
+- title: Network
+---
+{% include header.md %}
+
+## Installation
+
+See [Installation (VyOS)](https://docs.vyos.io/en/latest/install.html).
+
+1. (Recommended) Disable Intel Hyper-Threading.
+1. Download the latest rolling release (free) or LTS release (paid) ISO.
+1. Burn and boot from it (it's a live image).
+1. Log in using user `vyos` and password `vyos`.
+1. Run `install image` to run the permanent installation wizard.
+    - Copy the `config.boot.default` config file.
+1. Remove the live image and reboot.
+
+## Configuration
+
+### Basic Usage
+
+- The system is in "operational mode" after logging in. Enter "configuration mode" using the `configure` command.
+- Use `?` to show alternatives and tab to auto-complete.
+- Use `commit` to apply configuration changes and `save` to make them permanent.
+
+{% include footer.md %}