从WAN访问exsi管理口,关联 ssh tunnelling, openwrt, esxcli, esxcfg-route

例子: 网络结构

  • 主路由(OpenWrt) 172.16.2.1
    配置静态路由,执行
    1
      ip route add 172.16.11.0/24 dev br-lan via 172.16.2.11
    
  • 下级路由(OpenWrt) 172.16.11.1 / 172.16.2.11
    EXSi 管理口地址: 172.16.11.11

使用ssh tunnel

  1. 执行ssh -L建立ssh tunnel
    1
    2
    3
     ssh -L 127.0.0.1:44311:172.16.11.11:443 root@172.16.11.1
     # 或者 省略 127.0.0.1 也行
     ssh -L 44311:172.16.11.11:443 root@172.16.11.1
    
  2. 浏览器访问 : https://127.0.0.1:44311

配置 EXSi 的 网络(没试过)

  • 参考
  1. ssh 连接到 ESXi
  2. 配置 route

    In ESXi 5.1, and ESXi 5.5, and ESXi 6.0, and ESXi 7.0:

    To add a static route, run the command:

    1
     esxcli network ip route ipv4/ipv6 add --gateway IPv4_address_of_router --network IPv4_address
    

    For example, to add a route to 192.168.100.0 network with a /24 bit subnet mask (255.255.255.0) through a router with an IP address of 192.168.0.1, run this command:

    1
     esxcli network ip route ipv4 add --gateway 192.168.0.1 --network 192.168.100.0/24
    

    To list the route, run the command:

    1
     esxcli network ip route ipv4 list
    

    To remove a static route, run the command:

    1
     esxcli network ip route ipv4 remove -n network_ip/mask -g gateway_ip
    

    For example, to remove a route from 192.168.100.0 network with a /24 bit subnet mask (255.255.255.0) through a router with an IP address of 192.168.0.1, run this command:

    1
     esxcli network ip route ipv4 remove -n 192.168.100.0/24 -g 192.168.0.1
    
  3. esxcfg-route -l 检查下当前的路由表