Install dependencies
pip
apt install python3 python3-venv python3-pip nodejs redis-server pkg-config libcairo2-dev
Create a new Python venv
for the application (this is not part of the official installation directions, but is best practice)
python3 -m venv /opt/hyperglass && \
cd /opt/hyperglass/
Clone the project to the new venv
and activate the venv
git clone https://github.com/thatmattlove/hyperglass --depth=1 /opt/hyperglass/hyperglass && \
source /opt/hyperglass/bin/activate
Use npm
to install additional dependencies
npm install -g pnpm@latest-10
Install using pip
cd /opt/hyperglass/hyperglass && \
pip install -e .
Link the Hyperglass executable to the system's binary PATH
ln -s /opt/hyperglass/bin/hyperglass /usr/bin/hyperglass
I'm going to paste my configs - modify them as you see fit.
Hyperglass should now be a valid command on your system
hyperglass --help
Run the setup
hyperglass setup
Create a Hyperglass config
bash -c "cat > /etc/hyperglass/hyperglass.yaml"<<'EOF'
debug: false
developer_mode: false
org_name: AS1234
site_title: hyperglass
site_description: "{org_name} Network Looking Glass"
site_keywords: [hyperglass, looking glass, routing, bgp]
request_timeout: 30
listen_address: "0.0.0.0"
listen_port: 8001
cors_origins: [lg.example.com, 1.2.3.4]
EOF
Create the devices config. This is the sample from the official docs - modify as required
bash -c "cat > /etc/hyperglass/devices.yaml"<<'EOF'
devices:
- name: New York, NY
address: 192.0.2.1
platform: cisco_ios
credential:
username: you
password: your password
- name: San Francisco, CA
address: 192.0.2.2
platform: juniper
credential:
username: you
password: your password
EOF
Create an env
file for Hyperglass. This can be used to set environment variables for additional configuration
touch /etc/hyperglass/hyperglass.env
Create a new service file
bash -c "cat > /etc/systemd/system/hyperglass.service"<<'EOF'
[Unit]
Description=hyperglass
After=network.target
Requires=redis-server
[Service]
User=root
Group=root
EnvironmentFile=/etc/hyperglass/hyperglass.env
ExecStart=/usr/bin/hyperglass start
[Install]
WantedBy=multi-user.target
EOF
Enable the service
systemctl daemon-reload && \
systemctl enable --now hyperglass.service && \
systemctl status hyperglass.service
I didn't use the recommended config:
server {
listen 443 http2 ssl;
server_name lookingglass.example.com;
ssl_certificate /etc/ssl/example.com/mynextlight_net.pem;
ssl_certificate_key /etc/ssl/example.com/mynextlight_net.key;
location / {
proxy_pass http://lookingglass.int.example.com:8001;
proxy_set_header HOST $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-Host lookingglass.example.com;
}
}