打开esxi主机的ssh,通过ssh登陆到命令行界面下
添加静态路由如下:
添加静态路由命令 esxcli network ip route ipv4 add --gateway 10.195.1.254 --network 10.0.0.0/8 esxcli network ip route ipv4 add --gateway 10.195.1.254 --network 172.27.0.0/24 查看当前路由 [root@ESXI043:~] esxcfg-route -l VMkernel Routes: Network Netmask Gateway Interface 172.27.0.0 255.255.255.0 10.195.1.254 vmk0 10.195.0.0 255.255.254.0 Local Subnet vmk0 172.27.0.0 255.255.0.0 10.195.1.254 vmk0 10.0.0.0 255.0.0.0 10.195.1.254 vmk0 default 0.0.0.0 10.195.0.25 vmk0 该路由添加后重启机器会失效,添加到启动脚本开机自动运行 [root@ESXI043:~] vi /etc/rc.local.d/local.sh #!/bin/sh # local configuration options # Note: modify at your own risk! If you do/use anything in this # script that is not part of a stable API (relying on files to be in # specific places, specific tools, specific output, etc) there is a # possibility you will end up with a broken system after patching or # upgrading. Changes are not supported unless under direction of # VMware support. esxcli network ip route ipv4 add --gateway 10.195.1.254 --network 10.0.0.0/8 esxcli network ip route ipv4 add --gateway 10.195.1.254 --network 172.27.0.0/24
重启后也能生效
未经允许不得转载:ESXI添加静态路由