{"id":347,"date":"2019-04-15T10:49:16","date_gmt":"2019-04-15T09:49:16","guid":{"rendered":"https:\/\/zed-network.fr\/?p=347"},"modified":"2020-08-24T19:27:56","modified_gmt":"2020-08-24T18:27:56","slug":"test-network-services","status":"publish","type":"post","link":"https:\/\/zed-network.fr\/?p=347","title":{"rendered":"How to test your network services with Docker"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">This container has been tested with IOS \/ NXOS and ACI.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Test syslog<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You can verify if you receive logs with syslog-ng. This service runs on the default port udp\/514.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The configuration on the file \/etc\/syslog-ng\/syslog-ng.conf redirects the external logs to the following file: \/var\/log\/remote-syslog.log<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"># Extract of syslog-ng.conf\n<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">source s_net {<br>         tcp(ip(0.0.0.0) port(514));<br>         udp(ip(0.0.0.0) port(514));<br> }; <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">log { source(s_net); destination(d_net); };<br>destination d_net { file(&#8220;\/var\/log\/remote-syslog.log&#8221;); }; <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Logs could be see with the following command:<\/p>\n\n\n\nroot@89944db0da60:~# tailf \/var\/log\/remote-syslog.log\n\n\n\n<pre class=\"wp-block-preformatted\">Apr 15 06:50:51 10.0.100.46 2019 Apr 15 06:50:48 UTC: %ETHPORT-5-IF_DOWN_CFG_CHANGE: Interface Ethernet1\/1 is down(Config change)<br> Apr 15 06:50:52 10.0.100.46 2019 Apr 15 06:50:49 UTC: %ETHPORT-5-IF_DOWN_ADMIN_DOWN: Interface Ethernet1\/1 is down (Administratively down)<br> Apr 15 06:50:55 10.0.100.46 2019 Apr 15 06:50:52 UTC: last message repeated 1 time<br><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">Apr 15 11:57:59 10.255.0.2 %LOG_LOCAL7-4-SYSTEM_MSG [F1186][raised][config-failure][warning][sys\/phys-[eth1\/35]\/fault-F1186] Port configuration failure.                                   Reason: 2                                   Failed Config: l1:PhysIfspeed_failed_flag<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Test snmptrap<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">snmptrapd is used to receive snmptrap. The logs are redirect to the file : \/var\/log\/snmptrapd.log. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The configuration files are the following : \/etc\/snmp\/snmptrapd.conf and \/etc\/default\/snmptrapd. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The community configured is &#8220;public&#8221;. You can change in the \/etc\/snmp\/snmptrad file or disabled the authentification with &#8221; disableAuthorization yes&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example: <\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">Agent Address: 0.0.0.0<br>\n Agent Hostname: nxos &#8211; UDP: [10.0.100.46]:59353-&gt;[172.21.0.2]:162<br>\n Date: 6:50:57 15-4<br>\n Enterprise OID: .<br>\n EngineID:<br>\n Trap Type: Cold Start<br>\n Trap Sub-Type: 0<br>\n Community\/Infosec Context: TRAP2, SNMP v2c, community nxos<br>\n Uptime: 0<br>\n Description: Cold Start<br>\n PDU Attribute\/Value Pair Array:<br>\niso.3.6.1.2.1.1.3.0 = Timeticks: (16384794) 1 day, 21:30:47.94<br>\niso.3.6.1.6.3.1.1.4.1.0 = OID: iso.3.6.1.2.1.17.0.2<br>\niso.3.6.1.4.1.9.9.46.1.3.1.1.1.1.1 = INTEGER: 1<br>\niso.3.6.1.2.1.31.1.1.1.1.436207616 = STRING: &#8220;Ethernet1\/1&#8221;<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">Agent Address: 0.0.0.0<br>\n Agent Hostname: nxos &#8211; UDP: [10.0.100.46]:59353-&gt;[172.21.0.2]:162<br>\n Date: 6:51:6 15-4<br>\n Enterprise OID: .<br>\n EngineID:<br>\n Trap Type: Cold Start<br>\n Trap Sub-Type: 0<br>\n Community\/Infosec Context: TRAP2, SNMP v2c, community nxos<br>\n Uptime: 0<br>\n Description: Cold Start<br>\n PDU Attribute\/Value Pair Array:<br>\niso.3.6.1.2.1.1.3.0 = Timeticks: (16385696) 1 day, 21:30:56.96<br>\niso.3.6.1.6.3.1.1.4.1.0 = OID: iso.3.6.1.4.1.9.9.43.2.0.2<br>\niso.3.6.1.4.1.9.9.43.1.1.1.0 = Timeticks: (16384764) 1 day, 21:30:47.64<br>\niso.3.6.1.4.1.9.9.43.1.1.6.1.6.7117 = INTEGER: 3<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Test tacacs+ <\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">tacacs+ is used to verify the Authentication, Authorization and Accounting. The configuration is in the file \/etc\/tacacs\/tac_plus.conf.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We use the following package : http:\/\/www.shrubbery.net\/tac_plus\/ <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The current configuration is the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Tacacs Key : cisco1234<\/li><li>user : user1 \/ cisco1234<\/li><li>Right: admin<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The log files are the following : <\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>For accounting : \/var\/log\/tacacs\/tac_plus.acct<\/li><li>For authentication : \/var\/log\/tac_plus.log<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Test radius<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">We use freeradius with the following files:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>radiusd.conf<\/li><li>clients.conf<\/li><li>users<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The logs are in the following directory \/var\/log\/freeradius\/.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example for IOS\/NXOS and ACI :<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">user1 Cleartext-Password := &#8220;cisco1234&#8221;<br>\n        Service-Type = NAS-Prompt-User,<br>\n        Cisco-AVPair = &#8220;shell:priv-lvl=15&#8221;,<br>\n        Cisco-AVPair += &#8220;shell:domains=all\/admin\/&#8221;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Synchronize ntp<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This container can be use to verify if your device can synchronize with a ntp server. This container runs a ntp server as stratum 5.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">server 127.127.1.0<br>\nfudge 127.127.1.0 stratum 5<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">SSH \/ scp server<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You can use this container to upload some file via scp if needed. The daemon is stopped and you need to create you own user.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@9371dba394dc:~# adduser cisco\n Adding user <code>cisco' ... Adding new group<\/code>cisco' (1001) \u2026\n Adding new user <code>cisco' (1001) with group<\/code>cisco' \u2026\n Creating home directory <code>\/home\/cisco' ... Copying files from<\/code>\/etc\/skel' \u2026\n New password:\n Retype new password:\n passwd: password updated successfully\n Changing the user information for cisco\n Enter the new value, or press ENTER for the default\n         Full Name []:\n         Room Number []:\n         Work Phone []:\n         Home Phone []:\n         Other []:\n Is the information correct? [Y\/n] y\n\nroot@9371dba394dc:~# \/etc\/init.d\/ssh start\n [ ok ] Starting OpenBSD Secure Shell server: sshd.<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The port exposed for ssh is 30022 on the docker-compose.yml file. You can change this port.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Docker-compose file<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">docker-compose.yml<br> <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">version: \"3\"\n services:\n   network-test:\n     build: .\n     image: zednetwork\/network-test\n     ports:\n      - \"30022:22\/tcp\"\n      - \"123:123\/udp\"\n      - \"49:49\/tcp\"\n      - \"162:162\/udp\"\n      - \"514:514\/udp\"\n      - \"1812:1812\/udp\"\n      - \"1813:1813\/udp\"\n     tty: true\n     stdin_open: true<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To download the container :<br>docker pull zednetwork\/network-test:latest <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To enter in the container :  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">docker exec -it &lt;container_ID&gt; \/bin\/bash<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This container has been tested with IOS \/ NXOS and ACI. Test syslog You can verify if you receive logs with syslog-ng. This service runs on the default port udp\/514. The configuration on the file \/etc\/syslog-ng\/syslog-ng.conf redirects the external logs to the following file: \/var\/log\/remote-syslog.log # Extract of syslog-ng.conf source s_net { tcp(ip(0.0.0.0) port(514)); udp(ip(0.0.0.0) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"footnotes":""},"categories":[27],"tags":[],"class_list":["post-347","post","type-post","status-publish","format-standard","hentry","category-automation"],"_links":{"self":[{"href":"https:\/\/zed-network.fr\/index.php?rest_route=\/wp\/v2\/posts\/347","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zed-network.fr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zed-network.fr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zed-network.fr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zed-network.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=347"}],"version-history":[{"count":21,"href":"https:\/\/zed-network.fr\/index.php?rest_route=\/wp\/v2\/posts\/347\/revisions"}],"predecessor-version":[{"id":549,"href":"https:\/\/zed-network.fr\/index.php?rest_route=\/wp\/v2\/posts\/347\/revisions\/549"}],"wp:attachment":[{"href":"https:\/\/zed-network.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=347"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zed-network.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=347"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zed-network.fr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=347"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}