How to use Enterprise SONiC on CML
Tags: homelab, cisco, cml, sonic
Published: 2023-12-31 14:37:31

# Summary
In CML (Cisco Modeling Labs), the available platforms can be defined and used by yourself in addition to the standard ones.

This procedure is shown in the user guide.
https://developer.cisco.com/docs/modeling-labs/#!custom-vm-images


On [SONiC](https://sonic-net.github.io/SONiC/), commercial distribution (Enterprise SONiC) is supplied from each vendor.

Enterprise SONiC Distribution by Edgecore
https://support.edge-core.com/hc/en-us/categories/360002134713-Enterprise-SONiC-Distribution-by-Edgecore

Enterprise SONiC Distribution by Dell Technologies
https://infohub.delltechnologies.com/p/enterprise-sonic-distribution-by-dell-technologies/

Enterprise SONiC has published images that can be used in virtualized environments, depending on the company that provides them.

This time, I tried to set up using SONiC image for virtual machines in CML 2.2.3 environment (installed on [the previously built ESXi host](https://dev.to/rhira777/getting-128gb-esxi-host-for-my-home-lab-year-2022-948)), and was able to start using it.
The following is a record of that.

# Detail of what I did
### Get SONiC image
- In this case, obtain from the following
	- https://www.dell.com/support/home/en-us/product-support/product/enterprise-sonic-distribution/drivers
	- Download gns3 file
		- Select Enterprise SONiC OS 4.2.0 gns3 this time
		- "Enterprise_SONiC_OS_4.2.0_gns3.zip"
		- Use "Enterprise_SONiC_OS_4.2.0.img" in the zip file

---

### Define node
- Select "Node and Image Definition" from "TOOLS"
- Confirm that the "Node Definition" tab is selected and click the "ADD" button.
- Select/enter the following information in the "General" field
	- ID: "dellsonic"
	- Nature: "switch"
- Select/enter the following information in the "User Interface" field
	- Prefix: "dellsonic-"
	- Icon: "switch"
	- Label: "Enterprise SONiC"

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nx38bktupzaoywc7b1jq.JPG)

---

- Select/enter the following information in the "Linux Native Simulation" field
	- Domain Driver: "KVM"
	- Simulation Driver: "server"
	- Disk Driver: "VirtIO"
	- Memory: "4096" in this case
	- CPUs: "2" in this case
	- CPU Limit: "100"
	- Network Driver: "E1000"

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w2bv9tbqvctqmg8xfjg7.JPG)
---

- Select/enter the following information in the "Interfaces" field
	- Loopback name: "Loopback0"
	- Number of serial ports: "1"
	- Default number of physical interfaces: "10" in this case
	- interface 0："eth0"

- In the same field, press the "ADD INTERFACE" button until the number specified in the "Default number of physical interfaces" is displayed, and enter the following information
	- interface 1: "Eth1/1"
	- interface 2: "Eth1/2"
	- interface 3: "Eth1/3"
	- interface 4: "Eth1/4"
	- interface 5: "Eth1/5"
	- interface 6: "Eth1/6"
	- interface 7: "Eth1/7"
	- interface 8: "Eth1/8"
	- interface 8: "Eth1/9"

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gygrwvzm49kbjncmgm9o.JPG)

---

- Enter the following information in the "Boot" field
	- Timeout: "480" in this case

- In the same field, click the "ADD BOOT LINE button" and enter the following information
	- "sonic login"

- Click the CREATE button

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4c8w7whvgg6lblu9ngzc.JPG)


### Define image

- Select "Node and Image Definition" from "TOOLS"
- Select the "Image Definition" tab
- Click the "MANAGE" button
- Select "Choose a file" in the "Upload New Image File" field and specify the downloaded SONiC image
- Click the "UPLOAD IMAGE" button

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5vofwxjk7k7p8xqcoebu.JPG)

---

- After confirming the display of the file specified in the "Uploaded Images" field(reloading the page may be required), press the "CREATE NEW IMAGE DEFINITION" button.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hegtjkjg6e61j0a82st0.JPG)

---

- Select/enter the following information in the "General" field
	- ID: "dellsonic-420"
	- Label: "Enterprise SONiC 4.2.0"
	- Disk Image: The uploaded SONiC image
	- Node Definition: The defined node

- Press "CREATE IMAGE DEFINITION" button

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p5qemeu9tlnoegxcy38g.JPG)

---

### Confirmation of operation
I created a lab using the registered node and it was successfully started.
It was also confirmed that communication with neighboring nodes was possible.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gkyxyczyt25pz2idaaan.JPG)

# Supplemental information and others
The default username/password is admin/YourPaSsWoRd.
- Dell Networking SONiC: Secure Shell based login
https://www.dell.com/support/kbdoc/en-us/000218783/dell-networking-sonic-ssh-based-login

### startup log
```
  Booting `SONiC-OS-4.2.0-Enterprise_Base'


Loading SONiC-OS OS kernel ...

Loading SONiC-OS OS initial ramdisk ...

[   34.656910] in-memory.sh[344]: + [[ -e /dev/pmem0 ]]
[   34.673136] in-memory.sh[344]: ++ uname -r
[   34.738057] in-memory.sh[344]: + insmod /lib/modules/5.10.0-21-amd64/kernel/drivers/block/ramdisk.ko rd_address=0x40000000 rd_size=0x4000000
[   35.233113] in-memory.sh[344]: + '[' -e /dev/ramdisk ']'
[   35.248529] in-memory.sh[344]: + [[ ! -e /proc/vmcore ]]
[   35.264929] in-memory.sh[344]: + mkfs.ext4 /dev/ramdisk
[   35.782623] in-memory.sh[344]: mke2fs 1.44.5 (15-Dec-2018)
[   35.832664] in-memory.sh[344]: Creating filesystem with 65536 1k blocks and 16384 inodes
[   35.863029] in-memory.sh[344]: Filesystem UUID: 6843eecc-8058-4005-b57d-dab7f113505f
[   35.885951] in-memory.sh[344]: Superblock backups stored on blocks:
[   35.911651] in-memory.sh[344]:       8193, 24577, 40961, 57345
[   35.932443] in-memory.sh[344]: Allocating group tables: done
[   35.955397] in-memory.sh[344]: Writing inode tables: done
[   35.983239] in-memory.sh[344]: Creating journal (4096 blocks): done
[   36.009111] in-memory.sh[344]: Writing superblocks and filesystem accounting information: done
[   36.034260] in-memory.sh[344]: + e2fsck -fy /dev/ramdisk
[   36.215813] kdump-tools[343]: Starting kdump-tools: Creating symlink /var/lib/kdump/vmlinuz.
[   36.262157] kdump-tools[343]: Creating symlink /var/lib/kdump/initrd.img.
[   36.398311] in-memory.sh[344]: e2fsck 1.44.5 (15-Dec-2018)
[   36.446069] in-memory.sh[344]: Pass 1: Checking inodes, blocks, and sizes
[   36.514393] in-memory.sh[344]: Pass 2: Checking directory structure
[   36.571572] in-memory.sh[344]: Pass 3: Checking directory connectivity
[   36.590362] in-memory.sh[344]: Pass 4: Checking reference counts
[   36.610644] in-memory.sh[344]: Pass 5: Checking group summary information
[   36.636916] in-memory.sh[344]: /dev/ramdisk: 11/16384 files (0.0% non-contiguous), 7465/65536 blocks
[   36.729179] in-memory.sh[344]: + tune2fs -O '^metadata_csum' /dev/ramdisk
[   36.748593] in-memory.sh[344]: tune2fs 1.44.5 (15-Dec-2018)
[   36.767494] in-memory.sh[344]: + mount /dev/ramdisk /var/log/ramfs
[   36.792774] in-memory.sh[344]: ++ mountpoint -q /var/log/ramfs
[   36.814500] in-memory.sh[344]: + chmod 655 /var/log/ramfs
[   36.832928] in-memory.sh[344]: + set +x
[   38.196615] rc.local[578]: + cat /proc/cmdline
[   38.224026] rc.local[578]: + xargs -n1
[   38.238218] rc.local[578]: + grep loop=
[   38.264957] rc.local[578]: + cut -d= -f 2-
[   38.660962] rc.local[578]: + dirname image-4.2.0-Enterprise_Base/fs.squashfs
[   38.688844] rc.local[578]: + LOOP_IMAGE_DIR=image-4.2.0-Enterprise_Base
[   38.726252] rc.local[578]: + echo image-4.2.0-Enterprise_Base
[   38.758279] rc.local[578]: + cut -d- -f 2-
[   38.774483] rc.local[578]: + loop_version=4.2.0-Enterprise_Base
[   38.815105] rc.local[578]: + grep build_version
[   38.834005] rc.local[578]: + sed -e s/build_version: //g;s/'//g
[   38.905527] rc.local[578]: + cat /etc/sonic/sonic_version.yml
[   39.016109] rc.local[578]: + SONIC_VERSION=4.2.0-Enterprise_Base
[   39.146697] rc.local[578]: + [ 4.2.0-Enterprise_Base !=  ]
[   39.169304] rc.local[578]: + [ 4.2.0-Enterprise_Base != 4.2.0-Enterprise_Base ]
[   39.190152] rc.local[578]: + FIRST_BOOT_FILE=/host/image-4.2.0-Enterprise_Base/platform/firsttime
[   39.214308] rc.local[578]: + SONIC_FIRST_BOOT_SCRIPT=/host/image-4.2.0-Enterprise_Base/first_boot.sh
[   39.279311] rc.local[578]: + SONIC_BRANDING_OVERRIDE=/host/image-4.2.0-Enterprise_Base/sonic_branding.yml
[   39.314123] rc.local[578]: + SONIC_BRANDING_FILE=/etc/sonic/sonic_branding.yml
[   39.367061] rc.local[578]: + RUNTIME_JOURNALD_CONF=/etc/systemd/journald.conf.d/01-journald-storage.conf
[   39.448329] rc.local[578]: + RSYSLOG_FILE=/etc/logrotate.d/rsyslog
[   39.487485] rc.local[578]: + IMEM_INFO_FILE=/etc/logrotate.d/in-memory/00-in-memory-info
[   39.510376] rc.local[578]: + IMEM_DEBUG_FILE=/etc/logrotate.d/in-memory/00-in-memory-debug
[   39.539099] rc.local[578]: + IMEM_DISK_INFO_FILE=/etc/logrotate.d/in-memory/01-disk-info
[   39.561205] rc.local[578]: + IMEM_DISK_DEBUG_FILE=/etc/logrotate.d/in-memory/01-disk-debug
[   39.588452] rc.local[578]: + IMEM_CONF_FILE=/etc/rsyslog.d/in-memory/00-in-memory.conf
[   39.608050] rc.local[578]: + APPLOG_CONF_FILE=/etc/rsyslog.d/20-sonic.conf
[   39.628947] rc.local[578]: + HISTOGRAM_FILE=/etc/logrotate.d/histogram/mem-histogram-rule
[   39.657673] rc.local[578]: + LOGCLEANUP_FILE=/usr/bin/log-cleanup.sh
[   39.699884] rc.local[578]: + SONIC_CONFIG_DIR=/host/image-4.2.0-Enterprise_Base/sonic-config
[   39.745542] rc.local[578]: + SONIC_ENV_FILE=/host/image-4.2.0-Enterprise_Base/sonic-config/sonic-environment
[   39.799352] rc.local[578]: + [ -d /host/image-4.2.0-Enterprise_Base/sonic-config -a -f /host/image-4.2.0-Enterprise_Base/sonic-config/sonic-environment ]
[   39.896294] rc.local[578]: + logger SONiC version 4.2.0-Enterprise_Base starting up...
[   39.946870] rc.local[578]: + mount -t bpf none /sys/fs/bpf/
[   39.963135] rc.local[578]: + set +x
[   39.975345] rc.local[578]: + grub_installation_needed=
[   39.990196] rc.local[578]: + [ ! -e /host/machine.conf ]
[   40.010572] rc.local[578]: + migrate_nos_configuration
[   40.028620] rc.local[578]: + rm -rf /host/migration
[   40.046210] rc.local[578]: + mkdir -p /host/migration
[   40.078869] rc.local[578]: + cat /proc/cmdline
[   40.091773] rc.local[578]: + set -- BOOT_IMAGE=/image-4.2.0-Enterprise_Base/boot/vmlinuz-5.10.0-21-amd64 root=UUID=b13fefc3-4898-498e-bf1f-180508201499 rw console=tty0 console=ttyS0,115200n8 quiet net.ifnames=0 biosdevname=0 loop=image-4.2.0-Enterprise_Base/fs.squashfs loopfstype=squashfs crashkernel=0M-2G:256M,2G-4G:256M,4G-8G:384M,8G-:448M apparmor=1 security=apparmor varlog_size=4096 usbcore.autosuspend=-1 cgroup_enable=memory swapaccount=1 cma=0 memmap=64M$1G softlockup_all_cpu_backtrace=1
[   40.278371] rc.local[578]: + [ -n  ]
[   40.347631] rc.local[578]: + . /host/machine.conf
[   40.470225] rc.local[578]: + onie_arch=x86_64
[   40.482312] rc.local[578]: + onie_bin=
[   40.496259] rc.local[578]: + onie_boot_fs_type=ext4
[   40.510051] rc.local[578]: + onie_boot_gfdisk_type=0x3000
[   40.541161] rc.local[578]: + onie_boot_gpt_uuid=7412F7D5-A156-4B13-81DC-867174929325
[   40.610572] rc.local[578]: + onie_boot_label=ONIE-BOOT
[   40.680146] rc.local[578]: + onie_boot_mnt=/mnt/onie-boot
[   40.698145] rc.local[578]: + onie_boot_reason=install
[   40.756545] rc.local[578]: + onie_build_date=2018-11-17T04:18+00:00
[   40.814912] rc.local[578]: + onie_build_machine=kvm_x86_64
[   40.936072] rc.local[578]: + onie_build_platform=x86_64-kvm_x86_64-r0
[   40.958906] rc.local[578]: + onie_config_dir=/mnt/onie-boot/onie/config
[   40.986345] rc.local[578]: + onie_config_version=1
[   41.012968] rc.local[578]: + onie_default_filename=onie-installer-x86_64-kvm_x86_64-r0
[   41.054993] rc.local[578]: + onie_default_filenames=onie-installer-x86_64-kvm_x86_64-r0
[   41.084595] rc.local[578]: + onie_dev=/dev/vda2
[   41.100605] rc.local[578]: + onie_disco_boot_reason=install
[   41.131212] rc.local[578]: + onie_disco_dns=10.0.2.3
[   41.154133] rc.local[578]: + onie_disco_interface=eth0
[   41.187801] rc.local[578]: + onie_disco_ip=10.0.2.15
[   41.250023] rc.local[578]: + onie_disco_lease=86400
[   41.333788] rc.local[578]: + onie_disco_mask=24
[   41.377991] rc.local[578]: + onie_disco_opt53=05
[   41.419109] rc.local[578]: + onie_disco_router=10.0.2.2
[   41.446504] rc.local[578]: + onie_disco_serverid=10.0.2.2
[   41.492428] rc.local[578]: + onie_disco_siaddr=10.0.2.2
[   41.649018] rc.local[578]: + onie_disco_subnet=255.255.255.0
[   41.715032] rc.local[578]: + onie_exec_url=file://dev/vdb/onie-installer.bin
[   41.758713] rc.local[578]: + onie_firmware=auto
[   41.900357] rc.local[578]: + onie_grub_image_name=shimx64.efi
[   41.933383] rc.local[578]: + onie_iana_enterprise=42623
[   41.983371] rc.local[578]: + onie_image_suffixes=.bin
[   42.006215] rc.local[578]: + onie_image_type_nos=nos
[   42.023183] rc.local[578]: + onie_image_type_update=update
[   42.098738] rc.local[578]: + onie_initrd_tmp=/
[   42.203583] rc.local[578]: + onie_installer=/var/tmp/installer
[   42.232167] rc.local[578]: + onie_kernel_version=4.9.95
[   42.249325] rc.local[578]: + onie_local_parts=
[   42.264658] rc.local[578]: + onie_machine=kvm_x86_64
[   42.326350] rc.local[578]: + onie_machine_rev=0
[   42.413097] rc.local[578]: + onie_neighs=[fe80::2-eth0],
[   42.432558] rc.local[578]: + onie_operation=os-install
[   42.448676] rc.local[578]: + onie_partition_type=gpt
[   42.462873] rc.local[578]: + onie_platform=x86_64-kvm_x86_64-r0
[   42.513297] rc.local[578]: + onie_root_dir=/mnt/onie-boot/onie
[   42.634832] rc.local[578]: + onie_secure_boot=yes
[   42.715092] rc.local[578]: + onie_server_name=onie-server
[   42.744945] rc.local[578]: + onie_skip_ethmgmt_macs=yes
[   42.763887] rc.local[578]: + onie_switch_asic=qemu
[   42.781268] rc.local[578]: + onie_uefi_arch=x64
[   42.818990] rc.local[578]: + onie_uefi_boot_loader=shimx64.efi
[   42.918507] rc.local[578]: + onie_update_attempts_dir=/mnt/onie-boot/onie/update/attempts
[   42.996999] rc.local[578]: + onie_update_dir=/mnt/onie-boot/onie/update
[   43.016292] rc.local[578]: + onie_update_log=/mnt/onie-boot/onie/update/update.log
[   43.094914] rc.local[578]: + onie_update_pending_dir=/mnt/onie-boot/onie/update/pending
[   43.129414] rc.local[578]: + onie_update_results_dir=/mnt/onie-boot/onie/update/results
[   43.203477] rc.local[578]: + onie_updater_cookie=ONIE-UPDATER-COOKIE
[   43.230578] rc.local[578]: + onie_vendor_id=42623
[   43.246749] rc.local[578]: + onie_version=master-201811170418
[   43.267024] rc.local[578]: + program_console_speed
[   43.283649] kdump-tools[343]: loaded kdump kernel.
[   43.300353] rc.local[578]: + cat /proc/cmdline
[   43.325960] rc.local[578]: + grep -Eo console=ttyS[0-9]+,[0-9]+
[   43.347377] rc.local[578]: + cut -d , -f2
[   43.364099] rc.local[578]: + speed=115200
[   43.376920] rc.local[578]: + [ -z 115200 ]
[   43.404188] rc.local[578]: + CONSOLE_SPEED=115200
[   43.425112] rc.local[578]: + sed -i s|\-\-keep\-baud .* %I| 115200 %I|g /lib/systemd/system/serial-getty@.service
[   43.456972] rc.local[578]: + systemctl daemon-reload
[   43.472915] rc.local[578]: + [ -f /host/image-4.2.0-Enterprise_Base/platform/firsttime ]
[   43.498849] rc.local[578]: + [ -f /var/log/fsck.log.gz ]
[   43.516777] rc.local[578]: + gunzip -d -c /var/log/fsck.log.gz
[   43.535652] rc.local[578]: + logger -t FSCK
[   43.550609] rc.local[578]: + rm -f /var/log/fsck.log.gz
[   43.573821] rc.local[578]: + [ -n x86_64-kvm_x86_64-r0 ]
[   43.619912] rc.local[578]: + mkdir -p /mnt/onie-boot
[   43.637075] rc.local[578]: + mount LABEL=ONIE-BOOT /mnt/onie-boot
[   43.661882] rc.local[578]: + [ -f /mnt/onie-boot/onie/update/update.log ]
[   43.689742] rc.local[578]: + /usr/bin/python3 /usr/local/bin/fwpkg_tables_init.py
[   43.713299] rc.local[578]: + cp /mnt/onie-boot/onie/update/update.log /var/log/onie-update.log
[   43.739411] rc.local[578]: + set +x
[   43.753270] rc.local[578]: + /usr/bin/python3 /usr/local/bin/image_tables_init.py
[   43.802658] rc.local[578]: + exit 0


Debian GNU/Linux 10 sonic ttyS0

sonic login:
```