• Azure上每个VM多个IP地址


    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:0
    DEVICE=eth0:0
    ONBOOT=yes
    BOOTPROTO=static
    IPADDR=10.3.1.6
    NETMASK=255.255.255.0
    [root@hwvntp01 network-scripts]# vim ifcfg-eth0:1
    DEVICE=eth0:1
    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=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
    inet 10.3.1.5 netmask 255.255.255.0 broadcast 10.3.1.255
    inet6 fe80::217:faff:fe00:40f2 prefixlen 64 scopeid 0x20<link>
    ether 00:17:fa:00:40:f2 txqueuelen 1000 (Ethernet)
    RX packets 250659 bytes 131605494 (125.5 MiB)
    RX errors 0 dropped 1 overruns 0 frame 0
    TX packets 302252 bytes 48623564 (46.3 MiB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
     
    eth0:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
    inet 10.3.1.6 netmask 255.255.255.0 broadcast 10.3.1.255
    ether 00:17:fa:00:40:f2 txqueuelen 1000 (Ethernet)
     
    eth0:1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
    inet 10.3.1.7 netmask 255.255.255.0 broadcast 10.3.1.255
    ether 00:17:fa:00:40:f2 txqueuelen 1000 (Ethernet)
     
    lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
    inet 127.0.0.1 netmask 255.0.0.0
    inet6 ::1 prefixlen 128 scopeid 0x10<host>
    loop txqueuelen 1 (Local Loopback)
    RX packets 10 bytes 1078 (1.0 KiB)
    RX errors 0 dropped 0 overruns 0 frame 0
    TX packets 10 bytes 1078 (1.0 KiB)
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
     
    [root@hwvntp01 html]# ping www.sina.com.cn
    PING ara.sina.com.cn (121.14.1.190) 56(84) bytes of data.
    64 bytes from 121.14.1.190 (121.14.1.190): icmp_seq=1 ttl=51 time=45.7 ms
    64 bytes from 121.14.1.190 (121.14.1.190): icmp_seq=2 ttl=51 time=45.7 ms
    ^C
    --- ara.sina.com.cn ping statistics ---
    2 packets transmitted, 2 received, 0% 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 : 56(84) bytes of data.
    64 bytes from 121.14.1.190 (121.14.1.190): icmp_seq=1 ttl=53 time=48.4 ms
    64 bytes from 121.14.1.190 (121.14.1.190): icmp_seq=2 ttl=53 time=48.5 ms
    ^C
    --- ara.sina.com.cn ping statistics ---
    2 packets transmitted, 2 received, 0% 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 : 56(84) bytes of data.
    64 bytes from 121.14.1.190 (121.14.1.190): icmp_seq=1 ttl=51 time=46.3 ms
    64 bytes from 121.14.1.190 (121.14.1.190): icmp_seq=2 ttl=51 time=46.4 ms
    64 bytes from 121.14.1.190 (121.14.1.190): icmp_seq=3 ttl=51 time=46.1 ms
    64 bytes from 121.14.1.190 (121.14.1.190): icmp_seq=4 ttl=51 time=46.2 ms
    ^C
    --- ara.sina.com.cn ping statistics ---
    4 packets transmitted, 4 received, 0% 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 2017-04-14 08:49:38 UTC; 6s ago
    Docs: man:httpd(8)
    man:apachectl(8)
    Main PID: 14147 (httpd)

    从外部检测:

    三个地址都可以访问。

  • 相关阅读:
    Pycharm快捷键
    unittest自动化测试框架
    Python简介
    Git工作流介绍
    GitFlow ⼯作流
    go 整分钟开始执行程序
    vue 保留两位小数
    vue 格式化时间戳
    Supervisor-进程守护工具
    为什么计算机语言中的变量名都不能以数字开头呢?
  • 原文地址:https://www.cnblogs.com/hengwei/p/6709738.html
Copyright © 2020-2023  润新知