Ask Your Question
0

[Heat]How to link multiple routers in heat template?

asked 2014-12-23 04:29:57 -0500

Shweta Rao gravatar image

updated 2014-12-24 01:13:30 -0500

9lives gravatar image

Hi All

I am working on openstack Heat and i wanted to make below attached topology using heat template :


Router 1

    |
    |

Subnet 1

    |
    |

Network 1

! ! ! ! ! ! ! ! ! vm1 vm1 vm1


Router 2

    |
    |

Subnet 2

    |
    |

Network 2

! ! ! ! ! ! ! ! ! vm2 vm2 vm2

The topology have two routers having different subnets having diferent networks and instances is attached to their respective networks. I cannot figure out how can i connect two routers as even on internet i didnot get any example template having multiple routers topology?

I want to connect both the routers and have link between both the routers.

So i make two subnets each for a network and assigned interface on both routers, such that one interface on each have same router but different subnets. Example :

heat_router_int0:
    Properties:
      router_id: {Ref: heat_router_01}
      subnet_id: {Ref: heat_subnet_01}

heat_router_int2:
    Properties:
      router_id: {Ref: heat_router_01}
      subnet_id: {Ref: heat_subnet_02}

The template which i am using is given below :

AWSTemplateFormatVersion: '2010-09-09'
Description: Sample Heat template that spins up multiple instances and a private network
  (JSON)
Resources:
  heat_network_01:
    Properties: {name: heat-network-01}
    Type: OS::Neutron::Net
  heat_network_02:
    Properties: {name: heat-network-02}
    Type: OS::Neutron::Net
  heat_router_01:
    Properties: {admin_state_up: 'True', name: heat-router-01}
    Type: OS::Neutron::Router
  heat_router_02:
    Properties: {admin_state_up: 'True', name: heat-router-02}
    Type: OS::Neutron::Router
  heat_router_int0:
    Properties:
      router_id: {Ref: heat_router_01}
      subnet_id: {Ref: heat_subnet_01}
    Type: OS::Neutron::RouterInterface
  heat_router_int1:
    Properties:
      router_id: {Ref: heat_router_02}
      subnet_id: {Ref: heat_subnet_02}
    Type: OS::Neutron::RouterInterface
  heat_router_int2:
    Properties:
      router_id: {Ref: heat_router_01}
      subnet_id: {Ref: heat_subnet_02}
    Type: OS::Neutron::RouterInterface
  heat_router_int3:
    Properties:
      router_id: {Ref: heat_router_02}
      subnet_id: {Ref: heat_subnet_01}
    Type: OS::Neutron::RouterInterface
  heat_subnet_01:
    Properties:
      cidr: 10.10.10.0/24
      dns_nameservers: [172.16.1.11, 172.16.1.6]
      enable_dhcp: 'True'
      gateway_ip: 10.10.10.254
      name: heat-subnet-01
      network_id: {Ref: heat_network_01}
    Type: OS::Neutron::Subnet
  heat_subnet_02:
    Properties:
      cidr: 10.10.11.0/24
      dns_nameservers: [172.16.1.11, 172.16.1.6]
      enable_dhcp: 'True'
      gateway_ip: 10.10.11.254
      name: heat-subnet-01
      network_id: {Ref: heat_network_02}
    Type: OS::Neutron::Subnet
  instance0:
    Properties:
      flavor: m1.nano
      image: cirros-0.3.2-x86_64-uec
      name: heat-instance-01
      networks:
      - port: {Ref: instance0_port0}
    Type: OS::Nova::Server
  instance0_port0:
    Properties:
      admin_state_up: 'True'
      network_id: {Ref: heat_network_01}
    Type: OS::Neutron::Port
  instance1:
    Properties:
      flavor: m1.nano
      image: cirros-0.3.2-x86_64-uec
      name: heat-instance12-02
      networks:
      - port: {Ref: instance12_port0}
    Type: OS::Nova::Server
  instance11:
    Properties:
      flavor: m1.nano
      image: cirros-0.3.2-x86_64-uec
      name: heat-instance11-01
      networks:
      - port: {Ref: instance11_port0}
    Type: OS::Nova::Server
  instance11_port0:
    Properties:
      admin_state_up: 'True'
      network_id: {Ref: heat_network_02}
    Type: OS::Neutron::Port
  instance12_port0:
    Properties:
      admin_state_up: 'True'
      network_id: {Ref: heat_network_02}
    Type: OS::Neutron::Port
  instance1_port0:
    Properties:
      admin_state_up: 'True'
      network_id: {Ref: heat_network_01}
    Type: OS::Neutron::Port

I am able to create topology using the template but i am not able to connect two routers.

The error is shown in heat_router_int0 :

Create FailedResource Create Failed: Ipaddressinuseclient: Unable To Complete Operation For Network 2870ec2e-5b89-43b2-9f9f-396cad53ed49. The Ip Address 10.10.10.254 Is In Use.

Neither i can get a template example on internet through which i can connect two routers. Can you please help me with :

1.) Can we connect two routers? Does the configuration :

heat_router_int2:
    Properties:
      router_id: {Ref: heat_router_01}
      subnet_id: {Ref: heat_subnet_02 ...
(more)
edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2014-12-24 01:08:08 -0500

http://docs.openstack.org/havana/conf...

go through the link it has all the steps , create a template based on it.

edit flag offensive delete link more
0

answered 2015-01-02 03:09:48 -0500

Shweta Rao gravatar image

Hi All

Rishi thanks for the reply.

I have made the topology for the same as per as the link you shared . The template is as follows :

AWSTemplateFormatVersion: '2010-09-09' Description: Sample Heat template that spins up multiple instances and a private network (JSON) Resources: heat_router1_int0: Properties: router_id: {Ref: heat_router_01} subnet_id: {Ref: subnet_01} Type: OS::Neutron::RouterInterface heat_router2_int0: Properties: router_id: {Ref: heat_router_02} subnet_id: {Ref: subnet_02} Type: OS::Neutron::RouterInterface heat_router_01: Properties: {admin_state_up: 'True', name: heat-router-01} Type: OS::Neutron::Router heat_router_01_gw: Properties: network_id: 8b75af70-5b4a-40db-b0e3-c837eb9e2688 router_id: {Ref: heat_router_01} Type: OS::Neutron::RouterGateway heat_router_02: Properties: {admin_state_up: 'True', name: heat-router-02} Type: OS::Neutron::Router heat_router_02_gw: Properties: network_id: 8b75af70-5b4a-40db-b0e3-c837eb9e2688 router_id: {Ref: heat_router_02} Type: OS::Neutron::RouterGateway instance0_port0: Properties: admin_state_up: 'True' network_id: {Ref: network_01} Type: OS::Neutron::Port instance1: Properties: flavor: m1.nano image: cirros-0.3.2-x86_64-uec name: heat-instance12-02 networks: - port: {Ref: instance0_port0} Type: OS::Nova::Server instance1_port0: Properties: admin_state_up: 'True' network_id: {Ref: network_02} Type: OS::Neutron::Port instance2: Properties: flavor: m1.nano image: cirros-0.3.2-x86_64-uec name: heat-instance12-021 networks: - port: {Ref: instance1_port0} Type: OS::Nova::Server network_01: Properties: {name: network-01} Type: OS::Neutron::Net network_02: Properties: {name: network-02} Type: OS::Neutron::Net subnet_01: Properties: cidr: 192.168.1.0/24 enable_dhcp: 'True' name: subnet-01 network_id: {Ref: network_01} Type: OS::Neutron::Subnet subnet_02: Properties: cidr: 192.168.2.0/24 enable_dhcp: 'True' name: subnet-02 network_id: {Ref: network_02} Type: OS::Neutron::Subnet

I have made two routers with different subnets with 192.168.1.0/24 and 192.168.2.0/24 ips which is connected to public network. I can see the topology in network topology but i am not able to ping the instances of different network that is i am not able to ping 192.168.1.1 --------------------public---------------------- 192.168.2.1 network.

Can you please guide me how can reach other vm or ping instances with each other.

Thanks

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2014-12-23 04:29:57 -0500

Seen: 1,272 times

Last updated: Jan 02 '15