labby icon indicating copy to clipboard operation
labby copied to clipboard

Is it possible to build a network with ubuntu end hosts with static IPs

Open srj31 opened this issue 2 years ago • 1 comments

Description

I am attempting to create a network topology similar to the screenshot but includes more hosts and routers. The main issue I am currently facing is the bootstrap phase where the error includes a missing config template for ubuntu_desktop net_os and the switch having None for net_os.

Will including a proper jinja2 config file for other operating systems allow for configuring the interfaces via labby rather than manually configuring individual hosts?

Screenshots

The simpler network topology built via labby Screenshot 2022-12-15 at 11 57 02 PM


labby get project detail Screenshot 2022-12-16 at 12 01 51 AM

srj31 avatar Dec 15 '22 18:12 srj31

How are you building the topology initially? is it via the labby build topology command?

If is like that, there is an option via the labby_project.yml file that lets you use external jinja2 templates.

For example: Screenshot 2023-01-07 at 12 08 15

The labby_project.yml there is a template attribute under main section in the YAML:

---
main:
  name: topology-02
  description: Network Lab for Observability demos
  contributors: ["David Flores <@davidban77>"]
  version: "0.0.7"
  labels: ["telemetry", "observability"]
  template: "./templates/main.j2"
  mgmt_network:
    network: 192.168.2.0/24
    gateway: 192.168.2.1/24
    # Optional to further specify the management IP range
    ip_range: [192.168.2.16, 192.168.2.63]

For bootstrap configuration you can specify the bootstrap.j2 and use conditionals in that file to point to the correct net_os like Ubuntu. This is a bit of that bootstrap.j2:

{% if platform == "ios" %}
hostname {{ name }}
! Archiving section
archive
log config
...
{% elif platform == "eos" %}
configure terminal
hostname {{ name }}
...

The logic in the labby build command should use these templates to render your configuration.

Also, for the devices you DON'T want to have labby to manage it, you can specify config_managed to False. For example in the labby_project.yml

nodes_spec:
  - template: "Cisco IOS CSR1kv 17.3.1a"
    nodes: ["lab-r1"]
    net_os: "cisco_ios"
    mgmt_port: "Gi1"
    labels: ["edge", "dub"]

  - template: "Ethernet switch"
    nodes: ["lab-mgmt-switch-01", "lab-mgmt-switch-02"]
    net_os: "builtin"
    config_managed: false
    labels: ["mgmt"]

davidban77 avatar Jan 07 '23 12:01 davidban77