Ask Your Question
0

How to create a router to connect 2 subnets? [closed]

asked 2014-12-09 22:35:31 -0600

teju gravatar image

updated 2014-12-10 02:13:38 -0600

SamYaple gravatar image

I have created 2 networks,2 subnets and 2 ports as below:

neutron net-create test1;
neutron subnet-create --name subnet1_test1 test1 192.168.0.0/24;
neutron port-create test1 --binding:profile type=dict vnic_type=hostdev;
neutron net-create test2;
neutron subnet-create --name subnet1_test2 test2 192.168.1.0/24;
neutron port-create test2 --binding:profile type=dict vnic_type=hostdev;

I've booted 2 instances,one in network test1 and other in network test2

The 2 instances cannot ping each other since they are in a different subnet.

How to create a router to make the instances ping each other?

Please specify the commands if possible, else provide links.

Please specify if we have to add any security group rules.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by teju
close date 2014-12-10 23:08:49.693674

4 answers

Sort by ยป oldest newest most voted
0

answered 2014-12-10 22:38:12 -0600

teju gravatar image

Here are the list of all commands I've used to make the instances on 2 different networks ping each other:

  1. Create networks, subnets,router,ports

neutron net-create net1 neutron subnet-create net1 10.0.0.0/24 neutron net-create net2 neutron subnet-create net2 10.0.1.0/24 neutron router-create router1

neutron router-interface-add router1 SUBNET1_UUID neutron router-interface-add router1 SUBNET2_UUID

neutron port-create net1 --binding:profile type=dict vnic_type=hostdev neutron port-create net2 --binding:profile type=dict vnic_type=hostdev

  1. Create br-ex and bind a port to it.

ovs-vsctl add-br br-ex ovs-vsctl add-port br-ex em2

  1. As soon as em2 is added as port to br-ex, em2 loses it's IP. So, run below commands to move IP to br-ex

ifconfig em2 0.0.0.0 ifconfig br-ex 192.168.10.4

  1. Create external network and subnet

neutron net-create ext-net --shared --router:external=True neutron subnet-create ext-net --name ext-subnet --allocation-pool start=192.168.10.101,end=192.168.10.200 --disable-dhcp --gateway 192.168.10.1 192.168.10.0/24

  1. Launch 2 instances

nova boot --flavor 5 --image centos6.4 centos6.4_1 --nic port-id=<port id="" 1=""> nova boot --flavor 5 --image centos6.4 centos6.4_2 --nic port-id=<port id="" 2="">

edit flag offensive delete link more
2

answered 2014-12-10 02:30:01 -0600

SamYaple gravatar image

The last command with allow ping traffic to and from both networks you listed if you are using the default security group.

neutron router-create router_test1
neutron router-interface-add <router-id> subnet1_test1
neutron router-interface-add <router-id> subnet1_test2

nova secgroup-add-rule default icmp -1 -1 192.168.0.0/24
nova secgroup-add-rule default icmp -1 -1 192.168.1.0/24
edit flag offensive delete link more

Comments

Hi. The instances could not ping each other even after adding the security rules. Please help me debug this issue.

teju gravatar imageteju ( 2014-12-10 03:07:32 -0600 )edit
1

answered 2014-12-10 00:25:20 -0600

updated 2014-12-10 02:13:55 -0600

SamYaple gravatar image
neutron router-create router1
neutron router-gateway-set ROUTER NETWORK
neutron router-interface-add ROUTER SUBNET
edit flag offensive delete link more
1

answered 2014-12-09 23:26:01 -0600

pramdoyal gravatar image

Hi Teju,

The link below will provide you step by step commands to follow to create a router and connect the 2 subnets.

https://blogs.oracle.com/ronen/entry/...

Thanks Prakash

edit flag offensive delete link more

Comments

Hi Prakash,

Thanks for the reply.

I created a router, but it's namespace is not created. As per the instructions in the link, the command ip netns list should have an entry like qrouter-<router-id>.

But, I don't see the entry for the new router

teju gravatar imageteju ( 2014-12-10 00:17:11 -0600 )edit

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2014-12-09 22:35:31 -0600

Seen: 4,437 times

Last updated: Dec 10 '14