Nginx 中获取cloudflare保护的网站的访问者的真正IP

一般来说,有三个参数可以使用:

  1. CF-Connecting-IP, 在nginx log中为 cf-connecting-ip.
  2. True-Client-IP, 仅给Cloudflare 企业用户使用,在nginx log中为true-client-ip
  3. X-Forwarded-For, 在nginx log 中比较常见,为x-forwarded-for. X-Forwarded-For 其实是一个数组,按顺序记录了用户的真正的IP和用户使用的Proxy.

举例说明:

X-Forwarded-For: 203.0.113.1 

这个表示用户的真实IP是203.0.113.1

X-Forwarded-For: 198.51.100.101,198.51.100.102,203.0.113.1

这个表示用户的真实IP是203.0.113.1,然后依次经过了198.51.100.102和198.51.100.101代理,然后才访问到了CF的edge 节点

综上所述, CF 推荐使用CF-COnnecting-IP 和 True-Client-IP 两种header,因为他们能够保证他们的value只有一个IP

用cli的方式升级ESXi 6.7 到7.0 2c

ESXi 跨越大版本(比如说6.5到6.7,6.7到7)的升级,总的来说有两种方式. 一种是通过vCSA 的Life Cycle Manager 来import ISO,设定好baseline 来升级. 另外一种就是通过cli 的方式来直接升级. (通过ISO文件启动来升级的方式比较少见)

什么情况下用的到cli的方式来升级呢? 比如说vCSA 所在的ESXi 的host 需要升级,或者说你没有使用vCSA,而只是使用single ESXi host 等等

下面就详细说以下Cli 的升级方式.

Cli 升级也分为两种方式, 一种是offline 升级,一种是online升级. 不管是offline还是online, 首先都需要关闭ESXi host上的所有VM,方便进入maintenance 模式

命令参数:  -p 代表 profile,  -d 代表depot

Offline 升级:

  1. 从my.vmware.com上下载offline 升级的bundle, 如下图,选择Vmware vSphere Hypervisor(ESXi) Offline Bundle. 下载完了一定要注意验证md5

      2.ESXi host上面打开SSH, 把bundle 文件上传到datastore

      3.检查这个offline bundle中的可用的profile, 一般选择standard 结尾的那个profile, no-tools结尾的一般用于pxe

esxcli software sources profile list -d /vmfs/volumes/datastore1/ISOs/VMware-ESXi-7.0U2a-17867351-depot

       这里我们选择    ESXi-7.0U2a-17867351-standard

4. Dry-run upgrade, 看看那些VIBs会被移除和新增

esxcli software profile update -p ESXi-7.0U2a-17867351-standard -d /vmfs/volumes/datastore1/ISOs/VMware-ESXi-7.0U2a-17867351-depot --dry-run

      5.设置ESXi host进入maintenance mode

esxcli system maintenanceMode set –enable true

      6. 升级

esxcli software profile update -p ESXi-7.0U2a-17867351-standard -d /vmfs/volumes/datastore1/ISOs/VMware-ESXi-7.0U2a-17867351-depot

       7. 设置ESXi 退出maintenance mode

esxcli system maintenanceMode set --enable false

       8. 重启

reboot

 

Online升级: 

  1. ESXi host 进入maintenance 模式
esxcli system maintenanceMode set --enable true

      2. 防火墙里打开http traffic

esxcli network firewall ruleset set -e true -r httpClient

      3. 在VM repo上检查ESXi 7.0 可用的profiles

esxcli software sources profile list -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml | grep ESXi-7.0

查询需要一定的时间, 然后如上面的offline 升级一样,会列出可用的profile,我们这里选择最新的以standard结尾的profile

ESXi-7.0U2d-18538813-standard

       4. dry-run检查

esxcli software profile update -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml -p ESXi-7.0U2d-18538813-standard --dry-run

      5. 正式升级

esxcli software profile update -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml -p ESXi-7.0U2d-18538813-standard

需要一定的时间来完成,这个时候安心等待就可以

从6.X升级到7的时候,有的时候会出现下面的错误提示:

Got no data from process: LANG=en_US.UTF-8 /usr/lib/vmware/esxcli-software profile.update -d "https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml" -p "ESXi-7.0U2d-18538813-standard"

这是因为你的ESXi Host上没有一个static scratch分区. 要不然就按照下面的方法来设置static scratch分区:

Enabling ESXi Persitent Scratch Partition

要不然就直接先用offline升级的方式升级到7.0,然后在用Cli 或者其他的方法升级到最新的7.X ESXi版本. 这是因为在ESXi 7 中,使用scratch 的方式发生了变化. 我建议使用offline 的方式,因为offline 的方式升级速度非常的快!

     6. 恢复原来的防火墙设置

esxcli network firewall ruleset set -e false -r httpClient

     7. ESXi host退出maintenance模式

esxcli system maintenanceMode set --enable false

     8. 重启

reboot

vCSA 6.7 升级到vCSA 7.0 (大版本升级)

vCSA的升级分为两种:

一个是大版本的升级,比如说6.5升级到6.7, 6.7升级到7.0. 这个时候就需要挂载新的vCenter 的ISO, 运行里面的installer.exe 来进行GUI升级,一步一步的按照步骤来做就可以了

一个是小版本的升级, 比如说7.02a 升级到7.02c之类的,其实就是打了一个小的patch, 这个时候就简单多了,直接进入VAMI界面, 也就是https://VCSA-ip:5480, 选择左下方的update 就可以了,选择好版本号,就可以便利的进行升级了.

小版本的升级可以参阅这篇文章:

https://virtualg.uk/how-to-upgrade-to-vmware-vcenter-server-vcsa-7-0-update-2/

这篇文章我们主要说vCSA 6.7升级到7.0, 也就是大版本升级的一般步骤.

千万要记住,一定要先升级vCSA, 然后再升级ESXi.

也即是说vCSA的版本一定要比ESXi高. 举个例子,7.0U2的 vCSA 可以连接6.7U3 的ESXi。 但是6.7U3的vCSA是无法连接7.0U2的ESXi的.

大概的升级过程,可以参见这篇文章:

https://www.crazycen.com/vmware/1660.html

英文版:

https://miketabor.com/how-to-upgrade-vcenter-server-appliance-6-7-to-7-0/

需要注意的是, vCenter Server一定通过VAMI打开SSH Access, 升级过程中需要用到

另外一点就是, 你可以会遇到下面两个错误提示:

Exception in invoking authentication handler unidentifiable C++ exception
no healthy upstream

这两个error常发生在vCSA升级完自动升级完,跳转回登录界面, 然后你登录了,有的时候就会出现上面的错误.

原因很简单,其实vCSA的升级还没有完全完成. 你可以去上个厕所,泡个咖啡什么的休息以下. 然后再刷新这个页面,重新登录就可以了

PHP ob_start()用途

PHP网站上的一条comment,写的非常的好:

These are two usages of ob_start():

1-Well, you have more control over the output. Trivial example: 
say you want to show the user an error message, but the script has 
already sent some HTML to the browser. It'll look ugly, with a 
half-rendered page and then an error message. Using the output buffering 
functions, you can simply delete the buffer and sebuffer and send only 
the error message, which means it looks all nice and neat buffer and send
2-The reason output buffering was invented was to create a seamless 
transfer, from: php engine -> apache -> operating system -> web user

If you make sure each of those use the same buffer size, the system 
will use less writes, use less system resources and be able
 to handle more traffic.

 

彻底删除VS Code以及安装的插件和个人配置信息

重装vscode的时候总是发现新安装的vscode 带有原来vscode 的插件和个人配置信息,这是因为删除的时候不彻底.

彻底删除vscode 主要有三个地方:

  1. 卸载vscode主程序,可以在控制面版里删除或者进入应用所在的文件夹删除

2.删除如下的文件夹(主要是插件信息): C/Users/{登录的用户名}/.vscode

 

3. 删除如下的文件夹(个人配置信息和缓存):/Users/{登录的用户名}/AppData/Roaming/Code

 

删除这三个地方,再次重新安装的时候,vscode就是原始的状态

 

最常用的UA(User Agent)列表(08/01/2021更新)

写一些简单的爬虫的时候会用到,来源于这里(经常更新):

https://techblog.willshouse.com/2012/01/03/most-common-user-agents/

Last Updated: Mon, 16 Aug 2021 11:05:50 +0000

percent useragent system
10.1% Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 Chrome 92.0 
 Win10
8.7% Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36 Chrome 92.0 
 Win10
6.0% Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0 Firefox 90.0 
 Win10
4.8% Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Chrome 91.0 
 Win10
4.7% Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36 Chrome 91.0 
 Win10
3.8% Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36 Chrome 92.0 
 macOS
2.9% Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 Chrome 92.0 
 macOS
2.6% Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15 Safari Generic 
 macOS
2.4% Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36 Chrome 91.0 
 macOS
2.2% Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15 Safari Generic 
 macOS
2.2% Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0 Firefox 90.0 
 Linux
2.0% Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36 Chrome 91.0 
 macOS
2.0% Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:90.0) Gecko/20100101 Firefox/90.0 Firefox 90.0 
 macOS
1.9% Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0 Firefox 78.0 
 Win10
1.7% Mozilla/5.0 (X11; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0 Firefox 90.0 
 Linux
1.5% Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0 Firefox 89.0 
 Win10
1.4% Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36 Edg/92.0.902.55 Edge 92.0 
 Win10
1.2% Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 Firefox 91.0 
 Win10
1.2% Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 Edg/92.0.902.67 Edge 92.0 
 Win10
1.1% Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36 Edg/92.0.902.62 Edge 92.0 
 Win10
1.0% Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36 Chrome 92.0 
 Linux
0.9% Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 Firefox 78.0 
 Linux
0.7% Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 Chrome 92.0 
 Linux
0.7% Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36 Chrome 91.0 
 Linux
0.6% Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Edg/91.0.864.70 Edge 91.0 
 Win10
0.6% Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36 OPR/77.0.4054.277 Opera Generic 
 Win10
0.6% Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36 Chrome 91.0 
 Linux
0.6% Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 Chrome 92.0 
 Win7
0.5% Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:89.0) Gecko/20100101 Firefox/89.0 Firefox 89.0 
 macOS
0.5% Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36 Edg/91.0.864.71 Edge 91.0 
 Win10
0.5% Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.115 Safari/537.36 Chrome 92.0 
 Win10
0.5% Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15 Safari Generic 
 macOS
0.4% Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Firefox/91.0 Firefox 91.0 
 macOS
0.4% Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15 Safari 14.0 
 macOS
0.4% Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36 Chrome 92.0 
 Win7
0.4% Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 Firefox 78.0 
 Win10
0.4% Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0 Firefox 90.0 
 Win7
0.4% Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0 Firefox 91.0 
 Win10
0.4% Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Safari/605.1.15 Safari Generic 
 macOS
0.4% Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 Firefox 91.0 
 Linux
0.3% Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0 Firefox 90.0 
 Linux
0.3% Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0 Firefox 89.0 
 Linux
0.3% Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Edg/91.0.864.67 Edge 91.0 
 Win10
0.3% Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36 Chrome 76.0 
 Win10
0.3% Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36 Chrome 91.0 
 Win10
0.3% Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 Firefox 91.0 
 Linux
0.3% Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15 Safari Generic 
 macOS
0.3% Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36 Chrome 91.0 
 Win10
0.2% Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 OPR/77.0.4054.203 Opera Generic 
 Win10
0.2% Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36 Chrome 92.0 
 Win8.1
0.2% Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.2 Safari/605.1.15 Safari 13.1 
 macOS
0.2% Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36 Chrome 91.0 
 macOS
0.2% Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Chrome 91.0 
 Win7
0.2% Mozilla/5.0 (X11; Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0 Firefox 89.0 
 Linux
0.2% Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36 Chrome 92.0 
 macOS
0.2% Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36 OPR/77.0.4054.275 Opera Generic 
 Win10
0.2% Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:90.0) Gecko/20100101 Firefox/90.0 Firefox 90.0 
 macOS
0.2% Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Chrome 91.0 
 Win8.1
0.2% Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Chrome 91.0 
 macOS
0.2% Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 Edg/92.0.902.73 Edge 92.0 
 Win10
0.2% Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 OPR/78.0.4093.147 Opera Generic 
 Win10
0.2% Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.3 Safari/605.1.15 Safari 13.1 
 macOS
0.2% Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36 Chrome 90.0 
 Win10
0.2% Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:90.0) Gecko/20100101 Firefox/90.0 Firefox 90.0 
 macOS
0.2% Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15 Safari Generic 
 macOS
0.2% Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0 Firefox 90.0 
 Win8.1
0.2% Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Firefox/78.0 Firefox 78.0 
 macOS
0.2% Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36 Chrome 91.0 
 macOS
0.2% Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 Firefox 91.0 
 Win7
0.2% Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 Chrome 92.0 
 Win8.1
0.2% Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36 Chrome 90.0 
 Linux

Virtualization Networking: Secondary IP range static routed to main IP of the server

今天收了一台leaseweb服务器,上面有两个IP range,主IP是/29, 第二个IP range是/24.

第二个/24 IP range, 没有自己的gateway IP 和 broadcast IP,是因为直接把这个IP range static route 到服务器的主IP,这样做的好处是省了两个IP. 但是对于虚拟化来说,这却是个不好的消息. 因为没有gateway,需要自己设置一个gateway,比较麻烦. 下面是搜索到的解决方案:

1) 来自于WHT: 

https://www.webhostingtalk.com/showthread.php?t=1411451

————————————–

1) Secondary IP blocks are delivered as a static route towards the main IP of the server. I
f you are binding these IPs directly to your machine, you should use a 255.255.255.255 netmask 
for each IP to allow all IPs to be usable.
If you are performing virtualization with anything other than OpenVZ, then you would 
need to establish a gateway in the secondary block and subnet accordingly on your side.
---
2) Secondary ranges are statically routed towards the main IP of the server itself and
 there is no defined gateway on our side. If you are using these directly on the machine
 or with OpenVZ, then no special configuration is needed and all IPs within the secondary
 subnet may be utilized without waste for a network, gateway, or broadcast. If you are
 configuring with Xen, KVM, or other similar methods of virtualization, you would need
 to setup a routed bridge to create a gateway for your VMs.

 

2) 来自于lowendtalk

https://www.lowendtalk.com/discussion/167250/proxmox-on-buyvm-routing
https://www.lowendtalk.com/discussion/122957/routing-ip-address-on-a-network-bridge

3) 来自于iweb.com, 在他们的knowledgebase 直接写了几个example, 如果用hyper-v 或者proxmox 的话会非常舒服,用esxi 的话也基本上是一个原理.

在Linux下:

Additional IPs at iWeb are not provided with an additional gateway so customers using VMWare or other virtualization tools might be wondering how they can use the additional IPs to create new Guest OS or Virtual Machines. It can be done by configuring VMWare to bridge connection to eth0.

Here is the specific way to make it work
Configure your first additional IP as a secondary IP on eth0:0
IP configuration is done in /etc/sysconfig/network-scripts/ifcfg-eth0:0
Enable IP forwarding to route VM traffic
IP forwarding can be enabled by adding net.ipv4.ip_forward = 1 to /etc/sysctl.conf
In VMWare make sure that your VM uses the bridge connection to eth0.
Configure your VM with one of your remaining 5 additional IPs.
The netmask is 255.255.255.248 (If you have been provided with 6 IPs). You can calculate the netmask via a website such as http://www.ipcalc.net/
Use XX.XX.XX.1 as the gateway
Example with actual IPs:

If you have been assigned the following additional IPs:

72.55.155.169
72.55.155.170
72.55.155.171
72.55.155.172
72.55.155.173
72.55.155.174
You would :

Configure the ip 72.55.155.169 as a secondary IP on eth0:0
Enable IP forwarding to route VM traffic
Make sure that your VM uses the bridge connection to eth0
Configure your VM with one of the available IPs (.170, .171, .172, .173 or .174)
Use 255.255.255.248 as the Netmask.
Use 72.55.155.169 as gateway.
Your VM’s network should now be properly configured!

 

在windows下:

This document takes in consideration that the host server network interface is configured with the following network configuration

Primary IP: <your primary ip address>
Netmask: 255.255.255.224
Gateway: <your primary ip address gateway>
Secondary IP: <your secondary ip address>
Netmask: 255.255.255.248
Gateway: <your primary ip address gateway>:
The secondary IP is crucial since it acts as a gateway for the virtual machine, in this case we used the first IP of the range.

Step 1. Enable bridged network configuration on virtual network interfaces

Open Start->Program Files->Vmware->Vmware server->Manage Virtual network
Open the Automatic bridging tab
Uncheck the automatic bridging
Open the Host Virtual Network Mapping tab
In the vmnet0 drop down menu select the interfaces which is configured with your primary address
Close the virtual network manager
Open Start->Program Files->Vmware->Vmware server-> Vmware server
Within the summary of the vm set the network interface for each vm to bridged
Step 2. Configure vm virtual network interfaces

Open the vm you wish to configure
Open Start->Network Connections (within the vm)
Configure the network interface with one of your secondary ip address (except the secondary ip you are using on the main host):
IP: <another secondary ip address>
Netmask: 255.255.255.248
Gateway: <the main host secondary ip address>
Step 3. Enable routing and remote access

Mare sure the windows firewall is disabled.

Routing and Remote access must be enabled on the main host as well as the vm’s

Open Start->Administrative Tools->Routing and Remote access
Right-click on the server
Select Configure and Enable Routing and Remote access
Select Custom configuration, click next
Select LAN Routing, click next
Click Finish
Make sure the service is started
Update: Since September 2012, iWeb provides a /28 range of primary IP. It allows you to use the same gateway for the VM as well as the host itself in bridge mode.