{"id":426,"date":"2012-04-09T14:47:30","date_gmt":"2012-04-09T17:47:30","guid":{"rendered":"http:\/\/www.taioque.com.br\/?p=426"},"modified":"2012-04-09T19:34:17","modified_gmt":"2012-04-09T22:34:17","slug":"ubiquiti-utilizando-linha-de-comando","status":"publish","type":"post","link":"http:\/\/www.networktips.com.br\/?p=426","title":{"rendered":"AirOs &#8211; Ubiquiti &#8211; configurando via linha de comando"},"content":{"rendered":"<div style=\"padding-bottom:20px; padding-top:10px;\" class=\"hupso-share-buttons\"><!-- Hupso Share Buttons - https:\/\/www.hupso.com\/share\/ --><a class=\"hupso_toolbar\" href=\"https:\/\/www.hupso.com\/share\/\"><img src=\"http:\/\/static.hupso.com\/share\/buttons\/dot.png\" style=\"border:0px; padding-top: 5px; float:left;\" alt=\"Share Button\"\/><\/a><script type=\"text\/javascript\">var hupso_services_t=new Array(\"Twitter\",\"Facebook\",\"Google Plus\",\"Linkedin\",\"Email\");var hupso_background_t=\"#EAF4FF\";var hupso_border_t=\"#66CCFF\";var hupso_toolbar_size_t=\"medium\";var hupso_image_folder_url = \"\";var hupso_twitter_via=\"jorgeltaioque\";var hupso_url_t=\"\";var hupso_title_t=\"AirOs%20-%20Ubiquiti%20-%20configurando%20via%20linha%20de%20comando\";<\/script><script type=\"text\/javascript\" src=\"http:\/\/static.hupso.com\/share\/js\/share_toolbar.js\"><\/script><!-- Hupso Share Buttons --><\/div><p>&nbsp;<\/p>\n<p>Os equipamentos ubiquiti possuem uma interface GUI, muito r\u00e1pida e simples, porem em alguns casos \u00e9\u00a0necess\u00e1rio\u00a0a utiliza\u00e7\u00e3o de linha de comando.<\/p>\n<p>Devido a grande demanda que hoje tenho em realizar configura\u00e7\u00f5es utilizando linha de comando resolvi criar esse guia de referencia.<\/p>\n<p>Primeiramente \u00e9 necess\u00e1rio realizar o acesso via ssh ou telnet para o equipamento. Em meu caso utilizo apenas SSH.<\/p>\n<p>ssh 192.168.1.20 -l <strong>ubnt<\/strong><br \/>\npassword: <strong>ubnt<\/strong><\/p>\n<p>Ap\u00f3s o acesso iniciara um terminal como root:<\/p>\n<p><strong>XM.v5.3.5.# <\/strong><\/p>\n<p><strong>Vejamos os comandos poss\u00edveis:<\/strong><\/p>\n<p><strong> <\/strong><\/p>\n<p><strong> <\/strong><\/p>\n<p><strong>Verificando o modelo da CPU<\/strong><br \/>\nXM.v5.3.5.# cat \/proc\/cpuinfo<br \/>\nsystem type\t\t: Atheros AR7240 (Python)<br \/>\nprocessor\t\t: 0<br \/>\ncpu model\t\t: MIPS 24K V7.4<br \/>\nBogoMIPS\t\t: 259.07<br \/>\nwait instruction\t: yes<br \/>\nmicrosecond timers\t: yes<br \/>\ntlb_entries\t\t: 16<br \/>\nextra interrupt vector\t: yes<br \/>\nhardware watchpoint\t: yes<br \/>\nASEs implemented\t: mips16<br \/>\nVCED exceptions\t\t: not available<br \/>\nVCEI exceptions\t\t: not available<\/p>\n<p><strong>Utiliza\u00e7\u00e3o da CPU<\/strong><br \/>\n<strong> XM.v5.3.5.# top<\/strong><br \/>\nMem: 23080K used, 39620K free, 0K shrd, 3448K buff, 8180K cached<br \/>\nCPU:   1% usr   1% sys   0% nice  78% idle   0% io  18% irq   0% softirq<br \/>\nLoad average: 0.01 0.01 0.00<br \/>\nPID  PPID USER     STAT   VSZ %MEM %CPU COMMAND<br \/>\n23475     1 admin    S     4000   6%   0% \/bin\/lighttpd -D -f \/etc\/lighttpd.con<br \/>\n23477     1 admin    S     4548   7%   0% \/bin\/tinysnmpd \/etc\/snmp.conf \/lib\/ti<\/p>\n<p><strong>Utiliza\u00e7\u00e3o de mem\u00f3ria<\/strong><br \/>\n<strong> XM.v5.3.5.# cat \/proc\/meminfo<\/strong><br \/>\nMemTotal:        62700 kB<br \/>\nMemFree:         39636 kB<br \/>\nBuffers:          3448 kB<br \/>\nCached:           8236 kB<br \/>\nSwapCached:          0 kB<\/p>\n<p><strong>Verificando configura\u00e7\u00f5es de IP.<\/strong><br \/>\n<strong> XM.v5.3.5.# ifconfig<\/strong><br \/>\nath0      Link encap:Ethernet  HWaddr 00:27:22:18:88:12<br \/>\nUP BROADCAST RUNNING PROMISC ALLMULTI MULTICAST<br \/>\nRX packets:283011 errors:0 dropped:0 overruns:0 frame:0<br \/>\nTX packets:469743 errors:0 dropped:0 overruns:0 carrier:0<br \/>\ncollisions:0 txqueuelen:0<br \/>\nRX bytes:49216478 (46.9 MiB)  TX bytes:83104330 (79.2 MiB)<\/p>\n<p>br0       Link encap:Ethernet  HWaddr 00:27:22:18:88:12<br \/>\ninet addr:10.168.0.100  Bcast:10.168.0.255  Mask:255.255.255.0<br \/>\nUP BROADCAST RUNNING ALLMULTI MULTICAST  MTU:1500<br \/>\nRX packets:294242 errors:0 dropped:0 overruns:0 frame:0<br \/>\nTX packets:38127 errors:0 dropped:0 overruns:0 carrier:0<br \/>\ncollisions:0 txqueuelen:0<br \/>\nRX bytes:41755072 (39.8 MiB)  TX bytes:14859826 (14.1 MiB)<\/p>\n<p><strong>Sinal da interface Wireless<\/strong><br \/>\n<strong> XM.v5.3.5.# iwconfig<\/strong><br \/>\nath0      IEEE 802.11na  ESSID:&#8221;UBNT&#8221;<br \/>\nMode:Master  Frequency:5.82 GHz  Access Point:<br \/>\nBit Rate:6 Mb\/s   Tx-Power=27 dBm   Sensitivity:0\/0<br \/>\nRetry:off   RTS thr:off   Fragment thr:off<br \/>\nEncryption key:off<br \/>\nPower Management:off<br \/>\nLink Quality=24\/94  Signal level=-72 dBm  Noise level=-98 dBm<br \/>\nRx invalid nwid:3323  Rx invalid crypt:0  Rx invalid frag:0<br \/>\nTx excessive retries:0  Invalid misc:0   Missed beacon:0<\/p>\n<p><strong>Caso tenha necessidade de verificar sinal de v\u00e1rios clientes associados, por interface:<\/strong><br \/>\n<strong> XM.v5.3.5.# wstalist -i ath0<\/strong><br \/>\n[<br \/>\n{<br \/>\n&#8220;mac&#8221;: &#8220;00:27:22:02:75:B0&#8221;,<br \/>\n&#8220;name&#8221; : &#8220;&#8221;,<br \/>\n&#8220;lastip&#8221; : &#8220;10.168.0.101&#8221;,<br \/>\n&#8220;associd&#8221; : 1,<br \/>\n&#8220;apwds&#8221; : 0,<br \/>\n&#8220;tx&#8221; : 108,<br \/>\n&#8220;rx&#8221; : 162,<br \/>\n&#8220;signal&#8221; : -72,<br \/>\n&#8220;ccq&#8221; : 99,<br \/>\n&#8220;idle&#8221; : 0,<br \/>\n&#8220;uptime&#8221; : 280396,<br \/>\n&#8220;ack&#8221; : 204,<br \/>\n&#8220;distance&#8221; : 26550,<br \/>\n&#8220;txpower&#8221; : 54,<br \/>\n&#8220;noisefloor&#8221; : -98,<br \/>\n&#8220;airmax&#8221; : {<br \/>\n&#8220;priority&#8221; : 3,<br \/>\n&#8220;quality&#8221; : 58,<br \/>\n&#8220;capacity&#8221; : 34 },<\/p>\n<p><strong>Por MAC-Address<\/strong><br \/>\n<strong> XM.v5.3.5.# wstalist -a 00:27:22:02:75:B0<\/strong><br \/>\n[<br \/>\n{<br \/>\n&#8220;mac&#8221;: &#8220;00:27:22:02:75:B0&#8221;,<br \/>\n&#8220;name&#8221; : &#8220;&#8221;,<br \/>\n&#8220;lastip&#8221; : &#8220;10.168.0.101&#8221;,<br \/>\n&#8220;associd&#8221; : 1,<br \/>\n&#8220;apwds&#8221; : 0,<br \/>\n&#8220;tx&#8221; : 81,<br \/>\n&#8220;rx&#8221; : 81,<br \/>\n&#8220;signal&#8221; : -71,<br \/>\n&#8220;ccq&#8221; : 99,<br \/>\n&#8220;idle&#8221; : 0,<br \/>\n&#8220;uptime&#8221; : 280442,<br \/>\n&#8220;ack&#8221; : 204,<br \/>\n&#8220;distance&#8221; : 26550,<br \/>\n&#8220;txpower&#8221; : 54,<br \/>\n&#8220;noisefloor&#8221; : -98,<br \/>\n&#8220;airmax&#8221; : {<br \/>\n&#8220;priority&#8221; : 3,<br \/>\n&#8220;quality&#8221; : 63,<br \/>\n&#8220;capacity&#8221; : 30 },<\/p>\n<p><strong>Criando VLANs<\/strong><br \/>\n<strong> XM.v5.3.5.# vconfig -h<\/strong><br \/>\nBusyBox v1.11.2 (2011-12-19 20:41:43 EET) multi-call binary<\/p>\n<p>Usage: vconfig COMMAND [OPTIONS]&#8230;<\/p>\n<p>Create and remove virtual ethernet devices<\/p>\n<p>Options:<br \/>\nadd\t\t[interface-name] [vlan_id]<br \/>\nrem\t\t[vlan-name]<br \/>\nset_flag\t[interface-name] [flag-num] [0 | 1]<br \/>\nset_egress_map\t[vlan-name] [skb_priority] [vlan_qos]<br \/>\nset_ingress_map\t[vlan-name] [skb_priority] [vlan_qos]<br \/>\nset_name_type\t[name-type]<\/p>\n<p>XM.v5.3.5.#<\/p>\n<p>XM.v5.3.5.#<br \/>\nvconfig add br0 100<\/p>\n<p><strong>Verificando VLANs criadas.<\/strong><br \/>\n<strong> XM.v5.3.5.# cat \/proc\/net\/vlan\/config<\/strong><br \/>\nVLAN Dev name\t | VLAN ID<br \/>\nName-Type: VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD<br \/>\nbr0.100        | 100  | br0<br \/>\nXM.v5.3.5.#<\/p>\n<p><strong>Verificando BRIDGs criadas<\/strong><br \/>\n<strong> XM.v5.3.5.# brctl show<\/strong><br \/>\nbridge name\tbridge id\t\tSTP enabled\tinterfaces<br \/>\nbr0\t\tffff.002722188812\tno\t\teth0<br \/>\neth1<br \/>\nath0<br \/>\nXM.v5.3.5.#<\/p>\n<p>Por fim como alterar as configura\u00e7\u00f5es que realizamos na interface WEB via linha de comando?<\/p>\n<p>F\u00e1cil, basta editar o arquivo \/tmp\/system.cfg, que no mesmo contem todas as configura\u00e7\u00f5es feitas pelo GUI.<\/p>\n<p><strong>Verificando configura\u00e7\u00f5es:<\/strong><br \/>\n<strong> XM.v5.3.5.# cat \/tmp\/system.cfg<\/strong><\/p>\n<p><strong>Alterando as configura\u00e7\u00f5es<\/strong><br \/>\n<strong> XM.v5.3.5.# vi \/tmp\/system.cfg<\/strong><\/p>\n<p><strong>Segue alguns exemplos de linhas:<\/strong><\/p>\n<p>(configura\u00e7\u00e3o de country code)<br \/>\nradio.countrycode=511<\/p>\n<p>(configura\u00e7\u00e3o do SSID<br \/>\nwireless.1.ssid=UBNT<\/p>\n<p>(configura\u00e7\u00e3o do canal)<br \/>\nradio.1.freq=4920<\/p>\n<p>(ip address<br \/>\nnetconf.3.ip=10.168.0.100<\/p>\n<p>(mascara de rede)<br \/>\nnetconf.3.netmask=255.255.255.0<\/p>\n<p>(gateway)<br \/>\nroute.1.gateway=10.168.0.254<\/p>\n<p>(dns prim\u00e1rio)<br \/>\nresolv.nameserver.1.ip=189.1.144.226<\/p>\n<p>(dns Secund\u00e1rio)<br \/>\nresolv.nameserver.2.ip=189.1.144.227<\/p>\n<p>Para alterara as configura\u00e7\u00f5es basta alterar normalmente com o editor VI salvar e sair do arquivo com ESC_:_x.<\/p>\n<p>Pronto basta executar o seguinte comando para que as configura\u00e7\u00f5es fiquem salvas ap\u00f3s o reboot.<\/p>\n<p><strong>cfgmtd -w -p \/tmp\/;<\/strong><\/p>\n<p><strong>Ap\u00f3s as altera\u00e7\u00f5es \u00e9\u00a0necess\u00e1rio\u00a0reiniciar o equipamento com o comando reboot:<\/strong><br \/>\n<strong> Como verificar as configura\u00e7\u00f5es de firewall<\/strong><\/p>\n<p><strong>(com o equipamento em bridge)<\/strong><br \/>\n<strong> XM.v5.3.5.# ebtables -L<\/strong><br \/>\nBridge table: filter<\/p>\n<p>Bridge chain: INPUT, entries: 0, policy: ACCEPT<\/p>\n<p>Bridge chain: FORWARD, entries: 0, policy: ACCEPT<\/p>\n<p>Bridge chain: OUTPUT, entries: 0, policy: ACCEPT<\/p>\n<p><strong>(com o equipamento em router)<\/strong><br \/>\n<strong> XM.v5.3.5.# iptables -L<\/strong><br \/>\niptables v1.4.0: can&#8217;t initialize iptables table `filter&#8217;: iptables who? (do you need to insmod?)<br \/>\nPerhaps iptables or your kernel needs to be upgraded.<br \/>\nXM.v5.3.5.#<\/p>\n","protected":false},"excerpt":{"rendered":"<div style=\"padding-bottom:20px; padding-top:10px;\" class=\"hupso-share-buttons\"><!-- Hupso Share Buttons - https:\/\/www.hupso.com\/share\/ --><a class=\"hupso_toolbar\" href=\"https:\/\/www.hupso.com\/share\/\"><img src=\"http:\/\/static.hupso.com\/share\/buttons\/dot.png\" style=\"border:0px; padding-top: 5px; float:left;\" alt=\"Share Button\"\/><\/a><script type=\"text\/javascript\">var hupso_services_t=new Array(\"Twitter\",\"Facebook\",\"Google Plus\",\"Linkedin\",\"Email\");var hupso_background_t=\"#EAF4FF\";var hupso_border_t=\"#66CCFF\";var hupso_toolbar_size_t=\"medium\";var hupso_image_folder_url = \"\";var hupso_twitter_via=\"jorgeltaioque\";var hupso_url_t=\"\";var hupso_title_t=\"AirOs%20-%20Ubiquiti%20-%20configurando%20via%20linha%20de%20comando\";<\/script><script type=\"text\/javascript\" src=\"http:\/\/static.hupso.com\/share\/js\/share_toolbar.js\"><\/script><!-- Hupso Share Buttons --><\/div><p>&nbsp; Os equipamentos ubiquiti possuem uma interface GUI, muito r\u00e1pida e simples, porem em alguns casos \u00e9\u00a0necess\u00e1rio\u00a0a utiliza\u00e7\u00e3o de linha de comando. Devido a grande demanda que hoje tenho em realizar configura\u00e7\u00f5es utilizando linha de comando resolvi criar esse guia &hellip; <a href=\"http:\/\/www.networktips.com.br\/?p=426\">Continue lendo <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[10],"tags":[],"_links":{"self":[{"href":"http:\/\/www.networktips.com.br\/index.php?rest_route=\/wp\/v2\/posts\/426"}],"collection":[{"href":"http:\/\/www.networktips.com.br\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.networktips.com.br\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.networktips.com.br\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.networktips.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=426"}],"version-history":[{"count":6,"href":"http:\/\/www.networktips.com.br\/index.php?rest_route=\/wp\/v2\/posts\/426\/revisions"}],"predecessor-version":[{"id":433,"href":"http:\/\/www.networktips.com.br\/index.php?rest_route=\/wp\/v2\/posts\/426\/revisions\/433"}],"wp:attachment":[{"href":"http:\/\/www.networktips.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=426"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.networktips.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=426"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.networktips.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=426"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}