This post is for the VMware administrators who started working in vSphere5 editions from vSphere 4 because ESX4 commands to configure networking is “esxcfg-” but esxi5 networking is configured with esxcli commands. Lets discuss about the detailed steps of configuring network using esxcli command. Since esxcli network has multiple sub commands under each commands. To get clear understanding of networking commands, I have posted each network sub commands under different post in different parts. This post is cover all options under esxcli network IP commands and its sub commands.
Esxcli networking commands
starts with esxcli network and it gives all the options
available under network options
~ # esxcli
network
Lets discuss about the detailed
steps under networking options
Esxcli network IP
~ # esxcli network ip
1.To get Global IP settings
1.1 To check IPv6 status
~ # esxcli network ip
get
IPv6Enabled: false
IPv6Enabled: false
1.2 To Set IPv6 enable
~ # esxcli network ip
set -e true (reboot is required)
1.3 To set IPv6 disable
~ # esxcli network ip
set -e false (reboot is required)
2.To Configure DNS settings
~ # esxcli network ip dns
~ # esxcli network ip dns search
2.1 To List the search domains
currently configured on ESXi host
~ # esxcli network ip dns search
list
DNSSearch Domains: lab.com
DNSSearch Domains: lab.com
2.2 To add the domain to the
list of domains to be searched when trying to resolve an host name on the ESXi
host
~ # esxcli network ip
dns search add -d vmwarearena.com
~ # esxcli network ip dns search list
DNSSearch Domains: lab.com, vmwarearena.com
~ # esxcli network ip dns search list
DNSSearch Domains: lab.com, vmwarearena.com
2.3 To
remove search domains from the list of domains to be searched when
trying to resolve an host name on the ESXi host.
~ # esxcli network ip
dns search remove -d vmwarearena.com
~ # esxcli network ip dns search list
DNSSearch Domains: lab.com
~ # esxcli network ip dns search list
DNSSearch Domains: lab.com
~ # esxcli network ip dns server
2.4 To Print the list of the DNS server currently configured on the ESXi server
~ # esxcli network ip
dns server list
DNSServers: 192.168.0.20
DNSServers: 192.168.0.20
2.5 To Add a new DNS server to
the end of the list of DNS servers to use for this ESXi host.
~ # esxcli network ip
dns server add -s 192.168.0.21
~ # esxcli network ip dns server list
DNS Servers: 192.168.0.20, 192.168.0.21
~ # esxcli network ip dns server list
DNS Servers: 192.168.0.20, 192.168.0.21
2.6 To Remove a DNS server from
the list of DNS servers to use for this ESXi host.
~ # esxcli network ip
dns server remove -s 192.168.0.21
~ # esxcli network ip dns server list
DNS Servers: 192.168.0.20
~ # esxcli network ip dns server list
DNS Servers: 192.168.0.20
3.To Configure IP interface Settings
~ # esxcli network ip interface
3.1 To List the VMkernel network interfaces
~ # esxcli network ip
interface list
vmk0
Name: vmk0
MAC Address: 00:0c:29:b6:a8:41
Enabled: true
Portset: vSwitch0
Portgroup: Management Network
VDS Name: N/A
VDS Port: N/A
VDS Connection: -1
MTU: 1500
TSO MSS: 65535
Port ID: 16777219
vmk0
Name: vmk0
MAC Address: 00:0c:29:b6:a8:41
Enabled: true
Portset: vSwitch0
Portgroup: Management Network
VDS Name: N/A
VDS Port: N/A
VDS Connection: -1
MTU: 1500
TSO MSS: 65535
Port ID: 16777219
3.2 To add a new VMkernel
network interface
To add a new vmkernel network
interface, we need an existing port group. Creating port group will
cover in my later part, For this example, we have an existing port group
created called “VMOTION”
~ # esxcli network
vswitch standard portgroup add -v vSwitch0 -p VMOTION
Now add the VMkernel network
interface
~ # esxcli network ip
interface add -i vmk1 -p VMOTION
~ #
~ #
3.3 To assign the IP address to
the newly added vmkernel interface VMk1 using the below command
~ # esxcli
network ip interface ipv4
# esxcli network ip interface ipv4 get
Name IPv4 Address
IPv4 Netmask IPv4 Broadcast Address Type DHCP DNS
—- ———— ————- ————– ———— ——– ——————
vmk0 192.168.0.77 255.255.255.0 192.168.0.255 STATIC false
—- ———— ————- ————– ———— ——– ——————
vmk0 192.168.0.77 255.255.255.0 192.168.0.255 STATIC false
~ # esxcli network ip
interface ipv4 set -i vmk1
~ # esxcli network ip interface ipv4 set -i vmk1 -I 192.168.0.78 -N 255.255.255.0 -t static
~ # esxcli network ip interface ipv4 get
Name IPv4 Address IPv4 Netmask IPv4 Broadcast Address Type DHCP DNS
—- ———— ————- ————– ———— ——–
vmk0 192.168.0.77 255.255.255.0 192.168.0.255 STATIC false
vmk1 192.168.0.78 255.255.255.0 192.168.0.255 STATIC false
~ #
3.4 To set the enabled status
and MTU size of a VMkernel Interface of ESXi host
~ # esxcli network ip
interface set -e true -i vmk1 -m 1500
~ #
~ #
3.5 To Remove a new VMkernel
network interface from the ESXi host.
~ # esxcli network ip
interface remove -i vmk1
~ #
~ #
After removal , We can only see
only one vmkernel interface in the below list.
~ # esxcli network ip
interface ipv4 get
Name IPv4 Address IPv4 Netmask IPv4 Broadcast Address Type DHCP DNS
—- ———— ————- ————– ———— ——–
vmk0 192.168.0.77 255.255.255.0 192.168.0.255 STATIC false
Name IPv4 Address IPv4 Netmask IPv4 Broadcast Address Type DHCP DNS
—- ———— ————- ————– ———— ——–
vmk0 192.168.0.77 255.255.255.0 192.168.0.255 STATIC false
3.6 To list active TCP/IP
Connections in ESXi host
~ # esxcli network ip connection
~ # esxcli network ip
connection list
Proto Recv Q Send Q Local Address Foreign Address State World ID World Name
—– —— —— —————— —————— ———– ——– —————
tcp 0 0 127.0.0.1:8307 127.0.0.1:52491 ESTABLISHED 2916 hostd-worker
tcp 0 0 127.0.0.1:52491 127.0.0.1:8307 ESTABLISHED 2918 hostd-worker
tcp 0 0 127.0.0.1:443 127.0.0.1:61917 ESTABLISHED 3002 hostd-worker
tcp 0 0 127.0.0.1:61917 127.0.0.1:443 ESTABLISHED 7425 python
tcp 0 0 127.0.0.1:57296 127.0.0.1:8307 TIME_WAIT 0
tcp 0 0 127.0.0.1:59288 127.0.0.1:443 TIME_WAIT 0
tcp 0 0 127.0.0.1:55429 127.0.0.1:8307 TIME_WAIT 0
tcp 0 0 127.0.0.1:55883 127.0.0.1:443 TIME_WAIT 0
tcp 0 0 192.168.0.77:80 192.168.0.20:55739 TIME_WAIT 0
tcp 0 0 127.0.0.1:5988 127.0.0.1:49781 FIN_WAIT_2 0
tcp 0 0 127.0.0.1:49781 127.0.0.1:5988 CLOSE_WAIT 2890 hostd-worker
tcp 0 0 127.0.0.1:60217 127.0.0.1:8307 TIME_WAIT 0
tcp 0 0 127.0.0.1:58746 127.0.0.1:443 TIME_WAIT 0
tcp 0 0 127.0.0.1:5988 127.0.0.1:61163 TIME_WAIT 0
tcp 0 0 127.0.0.1:8307 127.0.0.1:60307 ESTABLISHED 6991 hostd-worker
tcp 0 0 127.0.0.1:60307 127.0.0.1:8307 ESTABLISHED 4728 hostd-worker
tcp 0 0 127.0.0.1:80 127.0.0.1:58060 ESTABLISHED 4728 hostd-worker
tcp 0 0 127.0.0.1:58060 127.0.0.1:80 ESTABLISHED 3600 sfcb-vmware_bas
tcp 0 0 127.0.0.1:8307 127.0.0.1:49981 ESTABLISHED 4728 hostd-worker
tcp 0 0 127.0.0.1:49981 127.0.0.1:8307 ESTABLISHED 2890 hostd-worker
tcp 0 0 192.168.0.77:443 192.168.0.20:55265 ESTABLISHED 2916 hostd-worker
tcp 0 0 127.0.0.1:8307 127.0.0.1:52263 ESTABLISHED 2916 hostd-worker
tcp 0 0 127.0.0.1:52263 127.0.0.1:8307 ESTABLISHED 3002 hostd-worker
tcp 0 0 192.168.0.77:443 192.168.0.20:64951 ESTABLISHED 2890 hostd-worker
tcp 0 0 127.0.0.1:8307 127.0.0.1:51110 ESTABLISHED 3493 hostd-worker
tcp 0 0 127.0.0.1:51110 127.0.0.1:8307 ESTABLISHED 2916 hostd-worker
tcp 0 0 192.168.0.77:443 192.168.0.20:64689 ESTABLISHED 4728 hostd-worker
tcp 0 1383 127.0.0.1:8307 127.0.0.1:62423 ESTABLISHED 3493 hostd-worker
tcp 0 0 127.0.0.1:62423 127.0.0.1:8307 ESTABLISHED 3220 vpxa-worker
tcp 0 0 192.168.0.77:22 192.168.0.20:63005 ESTABLISHED 0
tcp 0 0 127.0.0.1:80 127.0.0.1:52409 FIN_WAIT_2 3492 hostd-worker
tcp 0 0 127.0.0.1:52409 127.0.0.1:80 CLOSE_WAIT 3592 sfcb-vmware_bas
tcp 0 0 127.0.0.1:8089 0.0.0.0:0 LISTEN 3203 vpxa-worker
tcp 0 0 127.0.0.1:12000 0.0.0.0:0 LISTEN 3203 vpxa-worker
tcp 0 0 127.0.0.1:8307 127.0.0.1:52405 ESTABLISHED 2916 hostd-worker
tcp 0 0 127.0.0.1:52405 127.0.0.1:8307 ESTABLISHED 3220 vpxa-worker
tcp 0 0 127.0.0.1:8307 127.0.0.1:52401 ESTABLISHED 2918 hostd-worker
tcp 0 0 127.0.0.1:52401 127.0.0.1:8307 ESTABLISHED 3221 vpxa-worker
tcp 0 0 127.0.0.1:8307 127.0.0.1:52395 CLOSE_WAIT 2916 hostd-worker
tcp 0 0 127.0.0.1:52395 127.0.0.1:8307 FIN_WAIT_2 2916 hostd-worker
tcp 0 0 127.0.0.1:5988 0.0.0.0:0 LISTEN 0
tcp 0 0 0.0.0.0:5989 0.0.0.0:0 LISTEN 0
tcp 0 0 127.0.0.1:8889 0.0.0.0:0 LISTEN 3277 openwsmand
tcp 0 0 192.168.0.77:427 0.0.0.0:0 LISTEN 0
tcp 0 0 127.0.0.1:427 0.0.0.0:0 LISTEN 0
tcp 0 0 127.0.0.1:8307 0.0.0.0:0 LISTEN 2890 hostd-worker
tcp 0 0 127.0.0.1:8309 0.0.0.0:0 LISTEN 2890 hostd-worker
tcp 0 0 0.0.0.0:80 0.0.0.0:0 LISTEN 2890 hostd-worker
tcp 0 0 0.0.0.0:443 0.0.0.0:0 LISTEN 2890 hostd-worker
tcp 0 0 127.0.0.1:12001 0.0.0.0:0 LISTEN 2890 hostd-worker
tcp 0 0 0.0.0.0:22 0.0.0.0:0 LISTEN 0
tcp 0 0 192.168.0.77:51225 192.168.0.20:389 ESTABLISHED 2694 lsassd
tcp 0 0 0.0.0.0:902 0.0.0.0:0 LISTEN 0
tcp 0 0 0.0.0.0:8000 0.0.0.0:0 LISTEN 2603
tcp 0 0 0.0.0.0:8100 0.0.0.0:0 LISTEN 2603
udp 0 0 192.168.0.77:427 0.0.0.0:0 0
udp 0 0 0.0.0.0:427 0.0.0.0:0 0
udp 0 0 192.168.0.77:52846 192.168.0.88:514 0
udp 0 0 0.0.0.0:8200 0.0.0.0:0 2603
udp 0 0 0.0.0.0:8301 0.0.0.0:0 2603
udp 0 0 0.0.0.0:8302 0.0.0.0:0 2603
~ #
Proto Recv Q Send Q Local Address Foreign Address State World ID World Name
—– —— —— —————— —————— ———– ——– —————
tcp 0 0 127.0.0.1:8307 127.0.0.1:52491 ESTABLISHED 2916 hostd-worker
tcp 0 0 127.0.0.1:52491 127.0.0.1:8307 ESTABLISHED 2918 hostd-worker
tcp 0 0 127.0.0.1:443 127.0.0.1:61917 ESTABLISHED 3002 hostd-worker
tcp 0 0 127.0.0.1:61917 127.0.0.1:443 ESTABLISHED 7425 python
tcp 0 0 127.0.0.1:57296 127.0.0.1:8307 TIME_WAIT 0
tcp 0 0 127.0.0.1:59288 127.0.0.1:443 TIME_WAIT 0
tcp 0 0 127.0.0.1:55429 127.0.0.1:8307 TIME_WAIT 0
tcp 0 0 127.0.0.1:55883 127.0.0.1:443 TIME_WAIT 0
tcp 0 0 192.168.0.77:80 192.168.0.20:55739 TIME_WAIT 0
tcp 0 0 127.0.0.1:5988 127.0.0.1:49781 FIN_WAIT_2 0
tcp 0 0 127.0.0.1:49781 127.0.0.1:5988 CLOSE_WAIT 2890 hostd-worker
tcp 0 0 127.0.0.1:60217 127.0.0.1:8307 TIME_WAIT 0
tcp 0 0 127.0.0.1:58746 127.0.0.1:443 TIME_WAIT 0
tcp 0 0 127.0.0.1:5988 127.0.0.1:61163 TIME_WAIT 0
tcp 0 0 127.0.0.1:8307 127.0.0.1:60307 ESTABLISHED 6991 hostd-worker
tcp 0 0 127.0.0.1:60307 127.0.0.1:8307 ESTABLISHED 4728 hostd-worker
tcp 0 0 127.0.0.1:80 127.0.0.1:58060 ESTABLISHED 4728 hostd-worker
tcp 0 0 127.0.0.1:58060 127.0.0.1:80 ESTABLISHED 3600 sfcb-vmware_bas
tcp 0 0 127.0.0.1:8307 127.0.0.1:49981 ESTABLISHED 4728 hostd-worker
tcp 0 0 127.0.0.1:49981 127.0.0.1:8307 ESTABLISHED 2890 hostd-worker
tcp 0 0 192.168.0.77:443 192.168.0.20:55265 ESTABLISHED 2916 hostd-worker
tcp 0 0 127.0.0.1:8307 127.0.0.1:52263 ESTABLISHED 2916 hostd-worker
tcp 0 0 127.0.0.1:52263 127.0.0.1:8307 ESTABLISHED 3002 hostd-worker
tcp 0 0 192.168.0.77:443 192.168.0.20:64951 ESTABLISHED 2890 hostd-worker
tcp 0 0 127.0.0.1:8307 127.0.0.1:51110 ESTABLISHED 3493 hostd-worker
tcp 0 0 127.0.0.1:51110 127.0.0.1:8307 ESTABLISHED 2916 hostd-worker
tcp 0 0 192.168.0.77:443 192.168.0.20:64689 ESTABLISHED 4728 hostd-worker
tcp 0 1383 127.0.0.1:8307 127.0.0.1:62423 ESTABLISHED 3493 hostd-worker
tcp 0 0 127.0.0.1:62423 127.0.0.1:8307 ESTABLISHED 3220 vpxa-worker
tcp 0 0 192.168.0.77:22 192.168.0.20:63005 ESTABLISHED 0
tcp 0 0 127.0.0.1:80 127.0.0.1:52409 FIN_WAIT_2 3492 hostd-worker
tcp 0 0 127.0.0.1:52409 127.0.0.1:80 CLOSE_WAIT 3592 sfcb-vmware_bas
tcp 0 0 127.0.0.1:8089 0.0.0.0:0 LISTEN 3203 vpxa-worker
tcp 0 0 127.0.0.1:12000 0.0.0.0:0 LISTEN 3203 vpxa-worker
tcp 0 0 127.0.0.1:8307 127.0.0.1:52405 ESTABLISHED 2916 hostd-worker
tcp 0 0 127.0.0.1:52405 127.0.0.1:8307 ESTABLISHED 3220 vpxa-worker
tcp 0 0 127.0.0.1:8307 127.0.0.1:52401 ESTABLISHED 2918 hostd-worker
tcp 0 0 127.0.0.1:52401 127.0.0.1:8307 ESTABLISHED 3221 vpxa-worker
tcp 0 0 127.0.0.1:8307 127.0.0.1:52395 CLOSE_WAIT 2916 hostd-worker
tcp 0 0 127.0.0.1:52395 127.0.0.1:8307 FIN_WAIT_2 2916 hostd-worker
tcp 0 0 127.0.0.1:5988 0.0.0.0:0 LISTEN 0
tcp 0 0 0.0.0.0:5989 0.0.0.0:0 LISTEN 0
tcp 0 0 127.0.0.1:8889 0.0.0.0:0 LISTEN 3277 openwsmand
tcp 0 0 192.168.0.77:427 0.0.0.0:0 LISTEN 0
tcp 0 0 127.0.0.1:427 0.0.0.0:0 LISTEN 0
tcp 0 0 127.0.0.1:8307 0.0.0.0:0 LISTEN 2890 hostd-worker
tcp 0 0 127.0.0.1:8309 0.0.0.0:0 LISTEN 2890 hostd-worker
tcp 0 0 0.0.0.0:80 0.0.0.0:0 LISTEN 2890 hostd-worker
tcp 0 0 0.0.0.0:443 0.0.0.0:0 LISTEN 2890 hostd-worker
tcp 0 0 127.0.0.1:12001 0.0.0.0:0 LISTEN 2890 hostd-worker
tcp 0 0 0.0.0.0:22 0.0.0.0:0 LISTEN 0
tcp 0 0 192.168.0.77:51225 192.168.0.20:389 ESTABLISHED 2694 lsassd
tcp 0 0 0.0.0.0:902 0.0.0.0:0 LISTEN 0
tcp 0 0 0.0.0.0:8000 0.0.0.0:0 LISTEN 2603
tcp 0 0 0.0.0.0:8100 0.0.0.0:0 LISTEN 2603
udp 0 0 192.168.0.77:427 0.0.0.0:0 0
udp 0 0 0.0.0.0:427 0.0.0.0:0 0
udp 0 0 192.168.0.77:52846 192.168.0.88:514 0
udp 0 0 0.0.0.0:8200 0.0.0.0:0 2603
udp 0 0 0.0.0.0:8301 0.0.0.0:0 2603
udp 0 0 0.0.0.0:8302 0.0.0.0:0 2603
~ #
3.7 To list arp table entries
~ # esxcli network ip
neighbor list
Neighbor Mac Address Vmknic Expiry State
———— —————– —— ——– —–
192.168.0.20 1c:6f:65:db:ff:6c vmk0 1200 sec
Neighbor Mac Address Vmknic Expiry State
———— —————– —— ——– —–
192.168.0.20 1c:6f:65:db:ff:6c vmk0 1200 sec
No comments:
Post a Comment