Custom Search

Thursday, May 28, 2015

OpenStack neutron CLI create security group rule

1)
$ neutron security-group-rule-list

+--------------------------------------+----------------+-----------+-----------+---------------+------------------+
| id                                   | security_group | direction | ethertype | protocol/port | remote           |
+--------------------------------------+----------------+-----------+-----------+---------------+------------------+
| 16c7a0ac-535d-46e3-b8d6-3523c019c75a | default        | ingress   | IPv4      | any           | default (group)  |
| ff4ecda8-9922-41f7-ac17-d698f57947ce | default        | egress    | IPv4      | any           | 0.0.0.0/0 (CIDR) |
+--------------------------------------+----------------+-----------+-----------+---------------+------------------+


2)
#neutron security-group-rule-create --direction ingress --protocol icmp default


Created a new security_group_rule:
+-------------------+--------------------------------------+
| Field             | Value                                |
+-------------------+--------------------------------------+
| direction         | ingress                              |
| ethertype         | IPv4                                 |
| id                | 7eb73c63-9a43-4e32-8293-d6f9c307688e |
| port_range_max    | 65535                                |
| port_range_min    | 0                                    |
| protocol          | icmp                                 |
| remote_group_id   |                                      |
| remote_ip_prefix  |                                      |
| security_group_id | 6ebb5c26-9448-4479-96de-1bc40a41a806 |
| tenant_id         | c216189f65a64175b12bd99b22a60336     |
+-------------------+--------------------------------------+


3)
$ neutron security-group-rule-list

+--------------------------------------+----------------+-----------+-----------+---------------------------+------------------+
| id                                   | security_group | direction | ethertype | protocol/port             | remote           |
+--------------------------------------+----------------+-----------+-----------+---------------------------+------------------+
| 16c7a0ac-535d-46e3-b8d6-3523c019c75a | default        | ingress   | IPv4      | any                       | default (group)  |
| ff4ecda8-9922-41f7-ac17-d698f57947ce | default        | egress    | IPv4      | any                       | 0.0.0.0/0 (CIDR) |
| 7eb73c63-9a43-4e32-8293-d6f9c307688e | default        | ingress   | IPv4      | icmp (type:0, code:65535) | any              |
+--------------------------------------+----------------+-----------+-----------+---------------------------+------------------+

4)
Add SSH rule
#neutron security-group-rule-create --protocol tcp --port-range-min 22 --port-range-max 22 mysecgrp1
Created a new security_group_rule:
+-------------------+--------------------------------------+
| Field             | Value                                |
+-------------------+--------------------------------------+
| direction         | ingress                              |
| ethertype         | IPv4                                 |
| id                | ade31f1b-62f4-408d-8be1-cda6c1e97773 |
| port_range_max    | 22                                   |
| port_range_min    | 22                                   |
| protocol          | tcp                                  |
| remote_group_id   |                                      |
| remote_ip_prefix  |                                      |
| security_group_id | db9123f9-5491-47db-a996-3fd5818f880d |
| tenant_id         | c216189f65a64175b12bd99b22a60336     |
+-------------------+--------------------------------------+


Wednesday, May 27, 2015

sudo apt-get update E: Some index files failed to download. They have been ignored, or old ones used instead.

===========#sudo apt-get update, Error==========

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/saucy/main/source/Sources  404  Not Found [IP: 91.189.91.24 80]

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/saucy/restricted/source/Sources  404  Not Found [IP: 91.189.91.24 80]

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/saucy/universe/source/Sources  404  Not Found [IP: 91.189.91.24 80]

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/saucy/multiverse/source/Sources  404  Not Found [IP: 91.189.91.24 80]

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/saucy/main/binary-amd64/Packages  404  Not Found [IP: 91.189.91.24 80]

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/saucy/restricted/binary-amd64/Packages  404  Not Found [IP: 91.189.91.24 80]

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/saucy/universe/binary-amd64/Packages  404  Not Found [IP: 91.189.91.24 80]

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/saucy/multiverse/binary-amd64/Packages  404  Not Found [IP: 91.189.91.24 80]

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/saucy/main/binary-i386/Packages  404  Not Found [IP: 91.189.91.24 80]

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/saucy/restricted/binary-i386/Packages  404  Not Found [IP: 91.189.91.24 80]

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/saucy/universe/binary-i386/Packages  404  Not Found [IP: 91.189.91.24 80]

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/saucy/multiverse/binary-i386/Packages  404  Not Found [IP: 91.189.91.24 80]

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/saucy-updates/main/source/Sources  404  Not Found [IP: 91.189.91.24 80]

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/saucy-updates/restricted/source/Sources  404  Not Found [IP: 91.189.91.24 80]

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/saucy-updates/universe/source/Sources  404  Not Found [IP: 91.189.91.24 80]

E: Some index files failed to download. They have been ignored, or old ones used instead.


======Fix======


Replace http://archive.ubuntu.com/ with http://old-releases.ubuntu.com in /etc/apt/sources.list


#sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

#sudo apt-get update





Tuesday, May 26, 2015

How To GitHub delete a commit

1)
Clone the repo to your machine.
#git clone https://github.com/sajuptpm/tools.git

2)
Find ID of the commit which comes just before the commit which you want to delete.
You can use the command "#git log -n 10" for that.

3)
Then use this command:
#git rebase -i commit_id

Your text editor will open with a file that lists all the commits which come after your selected commit_id, and in front of each commit there is the word "pick".

In that list remove the commit which you want to delete and save it.

 4)
Force-push to remote repo.

#git push -f origin master

5)
Check github. It should be updated



How To GitHub change commit message

1)
Clone the repo to your machine.
#git clone https://github.com/sajuptpm/tools.git

2)
Find ID of the commit which comes just before the commit for which you want to change the message.
You can use the command "#git log -n 10" for that.

3)
Then use this command:
#git rebase -i commit_id

Your text editor will open with a file that lists all the commits which come after your selected commit_id, and in front of each commit there is the word "pick".

The commit for which you want to change the commit message, change "pick" to "reword" and save it.

Then a new file should pop up in your editor.There you can change the commit message and save it

4)
Force-push to remote repo.

#git push -f origin master

5)
Check github. It should be updated.


Saturday, May 23, 2015

Wednesday, May 20, 2015

How to post html code in your blog

1)
Goto following site and paste your html code and copy the encoded html
http://www.dan.co.jp/cases/javascript/encode_entities.html

2)
Paste encoded html in your blog inside the <pre> </pre> tag




Tuesday, May 19, 2015

fatal error: pcap.h: No such file or directory

Fix:
=====

#sudo apt-get install libpcap0.8-dev

OR

#wget http://mirror.esc7.net/pub/Ubuntu/pool/main/libp/libpcap/libpcap0.8-dev_1.4.0-2_amd64.deb

#sudo gdebi libpcap0.8-dev_1.4.0-2_amd64.deb

Contrail Analytics APIs and User Visible Entities (UVEs)

0)
http://192.168.56.102:8081/analytics/uves

[{'href': 'http://192.168.56.102:8081/analytics/uves/service-chains',
  'name': 'service-chains'},
 {'href': 'http://192.168.56.102:8081/analytics/uves/config-nodes',
  'name': 'config-nodes'},
 {'href': 'http://192.168.56.102:8081/analytics/uves/storage-pools',
  'name': 'storage-pools'},
 {'href': 'http://192.168.56.102:8081/analytics/uves/xmpp-peers',
  'name': 'xmpp-peers'},
 {'href': 'http://192.168.56.102:8081/analytics/uves/vrouters',
  'name': 'vrouters'},
 {'href': 'http://192.168.56.102:8081/analytics/uves/generators',
  'name': 'generators'},
 {'href': 'http://192.168.56.102:8081/analytics/uves/service-instances',
  'name': 'service-instances'},
 {'href': 'http://192.168.56.102:8081/analytics/uves/bgp-peers',
  'name': 'bgp-peers'},
 {'href': 'http://192.168.56.102:8081/analytics/uves/analytics-nodes',
  'name': 'analytics-nodes'},
 {'href': 'http://192.168.56.102:8081/analytics/uves/virtual-networks',
  'name': 'virtual-networks'},
 {'href': 'http://192.168.56.102:8081/analytics/uves/control-nodes',
  'name': 'control-nodes'},
 {'href': 'http://192.168.56.102:8081/analytics/uves/databases',
  'name': 'databases'},
 {'href': 'http://192.168.56.102:8081/analytics/uves/virtual-machines',
  'name': 'virtual-machines'},
 {'href': 'http://192.168.56.102:8081/analytics/uves/storage-osds',
  'name': 'storage-osds'},
 {'href': 'http://192.168.56.102:8081/analytics/uves/servers',
  'name': 'servers'},
 {'href': 'http://192.168.56.102:8081/analytics/uves/dns-nodes',
  'name': 'dns-nodes'},
 {'href': 'http://192.168.56.102:8081/analytics/uves/storage-disks',
  'name': 'storage-disks'}]



1)
OpenContrail find NodeStatus,ConfigCpuState and  ModuleCpuState of Config Node

http://192.168.56.102:8081/analytics/uves/config-nodes
http://192.168.56.102:8081/analytics/uves/config-node/ubuntu
http://192.168.56.102:8081/analytics/uves/config-node/ubuntu?cfilt=NodeStatus
http://192.168.56.102:8081/analytics/uves/config-node/ubuntu?cfilt=ConfigCpuState
http://192.168.56.102:8081/analytics/uves/config-node/ubuntu?cfilt=ModuleCpuState









2)
http://192.168.56.102:8081/analytics/uves/xmpp-peers
http://192.168.56.102:8081/analytics/uves/xmpp-peer/ubuntu:192.168.56.102
http://192.168.56.102:8081/analytics/uves/xmpp-peer/ubuntu:192.168.56.102?cfilt=XmppPeerInfoData




3)
http://192.168.56.102:8081/analytics/uves/vrouters
http://192.168.56.102:8081/analytics/uves/vrouter/ubuntu
http://192.168.56.102:8081/analytics/uves/vrouter/ubuntu?cfilt=VrouterStatsAgent
http://192.168.56.102:8081/analytics/uves/vrouter/ubuntu?cfilt=NodeStatus
http://192.168.56.102:8081/analytics/uves/vrouter/ubuntu?cfilt=VrouterAgent
http://192.168.56.102:8081/analytics/uves/vrouter/ubuntu?cfilt=ComputeCpuState








4)
http://192.168.56.102:8081/analytics/uves/analytics-nodes
http://192.168.56.102:8081/analytics/uves/analytics-node/ubuntu?cfilt=NodeStatus
http://192.168.56.102:8081/analytics/uves/analytics-node/ubuntu?cfilt=AnalyticsCpuState
http://192.168.56.102:8081/analytics/uves/analytics-node/ubuntu?cfilt=ModuleCpuState
http://192.168.56.102:8081/analytics/uves/analytics-node/ubuntu?cfilt=QueryPerfInfo
http://192.168.56.102:8081/analytics/uves/analytics-node/ubuntu?cfilt=CollectorState

5)
http://192.168.56.102:8081/analytics/uves/virtual-networks
http://192.168.56.102:8081/analytics/uves/virtual-network/default-domain:default-project:default-virtual-network

6)
http://192.168.56.102:8081/analytics/uves/control-nodes
http://192.168.56.102:8081/analytics/uves/control-node/ubuntu
http://192.168.56.102:8081/analytics/uves/control-node/ubuntu?cfilt=NodeStatus
http://192.168.56.102:8081/analytics/uves/control-node/ubuntu?cfilt=BgpRouterState
http://192.168.56.102:8081/analytics/uves/control-node/ubuntu?cfilt=ControlCpuState

7)
http://192.168.56.102:8081/analytics/uves/databases
http://192.168.56.102:8081/analytics/uves/database/ubuntu

8)
http://192.168.56.102:8081/analytics/uves/virtual-machines
http://192.168.56.102:8081/analytics/uves/virtual-machine/6767c744-3f47-458a-b61f-0bde1b5f10d9
http://192.168.56.102:8081/analytics/uves/virtual-machine/6767c744-3f47-458a-b61f-0bde1b5f10d9?cfilt=VirtualMachineStats
http://192.168.56.102:8081/analytics/uves/virtual-machine/6767c744-3f47-458a-b61f-0bde1b5f10d9?cfilt=UveVirtualMachineAgent

9)
http://192.168.56.102:8081/analytics/uves/dns-nodes
http://192.168.56.102:8081/analytics/uves/dns-node/ubuntu

10)
http://192.168.56.102:8081/analytics/uves/storage-disks

11)
http://192.168.56.102:8081/analytics/uves/servers

12)
http://192.168.56.102:8081/analytics/uves/storage-osds

13)
http://192.168.56.102:8081/analytics/uves/service-chains

14)
http://192.168.56.102:8081/analytics/uves/storage-pools

15)
http://192.168.56.102:8081/analytics/uves/generators

16)
http://192.168.56.102:8081/analytics/uves/service-instances

17)
http://192.168.56.102:8081/analytics/uves/bgp-peers

Monday, May 18, 2015

Linux add and delete route with gateway

1)
Add default gateway
$route add default gw 10.1.0.1

2)
Delete default gateway
$route add default gw 10.1.0.1

3)
Add new route with gateway
$route add -net 10.3.0.0 netmask 255.255.255.0 gw 10.1.0.1


4)
Delete route with gateway
$route add -net 10.3.0.0 netmask 255.255.255.0 gw 10.1.0.1


Friday, May 15, 2015

OpenStack Create a VM in a selected subnet


Create a VM in selected subnet using IP in that subnet
#nova boot --flavor 1 --image e489afe7-add9-414e-9349-bfa737f02b73 --security-groups 989a351c-9448-4b52-a14f-3eb49ccb33ed --nic net-id=aeaf3661-cded-408f-9210-6917a6a60b87,v4-fixed-ip=10.2.2.10 sa-vm1

* Here VM goes to the subnet which has IP 10.2.2.10


Thursday, May 14, 2015

How to run Linux commands from within Vim

1)
Execute {command} with a shell
:!

Syntax:
:!{command}






2)
Start a shell
:shell

Syntax:
:sh[ell]









Thursday, May 7, 2015

OpenStack OpenContrail Create External Public Network via CLI


1)
Create External Network
$ neutron net-create public1 --router:external=True


Create External shared network
$ neutron net-create public2 --router:external=True --shared


2)
Create Subnet
$neutron subnet-create public1 11.1.1.1/24














OpenContrail VNC API - List of Properties of Project object

['__class__',
 '__delattr__',
 '__dict__',
 '__doc__',
 '__format__',
 '__getattribute__',
 '__hash__',
 '__init__',
 '__module__',
 '__new__',
 '__reduce__',
 '__reduce_ex__',
 '__repr__',
 '__setattr__',
 '__sizeof__',
 '__str__',
 '__subclasshook__',
 '__weakref__',
 '_display_name',
 '_id_perms',
 '_pending_field_updates',
 '_pending_ref_updates',
 '_quota',
 '_serialize_field_to_json',
 '_server_conn',
 '_type',
 '_uuid',
 'add_floating_ip_pool',
 'add_namespace',
 'backref_fields',
 'children_fields',
 'clear_pending_updates',
 'create_uri',
 'del_floating_ip_pool',
 'del_namespace',
 'display_name',
 'dump',
 'fq_name',
 'from_dict',
 'get_display_name',
 'get_domain_back_refs',
 'get_floating_ip_back_refs',
 'get_floating_ip_pool_refs',
 'get_fq_name',
 'get_fq_name_str',
 'get_id_perms',
 'get_interface_route_tables',
 'get_loadbalancer_healthmonitors',
 'get_loadbalancer_pools',
 'get_logical_routers',
 'get_namespace_refs',
 'get_network_ipams',
 'get_network_policys',

 'get_parent_fq_name',
 'get_parent_fq_name_str',
 'get_pending_updates',
 'get_quota',
 'get_ref_updates',
 'get_route_tables',
 'get_security_groups',
 'get_service_instances',
 'get_type',
 'get_uuid',
 'get_virtual_ips',
 'get_virtual_machine_interfaces',
 'get_virtual_networks',

 'id_perms',
 'name',
 'parent_name',
 'parent_type',
 'parent_uuid',
 'prop_fields',
 'quota',
 'ref_fields',
 'resource_uri_base',
 'serialize_to_json',
 'set_display_name',
 'set_floating_ip_pool',
 'set_floating_ip_pool_list',
 'set_id_perms',
 'set_namespace',
 'set_namespace_list',
 'set_quota',
 'set_server_conn',
 'set_uuid',
 'uuid']

Wednesday, May 6, 2015

Calculate cidr and Number of Subnets


http://doc.m0n0.ch/quickstartpc/intro-CIDR.html

http://www.oav.net/mirrors/cidr.html

http://www.aelius.com/njh/subnet_sheet.html <==IMP

1)
* For cidr:/29 -- we can create 32 Subnets -- 6 Hosts per Subnet
* So, you can create 32 subnets with cidr:/19 like
   - 12.12.12.0/29
   - 12.12.12.8/29
   - 12.12.12.16/29
   - 12.12.12.24/29
     .......
     .......

   - 12.12.12.240/29
   - 12.12.12.248/29

* That is increment by 8 to create new subnets.

*  8 is IP range and we can calculate it from position of first 1 from the right, like.

* cidr:/29 means 29 1s, that is
                                                           8421
11111111 11111111 11111111 11111000

2)
* For cidr:/28 -- we can create 16 Subnets -- 14 Hosts per Subnet
* cidr:/28 means 28 1s, that is
                                                        168421
11111111 11111111 11111111 11110000

* Increment by 16 to create new subnets like.
   - 12.12.12.0/28
   - 12.12.12.16/28
   - 12.12.12.32/28







Tuesday, May 5, 2015

what is the difference between address-family ipv4 and vpnv4?

we always accept and forward ip packets to customers, for this we need to use ipv4 address-family.

When the customers packets are being received by PE (Provider Edge) they become labeled one and to forward labeled packets to different PE/RR; address-family vpnv4 is required.

In short we can say that ipv4 address-family is being used for customers and vpnv4 address-family is used by SP (Service Provider) core.

OpenContrail API list all Virtual machines, find their interfaces and associated floating ip and floating ip pool

a)
List all Virtual machines

#curl -s -H "X-Auth-Token: $(keystone token-get | awk '/ id / {print $4}')" 192.168.56.102:8082/virtual-machines | python -mjson.tool

b)
Show detail of a Virtial Machine and find it's virtual machine interfaces.

#curl -s -H "X-Auth-Token: $(keystone token-get | awk '/ id / {print $4}')" 192.168.56.102:8082/virtual-machine/379b51c9-ff9a-4585-a92b-107069edbfed | python -mjson.tool

c)
Show detail of a Virtial Machine Interface

#curl -s -H "X-Auth-Token: $(keystone token-get | awk '/ id / {print $4}')" 192.168.56.102:8082/virtual-machine-interface/b6e27360-b6ea-41fe-9686-1be695b1eac7 | python -mjson.tool

You will get following details:
* floating-ip attached to the interface
    - http://192.168.56.102:8082/floating-ip/3bebdc3c-6663-4945-8f6e-8f7e436c82b6
* instance-ip/private-ip attached to the interface
    - http://192.168.56.102:8082/instance-ip/e3174033-70bd-4c1a-bd3b-85b9f29d5371
* project/tenant
    - http://192.168.56.102:8082/project/f2714474-e74e-4b79-a6c5-1ab6022c6bac
* routing-instance. Interface belogs to which routing instance
    - http://192.168.56.102:8082/routing-instance/0a5d30fc-80c8-4248-8796-22dddcf6eb0c
* Security groups attached to the Interface
    - http://192.168.56.102:8082/security-group/8b3d2cd4-be86-405a-b189-c88515febb5a
* virtual-machine, interface belongs to which virtual-machine
    - http://192.168.56.102:8082/virtual-machine/379b51c9-ff9a-4585-a92b-107069edbfed
* virtual-network, interface belongs to which virtual-network
    - http://192.168.56.102:8082/virtual-network/a35745a8-64c7-40f0-a677-dfb666e4463a

d)
Show detail of a floating IP

#curl -s -H "X-Auth-Token: $(keystone token-get | awk '/ id / {print $4}')" 192.168.56.102:8082/floating-ip/3bebdc3c-6663-4945-8f6e-8f7e436c82b6 | python -mjson.tool

You will get following details:
* floating-ip-pool, pool from where floating-ip allocated.
    - http://192.168.56.102:8082/floating-ip-pool/fe8356b4-6bbe-431a-9163-da3b9e3fa0f2
* project/tenant
    - http://192.168.56.102:8082/project/f2714474-e74e-4b79-a6c5-1ab6022c6bac
* virtual-machine-interface, interface to which floating-ip attached.
    - http://192.168.56.102:8082/virtual-machine-interface/b6e27360-b6ea-41fe-9686-1be695b1eac7

e)
Show detail of a floating IP Pool

#curl -s -H "X-Auth-Token: $(keystone token-get | awk '/ id / {print $4}')" 192.168.56.102:8082/floating-ip-pool/fe8356b4-6bbe-431a-9163-da3b9e3fa0f2 | python -mjson.tool

You will get following details:

* floating-ip, floating-ips allocated from this pool
    - http://192.168.56.102:8082/floating-ip/3bebdc3c-6663-4945-8f6e-8f7e436c82b6
* project/tenant
    - http://192.168.56.102:8082/project/f2714474-e74e-4b79-a6c5-1ab6022c6bac
* virtual-network, virtual-network to which this pool is mapped to.
    - http://192.168.56.102:8082/virtual-network/38fff8c1-4090-4fe5-abb8-9cc7d4d1224f




Monday, May 4, 2015

gns3 Mikrotik Simple Static Routes Example







http://wiki.mikrotik.com/wiki/Simple_Static_Routes_Example

1)
Download following images

a)
linux-microcore-4.0.2-clean
http://sourceforge.net/projects/gns-3/files/Qemu%20Appliances/linux-microcore-4.0.2-clean.img/download
username: tc
password: no password


b)
routeros-6.15

http://sourceforge.net/projects/gns-3/files/Qemu%20Appliances/routeros-6.15-qemu.zip/download
username: admin
password: no password


2)
Upload images

a)
Open "gns3 0.8.3", select "Edit" --> "Preferences" --> "Qemu" --> "Qemu Guest".
* Enter "Identifier name"
* Browse "Binary Image"  we downloaded, linux-microcore-4.0.2-clean.img and routeros-6.15.img
* Save

3)
Try Simple Static Routes Example

####Host-1 : Set IP Address####

* Set IP address for interface eth0
$sudo ifconfig eth0 192.168.1.2 netmask 255.255.255.0 up

####Host-2 : Set IP Address####

* Set IP address for interface eth0
$sudo ifconfig eth0 10.10.1.2 netmask 255.255.255.0 up

####Router-1 : Set IP Address####

* List all interfaces
>interface print

* List all routes
>ip route print

* Set IP address for interface "ether1"
>ip address add address=192.168.1.180/24 interface=ether1

* List all routes
>ip route print

* Set IP address for interface "ether2"
>ip address add address=10.10.1.180/24 interface=ether2

* List all routes
>ip route print

* Try to ping to Host-1:192.168.1.2
>ping 192.168.1.2 - Works

* Try to ping to Host-2:10.10.1.2
>ping 10.10.1.2 - Works

####Host-1 : Test Ping####

* Try to ping to interface "ether1" of router
$ping 192.168.1.180 - Works

* Try to ping to interface "ether2" of router
$ping 10.10.1.180 - Network is unreachable

* Try to ping to Host-2:10.10.1.2
$ping 10.10.1.2 - Network is unreachable

####Host-2 : Test Ping####
* Try to ping to interface "ether2" of router
$ping 10.10.1.180 - Works

* Try to ping to interface ether1 of router
$ping 192.168.1.180 - Network is unreachable

* Try to ping to Host-1:192.168.1.2
$ping 192.168.1.2 - Network is unreachable

####Host-1 : Set Default Gateway####

* List all routes
$route -n

* Set default gateway of host-1(route/path to reach the default router, which route the packet to its destination)
$sudo route add default gw 192.168.1.180 eth0

* List all routes
$route -n

* Try to ping to interface "ether1" of router
$ping 192.168.1.180 - Works

* Try to ping to interface "ether2" of router
$ping 10.10.1.180 - Works

* Try to ping to Host-2:10.10.1.2
$ping 10.10.1.2 - No error and Reply message, that means Request packets are reached at destination (Host-2) and Reply packets are drop somewhere.

####Host-2 : Set Default Gateway####


* List all routes
$route -n

* Set default gateway of host-1 (route/path to reach the default router, which route the packet to its destination)
$sudo route add default gw 10.10.1.180 eth0

* List all routes
$route -n

####Host-1 : Test Ping####
* Try to ping to interface "ether1" of router
$ping 192.168.1.180 - Works

* Try to ping to interface "ether2" of router
$ping 10.10.1.180 - Works

* Try to ping to Host-2:10.10.1.2
$ping 10.10.1.2 - Works, now we get Replay packets from destination (Host-2), since we added default gateway in Host-2.

===================

* Remove a route
> ip address remove numbers=2