VMware Cloud Community
EagleB5
VMware Employee
VMware Employee

Set gateway for netstack instance via esxcli

Hi Folks,

Is there a way to set a gateway via esxcli (kickstart script) for a netstack instance (vSphere 6.0 and above)?

What I've done yet:

esxcli network ip netstack add -N vmotion

esxcli network ip interface add -i vmk1 -p "pgName" -N vmotion

esxcli network ip interface ipv4 set -i vmk1 -t static -I 172.16.10.210 -N 255.255.255.0

Now I need to set a default gateway for netstack "vmotion". I know the -g parameter while setting ip Interface for vSphere 6.5 but it's not working here.

Thank you

0 Kudos
2 Replies
mhampto
VMware Employee
VMware Employee

Have you tried:

esxcli network ip interface ipv4 set –i vmknic -t static –g gateway -I IP address -N mask

0 Kudos
EagleB5
VMware Employee
VMware Employee

As i mentioned "-g gateway IP" only works for vSphere 6.5 but not for 6.0. But I've found entries in file /etc/vmware/esx.conf but there are so many related to the corresponding vmk.

0 Kudos