[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-8699?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16033198#comment-16033198
 ] 

Nicolas SCHWARTZ edited comment on CLOUDSTACK-8699 at 6/2/17 1:04 PM:
----------------------------------------------------------------------

The IP is always assigned to the last ethX device

The following file configures the ip addresses ips.json
{
    "eth0": [
        {
            "add": true, 
            "broadcast": "169.254.255.255", 
            "cidr": "169.254.2.168/16", 
            "device": "eth0", 
            "gateway": "None", 
            "netmask": "255.255.0.0", 
            "network": "169.254.0.0/16", 
            "nic_dev_id": "0", 
            "nw_type": "control", 
            "one_to_one_nat": false, 
            "public_ip": "169.254.2.168", 
            "size": "16", 
            "source_nat": false
        }
    ], 
    "eth1": [
        {
            "add": true, 
            "broadcast": "10.1.50.255", 
            "cidr": "10.1.50.67/24", 
            "device": "eth1", 
            "first_i_p": false, 
            "gateway": "10.1.50.1", 
            "netmask": "255.255.255.0", 
            "network": "10.1.50.0/24", 
            "new_nic": false, 
            "nic_dev_id": 1, 
            "nw_type": "public", 
            "one_to_one_nat": false, 
            "public_ip": "10.1.50.67", 
            "size": "24", 
            "source_nat": true, 
            "vif_mac_address": "06:ff:a8:00:01:c1"
        }
    ], 
    "eth2": [
        {
            "add": true, 
            "broadcast": "192.168.0.3", 
            "cidr": "192.168.0.1/30", 
            "device": "eth2", 
            "gateway": "192.168.0.1", 
            "netmask": "255.255.255.252", 
            "network": "192.168.0.0/30", 
            "nic_dev_id": "2", 
            "nw_type": "guest", 
            "one_to_one_nat": false, 
            "public_ip": "192.168.0.1", 
            "size": "30", 
            "source_nat": false
        }, 
        {
            "add": false, 
            "broadcast": "10.1.50.255", 
            "cidr": "10.1.50.68/24", 
            "device": "eth2", 
            "first_i_p": false, 
            "gateway": "10.1.50.1", 
            "netmask": "255.255.255.0", 
            "network": "10.1.50.0/24", 
            "new_nic": false, 
            "nic_dev_id": 2, 
            "nw_type": "public", 
            "one_to_one_nat": true, 
            "public_ip": "10.1.50.68", 
            "size": "24", 
            "source_nat": false, 
            "vif_mac_address": "06:ff:a8:00:01:c1"
        }, 
        {
            "add": false, 
            "broadcast": "10.1.50.255", 
            "cidr": "10.1.50.66/24", 
            "device": "eth2", 
            "first_i_p": false, 
            "gateway": "10.1.50.1", 
            "netmask": "255.255.255.0", 
            "network": "10.1.50.0/24", 
            "new_nic": false, 
            "nic_dev_id": 2, 
            "nw_type": "public", 
            "one_to_one_nat": true, 
            "public_ip": "10.1.50.66", 
            "size": "24", 
            "source_nat": false, 
            "vif_mac_address": "06:ff:a8:00:01:c1"
        }
    ], 
    "id": "ips"

And as you can see the mac address is correctly attributed for eth1 but eth2 is 
wrong for the two publics IPs. If I have correctly understood CloudStack 
architecture GSon is generated by the manager running in the tomcat server. So 
virtual scripts for the VPC are ok.


was (Author: aurryon):
The IP is always assigned to the last ethX device

> Extra acquired public ip is assigned to wrong eth device
> --------------------------------------------------------
>
>                 Key: CLOUDSTACK-8699
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-8699
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>          Components: Virtual Router
>    Affects Versions: 4.4.4
>         Environment: KVM on CentOS
>            Reporter: Remi Bergsma
>
> When the public network of a zone is untagged, an extra public ip address is 
> bound to the wrong interface (eth2 instead of eth1).
> Example:
> root@r-44137-VM:~# ip a
> 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
>     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
>     inet 127.0.0.1/8 scope host lo
> 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP 
> qlen 1000
>     link/ether 0e:00:a9:fe:01:eb brd ff:ff:ff:ff:ff:ff
>     inet 169.254.1.235/16 brd 169.254.255.255 scope global eth0
> 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP 
> qlen 1000
>     link/ether 06:46:32:00:00:8d brd ff:ff:ff:ff:ff:ff
>     inet xx.22.37.143/25 brd 85.222.237.255 scope global eth1
> 4: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP 
> qlen 1000
>     link/ether 02:00:51:27:00:02 brd ff:ff:ff:ff:ff:ff
>     inet 10.0.0.1/24 brd 10.0.0.255 scope global eth2
>     inet xx.22.37.145/25 brd 85.222.237.255 scope global eth2
> Obviously, this does not work.
> # MGT server
> 2015-07-31 13:08:12,330 DEBUG [agent.manager.ClusteredAgentAttache] 
> (API-Job-Executor-98:ctx-cbf1e352 job-799791 ctx-58cb236f) Seq 
> 437-2425751349292433542: Forwarding Seq 437-2425751349292433542:  { Cmd , 
> MgmtId: 345052433506, via: 
> 437(mccxpod01-hv03.mccxpod01.mccx-shared-2.mccx.mcinfra.net), Ver: v1, Flags: 
> 100001, 
> [{"com.cloud.agent.api.routing.SetPortForwardingRulesVpcCommand":{"rules":[{"dstIp":"10.0.0.61","dstPortRange":[22,22],"id":54859,"srcIp":"xx.22.37.145","protocol":"tcp","srcPortRange":[22,22],"revoked":false,"alreadyAdded":false,"purpose":"PortForwarding","defaultEgressPolicy":false}],"accessDetails":{"zone.network.type":"Advanced","router.name":"r-44137-VM","router.ip":"169.254.1.235","router.guest.ip":"10.0.0.1"},"wait":0}}]
>  } to 345052433504
> 2015-07-31 13:08:12,457 DEBUG [agent.transport.Request] 
> (AgentManager-Handler-58:null) Seq 437-2425751349292433542: Processing:  { 
> Ans: , MgmtId: 345052433506, via: 437, Ver: v1, Flags: 0, 
> [{"com.cloud.agent.api.Answer":{"result":true,"details":"","wait":0}}] }
> 2015-07-31 13:08:12,457 DEBUG [agent.transport.Request] 
> (API-Job-Executor-98:ctx-cbf1e352 job-799791 ctx-58cb236f) Seq 
> 437-2425751349292433542: Received:  { Ans: , MgmtId: 345052433506, via: 437, 
> Ver: v1, Flags: 0, { Answer } }
> # AGENT
> 2015-07-31 13:08:12,203 DEBUG [cloud.agent.Agent] 
> (agentRequest-Handler-4:null) Request:Seq 437-2425751349292433541:  { Cmd , 
> MgmtId: 345052433506, via: 437, Ver: v1, Flags: 100001, 
> [{"com.cloud.agent.api.rout
> ing.IpAssocVpcCommand":{"ipAddresses":[{"accountId":625,"publicIp":"xx.22.37.145","sourceNat":false,"add":true,"oneToOneNat":false,"firstIP":false,"broadcastUri":"vlan://untagged","vlanGateway":"xx.22.37.1
> 29","vlanNetmask":"255.255.255.128","vifMacAddress":"06:46:32:00:00:8d","networkRate":-1,"trafficType":"Public","networkName":"pubbr0","newNic":false}],"accessDetails":{"router.guest.ip":"xx.22.37.143","zone
> .network.type":"Advanced","router.ip":"169.254.1.235","router.name":"r-44137-VM"},"wait":0}}]
>  }
> 2015-07-31 13:08:12,204 DEBUG [cloud.agent.Agent] 
> (agentRequest-Handler-4:null) Processing command: 
> com.cloud.agent.api.routing.IpAssocVpcCommand
> 2015-07-31 13:08:12,206 DEBUG [kvm.resource.LibvirtComputingResource] 
> (agentRequest-Handler-4:null) Executing: 
> /usr/share/cloudstack-common/scripts/network/domr/router_proxy.sh 
> vpc_ipassoc.sh 169.254.1.235  -A
>   -l xx.22.37.145 -c eth2 -g xx.22.37.129 -m 25 -n xx.22.37.128
> As you see, the vpc_assoc.sh script is instructed to use the wrong eth 
> interface.
> See also:
> core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
> api/src/com/cloud/agent/api/to/IpAddressTO.java



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to