SONiC 実践ハンズオンセミナー 講演レポートPart2 ~ホワイトボックススイッチで学ぶ、オープンネットワーク OS の基本操作~
はじめに
本記事は、2025年8月26日に開催された SONiC 実践ハンズオンセミナーで講演した内容です。
SONiC の基本アーキテクチャーからコマンド体系まで、初心者の方でもわかりやすくご紹介しています。
プレゼンテーション資料をご希望の方は、下記よりダウンロード可能ですのでぜひご参照ください。
Part1では、SONiCのアーキテクチャーやバージョンの違い、ユースケース、インストール方法までを体系的にご紹介しました。
Part2となる本記事では、いよいよSONiCの操作に欠かせない「CLI(Command Line Interface)」のコマンド体系に焦点を当てて解説していきます。
SONiCコマンド体系
SONiCでは、2種類のCLI体系が用意されており、目的や運用スタイルに応じて使い分けることが可能です。
1. 標準(Linuxベース)CLI
Linuxの操作に慣れた技術者にとって馴染み深い形式で、直接コマンドを叩いて設定を行います。
たとえば、マネジメントポートの設定は以下のように実施します。
admin@sonic:~$ sudo config interface ip add eth0 10.1.1.10/24 10.1.1.1
admin@sonic:~$ config save
※FRRによるルーティング設定を行う場合は、VTYSHコマンドによる別CLI体系での操作が必要です。
2. スイッチ業界標準(Ciscoライク)CLI
Cisco IOSに近い構文で操作できるCLI体系で、ネットワークエンジニアにとって親しみやすい形式です。
以下は同じマネジメントポート設定の例です。
admin@sonic:~$ sonic-cli
sonic# config terminal
sonic(config)# interface Management 0
sonic(conf-if-Management0)# ip address 10.1.1.10/24 gwaddr 10.1.1.1
sonic(conf-if-Management0)# no shutdown
sonic(conf-if-Management0)# exit
sonic(config)# exit
sonic# write memory
このように、SONiCでは運用者のスキルセットや環境に応じて柔軟にCLI体系を選択できます。
今回のハンズオンでは、弊社新横浜オフィスのラボに設置されているEdgecore社製の800Gスイッチ「AIS800-64D」にVPNでリモートアクセスを実施しました。
VPN設定については本記事では割愛させていただきます。
以下に、スイッチ業界標準(Ciscoライク)CLIコマンドの例をご紹介します。
Showコマンドのあとに入力できるコマンドを、このように確認することができます。これらを使用して情報を確認することができます。
admin@sonic:~$ sonic-cli
sonic# show タブキー補完
aaa access-group alarm ars audit-log auditd-system
bfd bgp buffer buffer-pool cable-diagnostics class-map
clock config config-key config-reload consistency-check copp
core crm crypto database dcbx device
dropcounters errdisable error-database event evpn hardware
histogram hosts image in-memory-logging interface interface-naming
ip ipv6 kdump ldap-server link lldp
locator-led logging mac mclag mirror-session nat
neighbor-suppress-status ntp object-groups pbf platform poe
policy-map port-group port-security PortChannel priority-flow-control priority-group
ptp qos queue radius-server reboot-cause route-map
running-configuration service-policy sflow snmp snmp-server spanning-tree
ssh-server storm-control subinterfaces switch-profiles switch-resource switching-mode
swsslog-configuration system tacacs-server tam tech-support techsupport-export
threshold tpcm udld uptime usb users
version Vlan vrrp vrrp6 vxlan warm-restart
watermark ztp-status
admin@sonic:~$ sonic-cli
sonic# show version
sonic# show interface status
sonic# show interface counters
sonic# show platform environment
sonic# show vlan
sonic# show running-configuration
sonic# show users
sonic# show uptime
次に、SONiC 標準(Linuxベース)CLIコマンドの例です。
同じくShowコマンドを使って情報を確認することができます。
sonic# exit
admin@sonic:~$ show -h
Usage: show [OPTIONS] COMMAND [ARGS]...
SONiC command line - 'show' command
Options:
-?, -h, --help Show this message and exit.
Commands:
aaa Show AAA configuration
acl Show ACL related information
arp Show IP ARP table
bgp Show BGP information
boot Show boot configuration
buffer Show buffer information
buffer_pool Show details of the buffer pools
chassis-modules Show chassis-modules information
classifier Show flow based services classifiers related...
clock Show date and time
config Show details about configuration profiles available
copp Show COPP
cores Show core dump events encountered
database Show Redis database information
debug Collect debugging information from components
dropcounters Show drop counter related information
ecn Show ECN configuration
environment Show environmentals (voltages, fans, temps)
errdisable Errdisable information
error_database Show ERROR DB entries
export show tech-support export configurations
feature Show feature status
fgnhg Show FGNHG information
hardware Show ASIC related information
headroom-pool Show details of headroom pool
histogram
hostname Show hostname
hosts Show nameserver configuration
in-memory-logging Show in-memory system log
interfaces Show details of the network interfaces
ip Show IP (IPv4) commands
ipv6 Show IPv6 commands
kdump Show kdump configuration, status and information
knet Show knet info
kubernetes
ldap Show LDAP configuration
line Show all console lines and their info include...
linktrack Show link state tracking information
lldp LLDP (Link Layer Discovery Protocol) information
locator-led Show Locator LED State
logging Show system log
mac Show MAC (FDB) entries
management Show management interface-related information
management-interface Show management interface parameters
management_interface Show management interface parameters
mgmt-vrf Show management VRF attributes
mirror-session Show existing everflow sessions
Showコマンド詳細をさらに見たい方は、下記資料をご参照ください。
※参考資料はこちら
GNS3 SONiC VMアクセス
GNS3(Graphical Network Simulator 3)とは、ネットワーク機器の仮想化・エミュレーションを行うためのツールです。
仮想ルーター・スイッチを使ってネットワーク構成を試すことができます。
今回は、GNS3上でSONiCの仮想マシン(VM)にアクセスして操作を行いました。
下記の図は、GNS3上で構築された、仮想ネットワーク機器同士の接続構成図(ネットワークトポロジー)です。
SONiCを搭載したスイッチと、それらに接続するサーバーやPC端末を仮想マシンとして複数台用意し、スイッチ・端末それぞれの設定や疎通確認のコマンドを実行してみました。
また、今回の仮想環境は下記のように構成されています。
ここからは、より詳細なSONiC CLIコマンドをご紹介します。
まずは基本設定です。
設定確認と保存
admin@sonic:~$ show runningconfiguration all
{
"ACL_RULE": {
"ipacl|RULE_1": {
"PACKET_ACTION": "DROP",
"PRIORITY": "65535",
"VLAN": "10"
(中略)
admin@sonic:~$ sudo config save -y
Running command: /usr/local/bin/sonic-cfggen -d --print-data > /run/tmpmkko4w73
Running command: mv -f /run/tmpmkko4w73 /etc/sonic/config_db.json
Running command: sync;sync;sync
39463 Bytes written
admin@sonic:~$
ホスト名変更
admin@sonic:~$ sonic-cli
sonic# configure terminal
sonic(config)# hostname sonic09
sonic(config)#
Broadcast message: Hostname has been changed from 'sonic' to 'sonic09'. Users r
unning 'sonic-cli' are suggested to restart your session.
sonic(config)# exit
sonic# write memory
sonic# exit
adminパスワード変更
admin@sonic:~$ sudo passwd admin
New password:
Retype new password:
passwd: password updated successfully
ポート速度(グループ単位)変更
admin@sonic:~$ sonic-cli
sonic# show port-group
-------------------------------------------------------------------------------------
Port-group Interface range Valid speeds Default Speed Current Speed
-------------------------------------------------------------------------------------
1 Ethernet0 - Ethernet3 10G, 25G 25G 25G
2 Ethernet4 - Ethernet7 10G, 25G 25G 25G
3 Ethernet8 - Ethernet11 10G, 25G 25G 25G
sonic09# configure
sonic09(config)# port-group 3 speed 10000
sonic09(config)# exit
sonic09# show port-group
-------------------------------------------------------------------------------------
Port-group Interface range Valid speeds Default Speed Current Speed
-------------------------------------------------------------------------------------
1 Ethernet0 - Ethernet3 10G, 25G 25G 25G
2 Ethernet4 - Ethernet7 10G, 25G 25G 25G
3 Ethernet8 - Ethernet11 10G, 25G 25G 10G
ポート有効化
sonic01# show interface status
--------------------------------------------------------------------------------------------------------------------------------------
Name Description Oper Reason AutoNeg Speed MTU Alternate Name
--------------------------------------------------------------------------------------------------------------------------------------
Ethernet0 - up oper-up off 25000 9100 Eth1/1
Ethernet1 - down admin-down off 25000 9100 Eth1/2
sonic01# configure
sonic01(config)# interface Ethernet 1
sonic01(config-if-Ethernet1)# no shutdown
sonic01(config-if-Ethernet1)# exit
sonic01(config)# exit
sonic01# show interface status
--------------------------------------------------------------------------------------------------------------------------------------
Name Description Oper Reason AutoNeg Speed MTU Alternate Name
--------------------------------------------------------------------------------------------------------------------------------------
Ethernet0 - up oper-up off 25000 9100 Eth1/1
Ethernet1 - up oper-up off 25000 9100 Eth1/2
Ethernet2 - down admin-down off 25000 9100 Eth1/3
Ping疎通確認
linux01:~# ip addr
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 0c:bc:d4:d9:00:00 brd ff:ff:ff:ff:ff:ff
inet6 fe80::ebc:d4ff:fed9:0/64 scope link
valid_lft forever preferred_lft forever
3: eth0.10@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
link/ether 0c:bc:d4:d9:00:00 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.1/24 scope global eth0.10
valid_lft forever preferred_lft forever
inet6 fe80::ebc:d4ff:fed9:0/64 scope link
valid_lft forever preferred_lft forever
linux01:~# ping 192.168.1.2
PING 192.168.1.2 (192.168.1.2): 56 data bytes
64 bytes from 192.168.1.2: seq=0 ttl=64 time=12.270 ms
64 bytes from 192.168.1.2: seq=1 ttl=64 time=8.806 ms
64 bytes from 192.168.1.2: seq=2 ttl=64 time=8.556 ms
VLAN設定、LACP設定、ACL設定などのユースケース設定コマンドを見たい方は、下記資料をご参照ください。
※参考資料はこちら
まとめ
本記事では、SONiCの2種類のCLI体系を中心に、基本的な設定操作からGNS3を活用した仮想環境での実践までをご紹介しました。
ぜひプレゼンテーション資料も併せてご活用いただき、SONiCの運用スキルをさらに高めていただけますと幸いです。
関連する情報
資料一覧はこちら
マクニカが取り扱う製品のご紹介のほか、
BGPクロスネットワーク自動構築ファイルやネットワーク運用試験評価レポートなど、オープンネットワーキングに関する資料を掲載しております。
詳細はこちら
製品ページTopへ
IP Infusion
オープンネットワーキングプロバイダのマーケットリーダーとして、キャリア、サービスプロバイダ、データセンターなど600社以上のお客様に信頼性の高いネットワークソリューションを提供しています。
※ダウンロードはこちら
お問い合わせ・資料請求
株式会社マクニカ Edgecore Networks 担当
- TEL:045-470-9831
- E-mail:projectmonstar@macnica.co.jp
平日 9:00~17:00




