Azure的每个VM都有多种IP地址,包括DIP、VIP和PIP。具体如下:

DIP地址是在VM里能够看到的IP地址,即私网地址;PIP地址是这个VM关联的公网IP地址,即公网地址;VIP地址是负载均衡的地址。

目前Azure的VM已经支持每个网卡关联多个ipconfig,即可以支持VM的每个网卡关联多个私网和公网地址:DIP和PIP。

如下图:

具体配置如下:

1. VM种NIC的ipconfig

2. 添加ipconfig

点击添加后:

按相同的方法再添加第三个ipconfig,配置完后的配置结果:

3. VM内的配置(CentOS7)

登录到VM中,做如下修改:

[root@hwvntp01 init.d]# cd /etc/sysconfig/network-scripts/
[root@hwvntp01 network-scripts]# vim ifcfg-eth0:
DEVICE=eth0:
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.3.1.6
NETMASK=255.255.255.0
[root@hwvntp01 network-scripts]# vim ifcfg-eth0:
DEVICE=eth0:
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.3.1.7
NETMASK=255.255.255.0

然后重启Network的服务:

[root@hwvntp01 network-scripts]# cd /etc/init.d
[root@hwvntp01 init.d]# ./network restart

4. 检验

[root@hwvntp01 html]# ifconfig
eth0: flags=<UP,BROADCAST,RUNNING,MULTICAST> mtu
inet 10.3.1.5 netmask 255.255.255.0 broadcast 10.3.1.255
inet6 fe80:::faff:fe00:40f2 prefixlen scopeid 0x20<link>
ether ::fa:::f2 txqueuelen (Ethernet)
RX packets bytes (125.5 MiB)
RX errors dropped overruns frame
TX packets bytes (46.3 MiB)
TX errors dropped overruns carrier collisions
 
eth0:: flags=<UP,BROADCAST,RUNNING,MULTICAST> mtu
inet 10.3.1.6 netmask 255.255.255.0 broadcast 10.3.1.255
ether ::fa:::f2 txqueuelen (Ethernet)
 
eth0:: flags=<UP,BROADCAST,RUNNING,MULTICAST> mtu
inet 10.3.1.7 netmask 255.255.255.0 broadcast 10.3.1.255
ether ::fa:::f2 txqueuelen (Ethernet)
 
lo: flags=<UP,LOOPBACK,RUNNING> mtu
inet 127.0.0.1 netmask 255.0.0.0
inet6 :: prefixlen scopeid 0x10<host>
loop txqueuelen (Local Loopback)
RX packets bytes (1.0 KiB)
RX errors dropped overruns frame
TX packets bytes (1.0 KiB)
TX errors dropped overruns carrier collisions
 
[root@hwvntp01 html]# ping www.sina.com.cn
PING ara.sina.com.cn (121.14.1.190) () bytes of data.
bytes from 121.14.1.190 (121.14.1.190): icmp_seq= ttl= time=45.7 ms
bytes from 121.14.1.190 (121.14.1.190): icmp_seq= ttl= time=45.7 ms
^C
--- ara.sina.com.cn ping statistics ---
packets transmitted, received, % packet loss, time 1001ms
rtt min/avg/max/mdev = 45.710/45.716/45.723/0.213 ms
[root@hwvntp01 html]# ping -I 10.3.1.6 www.sina.com.cn
PING ara.sina.com.cn (121.14.1.190) from 10.3.1.6 : () bytes of data.
bytes from 121.14.1.190 (121.14.1.190): icmp_seq= ttl= time=48.4 ms
bytes from 121.14.1.190 (121.14.1.190): icmp_seq= ttl= time=48.5 ms
^C
--- ara.sina.com.cn ping statistics ---
packets transmitted, received, % packet loss, time 999ms
rtt min/avg/max/mdev = 48.406/48.470/48.535/0.229 ms
[root@hwvntp01 html]# ping -I 10.3.1.7 www.sina.com.cn
PING ara.sina.com.cn (121.14.1.190) from 10.3.1.7 : () bytes of data.
bytes from 121.14.1.190 (121.14.1.190): icmp_seq= ttl= time=46.3 ms
bytes from 121.14.1.190 (121.14.1.190): icmp_seq= ttl= time=46.4 ms
bytes from 121.14.1.190 (121.14.1.190): icmp_seq= ttl= time=46.1 ms
bytes from 121.14.1.190 (121.14.1.190): icmp_seq= ttl= time=46.2 ms
^C
--- ara.sina.com.cn ping statistics ---
packets transmitted, received, % packet loss, time 5958ms
rtt min/avg/max/mdev = 46.190/46.298/46.423/0.277 ms

5. 通过服务检验

在VM中安装httpd:

yum install -y httpd
systemctl start httpd
systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since Fri -- :: UTC; 6s ago
Docs: man:httpd()
man:apachectl()
Main PID: (httpd)

从外部检测:

三个地址都可以访问。

Azure上每个VM多个IP地址的更多相关文章

  1. Linux VM 设置静态ip地址上网

    因为是路由器共享上网,VM每次都是通过DHCP方式自动获取ip地址,连接Linux VM时ip地址经常变,很麻烦.现在把VM设置静态ip的方法总结一下,以免以后忘了. 1. VM上网方式设置为桥接. ...

  2. Windows Azure 上 Linux VM 中的交换空间 – 第 2 部分

    本文章由 Azure CAT 团队的 Piyush Ranjan (MSFT) 撰写. 在前一篇文章 Windows Azure 上Linux VM 中的交换空间第 1 部分中,我介绍了在默认情况下, ...

  3. Android 手机上获取手机当前上网IP地址

      [转] 原文              Android 手机上获取手机当前上网IP地址                (手机网关给手机号分配的IP) 每个手机上网通过移动网关的时候,网关都会给该手 ...

  4. Azure ARM (12) ARM模式下,在负载均衡器上设置多个公网IP地址

    <Windows Azure Platform 系列文章目录> 最近在帮助一个客户设置WAF (Web Application Firewall),WAF厂商要求在负载均衡器上,设置多个公 ...

  5. 在Windows Azure上配置VM主备切换(1)——Linux篇

    对任何一个上线系统来说,高可用设计是不可或缺的一个环节,这样才可以确保应用可以持续.稳定的运行,而不是频繁的掉线.停机.高可用设计的核心思路很简单,就是消除一切单点故障,将单点链路或者节点升级为多点. ...

  6. pycharm上运行django服务器端、ip地址访问

    安装Django  下载Django包,解压缩. CMD 进入解压路径下. 执行:python setup.py install 增加环境变量: C:\Python27\Scripts 测试djang ...

  7. Windows Azure 设置虚拟机静态外网IP地址

    官方说法叫做“虚拟公共IP地址保留”,为容易理解,我们称之为静态外网IP地址. 如果在国内使用国际版Windows Azure服务时强烈推荐为虚拟机设置IP地址保留. 由于Windows Azure ...

  8. Azure上Linux VM防DDOS攻击:使用Apache mod_evasive

    部署在云端的虚拟机和web服务,很容易受到DoS护着DDoS的服务攻击,让一些新上线的业务苦不堪言,当然各个云服务提供商也有不同层面DDOS的防护,然而由于防护粒度,攻击复杂度的关系,未必可以满足你的 ...

  9. 在Azure上的VM镜像库中找到想要的镜像

    Azure上的虚机镜像库中, 有很多的镜像,其中当然也包括了用户自定义上传的镜像. 在Powershell中如果想使用这些镜像的话, 则需要知道其名称 下面这条命令,可以获得所有的镜像信息 $imag ...

随机推荐

  1. 主攻ASP.NET MVC4.0之重生:MVC Controller修改Controller.tt模版,自动添加版本注释信息

    第一步找到MVC 4.0 CodeTemplates 一般路径在:C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Ite ...

  2. Guidelines for Successful SoC Verification in OVM/UVM

    By Moataz El-Metwally, Mentor Graphics Cairo Egypt Abstract : With the increasing adoption of OVM/UV ...

  3. JSP DAO(Model)

    示例代码: 1. Users类 package com.po; public class Users { private String username; private String passwor ...

  4. One 的使用(1)

    方法一:使用命令提示符 第一步:打开d盘  C:Users\dcf>d; 第二步:打开工作空间  D:\>Cd workspace 第三步:打开the one  D:\workspace& ...

  5. freemarker日志实现过程分析

    freemarker有自己的log类,这是一个抽象类,具体的日志打印委托给classpath里面合适的日志jar包来执行,寻找合适日志jar的查找顺序是:Apache Log4J, Apache Av ...

  6. 什么是OOM?如何解决OOM问题!

    1.什么是OOM? 程序申请内存过大,虚拟机无法满足我们,然后自杀了.这个现象通常出现在大图片的APP开发,或者需要用到很多图片的时候.通俗来讲就是我们的APP需要申请一块内存来存放图片的时候,系统认 ...

  7. JS,Jquery获取屏幕的宽度和高度

    Javascript: 网页可见区域宽: document.body.clientWidth网页可见区域高: document.body.clientHeight网页可见区域宽: document.b ...

  8. 安装rackspace private cloud --3 Deployment host

    on deploy host: 在deploy host上安装 Ubuntu Server 14.04 (Trusty Tahr) LTS 64-bit # apt-get install aptit ...

  9. DecimalFormat数据格式函数

    DecimalFormat数据格式函数 class FormatDemo2{ public void format(String pattern, double value) { DecimalFor ...

  10. UI(UGUI)框架(二)-------------UIManager单例模式与开发BasePanel面板基类/UIManage统一管理UI面板的实例化/开发字典扩展类

    UIManage单实例: /// 单例模式的核心 /// 1,定义一个静态的对象 在外界访问 在内部构造 /// 2,构造方法私有化 private static UIManager _instanc ...