ESXi Network CLI Komutları

ESXi host üzerinde her şeyi CLI komut satırı üzerinden yapabiliriz. Bu yazıda, ESXi için bazı önemli CLI komutlarını göstermeye çalışacağım.

esxcli network ip komutu ile interface, route ve dns server gibi pek çok şeyi görebilir ve düzenleyebilirsiniz.

[root@esxi01:~] esxcli network ip
Usage: esxcli network ip {cmd} [cmd options]

Available Namespaces:
  dns                   Operations pertaining to Domain Name Server configuration.
  interface             Operations having to do with the creation, management and deletion of VMkernel network interfaces (vmknic).
  ipsec                 Operations on Internet Protocol Security
  route                 Operations pertaining to route configuration
  connection            List active tcpip connections
  neighbor              Operations that can be performed on arp tables
  netstack              Operations having to do with the creation, management and deletion of VMkernel Netstack Instances.

Interface detayları

Bu komut ile vmk interface’in enable olup olmadığı, MAC adresi, adı gibi bilgileri görebilirsiniz.

[root@esxi01:~] esxcli network ip interface list
vmk0
   Name: vmk0
   MAC Address: 00:25:90:bc:43:8b
   Enabled: true
   Portset: vSwitch0
   Portgroup: Management Network
   Netstack Instance: defaultTcpipStack
   VDS Name: N/A
   VDS UUID: N/A
   VDS Port: N/A
   VDS Connection: -1
   Opaque Network ID: N/A
   Opaque Network Type: N/A
   External ID: N/A
   MTU: 1500
   TSO MSS: 65535
   RXDispQueue Size: 1
   Port ID: 33554436

Bu komut ile her bir interface’in IP adreslerini ve subnet mask bilgilerini görebilirsiniz.

[root@esxi01:~] esxcli network ip interface ipv4 get
Name  IPv4 Address   IPv4 Netmask   IPv4 Broadcast  Address Type  Gateway      DHCP DNS
----  -------------  -------------  --------------  ------------  -----------  --------
vmk0  192.168.0.190  255.255.255.0  192.168.0.255   STATIC        192.168.0.1     false
vmk1  192.168.0.191  255.255.255.0  192.168.0.255   STATIC        192.168.0.1     false

Aşağıdaki komut, interface’lerin fiziksel durumlarını gösterir.

[root@esxi01:~] esxcfg-nics -l
Name    PCI          Driver      Link Speed      Duplex MAC Address       MTU    Description
vmnic0  0000:61:00.0 ixgben      Down 0Mbps      Half   00:25:90:bc:43:8a 1500   Intel(R) Ethernet Controller 10G X550
vmnic1  0000:61:00.1 ixgben      Up   1000Mbps   Full   00:25:90:bc:43:8b 1500   Intel(R) Ethernet Controller 10G X550

Aşağıdaki komut varsayılan ağ geçidini gösterir.

[root@esxi01:~] esxcfg-route
VMkernel default gateway is 192.168.0.1

Bu komut, ESXi host üzerindeki fiziksel ethernet kartlarını ve durumlarını gösterir.

[root@esxi01:~] esxcli network nic list
Name    PCI Device    Driver  Admin Status  Link Status  Speed  Duplex  MAC Address         MTU  Description
------  ------------  ------  ------------  -----------  -----  ------  -----------------  ----  -------------------------------------
vmnic0  0000:61:00.0  ixgben  Up            Down             0  Half    00:25:90:bc:43:8a  1500  Intel(R) Ethernet Controller 10G X550
vmnic1  0000:61:00.1  ixgben  Up            Up            1000  Full    00:25:90:bc:43:8b  1500  Intel(R) Ethernet Controller 10G X550

Bu komut, network kartının genel konfigürasyonu, firmware versiyonu gibi bilgileri verir.

[root@esxi01:~] esxcli network nic get -n vmnic0
   Advertised Auto Negotiation: true
   Advertised Link Modes: Auto, 100BaseT/Full, 1000BaseT/Full, 10000BaseT/Full
   Auto Negotiation: false
   Cable Type: Twisted Pair
   Current Message Level: -1
   Driver Info:
         Bus Info: 0000:61:00:0
         Driver: ixgben
         Firmware Version: 0x800007f3
         Version: 1.4.1
   Link Detected: false
   Link Status: Down
   Name: vmnic0
   PHYAddress: 0
   Pause Autonegotiate: true
   Pause RX: true
   Pause TX: true
   Supported Ports: TP
   Supports Auto Negotiation: true
   Supports Pause: true
   Supports Wakeon: false
   Transceiver:
   Virtual Address: 00:50:56:51:e9:c9
   Wakeon: None

Aşağıdaki komut ile vmnic IP adresini değiştirebilirsiniz. Görüldüğü gibi IP adresi 192.168.0.73 ile DHCP’den alınmıştı. Çalıştırdığımız komut ile IP hem static oldu, hem de 192.168.0.180 olarak değişti.

[root@localhost:~] esxcli network ip interface ipv4 get
Name  IPv4 Address  IPv4 Netmask   IPv4 Broadcast  Address Type  Gateway      DHCP DNS
----  ------------  -------------  --------------  ------------  -----------  --------
vmk0  192.168.0.73  255.255.255.0  192.168.0.255   DHCP          192.168.0.1      true
[root@localhost:~] esxcli network ip interface ipv4 set -i vmk0 -I 192.168.0.180 -N 255.255.255.0 -t static
[root@localhost:~] esxcli network ip interface ipv4 get
Name  IPv4 Address   IPv4 Netmask   IPv4 Broadcast  Address Type  Gateway  DHCP DNS
----  -------------  -------------  --------------  ------------  -------  --------
vmk0  192.168.0.180  255.255.255.0  192.168.0.255   STATIC        0.0.0.0     false

vSwitch detayları

esxcli network vswitch komutu ile standard veya distributed vSwitch listeleme, ekleme, silme gibi işlemleri yapabilirsiniz.

[root@localhost:~] esxcli network vswitch
Usage: esxcli network vswitch {cmd} [cmd options]

Available Namespaces:
  dvs                   Commands to retrieve Distributed Virtual Switch information
  standard              Commands to list and manipulate Legacy Virtual Switches on an ESX host.

Aşağıdaki komut ile standard vSwitch’leri listeleyebilirsiniz.

vSwitch0
   Name: vSwitch0
   Class: cswitch
   Num Ports: 2560
   Used Ports: 4
   Configured Ports: 128
   MTU: 1500
   CDP Status: listen
   Beacon Enabled: false
   Beacon Interval: 1
   Beacon Threshold: 3
   Beacon Required By:
   Uplinks: vmnic0
   Portgroups: VM Network, Management Network

Aşağıdaki komut ile yeni bir vSwitch ekleyebilirsiniz. Yeni eklenen vSwitch1 aşağıdaki gibi.

[root@localhost:~] esxcli network vswitch standard add -v vswitch1
[root@localhost:~] esxcli network vswitch standard list
vSwitch0
   Name: vSwitch0
   Class: cswitch
   Num Ports: 2560
   Used Ports: 4
   Configured Ports: 128
   MTU: 1500
   CDP Status: listen
   Beacon Enabled: false
   Beacon Interval: 1
   Beacon Threshold: 3
   Beacon Required By:
   Uplinks: vmnic0
   Portgroups: VM Network, Management Network

vswitch1
   Name: vswitch1
   Class: cswitch
   Num Ports: 2560
   Used Ports: 1
   Configured Ports: 128
   MTU: 1500
   CDP Status: listen
   Beacon Enabled: false
   Beacon Interval: 1
   Beacon Threshold: 3
   Beacon Required By:
   Uplinks:
   Portgroups:

VM detayları

esxcli network vm komutu ile sanal makinelerin listesini ve port bağlantılarını görebilirsiniz.

[root@esxi01:~] esxcli network vm list
World ID  Name                          Num Ports  Networks
--------  ----------------------------  ---------  ----------
 2854029  vGPU-vCenter                          1  VM Network

Yukarıda listelediğimiz sanal makinelerin World ID’si ile, ilgili sanal makinenin vSwitch, PortGroup, Uplink, Port ID gibi bilgilerini görebiliriz.

[root@esxi01:~] esxcli network vm port list -w 2854029
   Port ID: 33554456
   vSwitch: vSwitch0
   Portgroup: VM Network
   DVPort ID:
   MAC Address: 00:50:56:9c:bf:8c
   IP Address: 0.0.0.0
   Team Uplink: vmnic1
   Uplink Port ID: 33554434
   Active Filters:

Port ID ile, ilgili portun istatistik bilgilerini görebiliriz.

[root@esxi01:~] esxcli network port stats get -p 33554456
Packet statistics for port 33554456
   Packets received: 20276060
   Packets sent: 14126193
   Bytes received: 9751939933
   Bytes sent: 2951691923
   Broadcast packets received: 4569393
   Broadcast packets sent: 98019
   Multicast packets received: 3114404
   Multicast packets sent: 3
   Unicast packets received: 12592263
   Unicast packets sent: 14028171
   Receive packets dropped: 0
   Transmit packets dropped: 0

Leave a Reply