Custom Search

SUBSCRIBE

SUBSCRIBE : 300 + Free Video Tutorials Programming (Python, golang, Julia), DevOps

Tuesday, July 15, 2014

OpenStack neutron How to find services (with port) running in a network namespace

1)
List all namespaces
#ip netns
qdhcp-568e5a82-43f6-42a5-a9bc-886130751055
qrouter-e7707afd-d456-47df-b2f6-1c2434c9e77d

2)
2a)
List IP, Port and PID of all services which are using "tcp" protocol in the quantum router network namespace "qrouter-e7707afd-d456-47df-b2f6-1c2434c9e77d"

#sudo ip netns exec qrouter-e7707afd-d456-47df-b2f6-1c2434c9e77d netstat -anpt
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:9697            0.0.0.0:*               LISTEN      14098/python

2b)
Find the services using the PIDs got in the previous step.

#ps -f --pid 14098 | fold -s -w 80
UID        PID  PPID  C STIME TTY          TIME CMD
root     14098     1  0 17:16 ?        00:00:00 /usr/bin/python
/usr/local/bin/neutron-ns-metadata-proxy
--pid_file=/opt/stack/data/neutron/external/pids/e7707afd-d456-47df-b2f6-1c2434c
9e77d.pid --metadata_proxy_socket=/opt/stack/data/neutron/metadata_proxy
--router_id=e7707afd-d456-47df-b2f6-1c2434c9e77d
--state_path=/opt/stack/data/neutron --metadata_port=9697 --debug --verbose

3)
3a)
List IP, Port and PID of all services which are using "tcp" protocol in the quantum dhcp network namespace "qdhcp-568e5a82-43f6-42a5-a9bc-886130751055"

#sudo ip netns exec qdhcp-568e5a82-43f6-42a5-a9bc-886130751055 netstat -anpt
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 10.0.0.3:53             0.0.0.0:*               LISTEN      21130/dnsmasq  
tcp6       0      0 fe80::f816:3eff:febe:53 :::*                    LISTEN      21130/dnsmasq

3b)
Find the services using the PIDs got in the previous step.

#ps -f --pid 21130 | fold -s -w 80
UID        PID  PPID  C STIME TTY          TIME CMD
nobody   21130     1  0 17:42 ?        00:00:00 dnsmasq --no-hosts --no-resolv
--strict-order --bind-interfaces --interface=tap34457685-b2
--except-interface=lo
--pid-file=/opt/stack/data/neutron/dhcp/568e5a82-43f6-42a5-a9bc-886130751055/pid

--dhcp-hostsfile=/opt/stack/data/neutron/dhcp/568e5a82-43f6-42a5-a9bc-8861307510
55/host
--addn-hosts=/opt/stack/data/neutron/dhcp/568e5a82-43f6-42a5-a9bc-886130751055/a
ddn_hosts
--dhcp-optsfile=/opt/stack/data/neutron/dhcp/568e5a82-43f6-42a5-a9bc-88613075105
5/opts --leasefile-ro --dhcp-range=set:tag0,10.0.0.0,static,86400s
--dhcp-lease-max=256 --conf-file= --domain=openstacklocal

No comments:

Post a Comment