Mudanças entre as edições de "Gerência de Rede (diário 2015-1)"

De MediaWiki do Campus São José
Ir para navegação Ir para pesquisar
Linha 397: Linha 397:
 
}
 
}
 
</graphviz></center>
 
</graphviz></center>
 +
 +
==02/04: não houve aula==
 +
Sexta-feira Santa.
 +
 +
==09/04: DNS==
 +
Registro do dia:
 +
<code>
 +
URLs:
 +
http://root-servers.org
 +
Comandos:
 +
aptitude update
 +
aptitude install bind9
 +
dpkg -L bind9 | grep bin
 +
dpkg -L bind9 | grep etc
 +
whereis named
 +
man named.conf
 +
cd /etc/bind
 +
cat named.conf
 +
cat named.conf.options
 +
dig @200.135.37.65 SOA ifsc.edu.br
 +
dig +norecurse @200.135.37.65 SOA ifsc.edu.br
 +
dig @200.135.37.65 SOA google.com
 +
dig +norecurse @200.135.37.65 SOA google.com
 +
dig +trace @200.135.37.65 SOA google.com
 +
head -n 5 named.conf.default-zones
 +
 +
    zone "." {
 +
 +
            type hint;
 +
 +
            file "/etc/bind/db.root";
 +
 +
    };
 +
 +
more db.root
 +
vi named.conf.options
 +
 +
    options {
 +
 +
    ...
 +
 +
    listen-on-v6 { any; };
 +
 +
    listen-on { any; };
 +
 +
    allow-query { any; };
 +
 +
    allow-query-cache { any; };
 +
 +
    allow-recursion { 127.0.0.0/8; 172.31.40.0/24; 192.168.1.0/24; } ;
 +
 +
    version "";
 +
 +
    };
 +
 +
tail -f /var/log/syslog &
 +
service bind9 restart
 +
vi /etc/bind/named.conf.local
 +
 +
    zone "gerencia.local" {
 +
 +
    type master;
 +
 +
    file "/etc/bind/gerencia.local";
 +
 +
    };
 +
 +
    zone "40.31.172.in-addr.arpa" {
 +
 +
    type master;
 +
 +
    file "/etc/bind/40.31.172.in-addr.arpa";
 +
 +
    };
 +
 +
vi /etc/bind/gerencia.local
 +
 +
    $TTL    86400
 +
 +
    @    IN    SOA    ns1.gerencia.local.    dns-admin.gerencia.local.  (
 +
 +
    2015040901 ; serial
 +
 +
    1d ; refresh
 +
 +
    1h ; retry
 +
 +
    1w ; expire
 +
 +
    1d ; negative cache ttl
 +
 +
    )
 +
 +
    @  IN  NS  ns1.gerencia.local.
 +
 +
    ns1  IN  A  172.31.40.254
 +
 +
    roteador    IN    CNAME    ns1.gerencia.local.
 +
 +
    ftp    IN    A    172.31.40.12
 +
 +
vi /etc/bind/40.31.172.in-addr.arpa
 +
 +
    $TTL    86400
 +
 +
    @    IN    SOA    ns1.gerencia.local.    dns-admin.gerencia.local.  (
 +
 +
    2015040901 ; serial
 +
 +
    1d ; refresh
 +
 +
    1h ; retry
 +
 +
    1w ; expire
 +
 +
    1d ; negative cache ttl
 +
 +
    )
 +
 +
    @  IN  NS  ns1.gerencia.local.
 +
 +
    254  IN  PTR  ns1.gerencia.local.
 +
 +
    12    IN    PTR    ftp.gerencia.local.
 +
 +
diff -u /etc/bind/gerencia.local /etc/bind/40.31.172.in-addr.arpa
 +
service bind9 restart
 +
 +
    Apr  9 10:02:44 localhost named[3072]: zone 40.31.172.in-addr.arpa/IN: loaded serial 2015040800
 +
 +
    Apr  9 10:02:44 localhost named[3072]: zone gerencia.local/IN: loaded serial 2015040800
 +
 +
sed -i  's/dns-nameservers.*/dns-nameservers  127.0.0.1/g'  /etc/network/interfaces
 +
cat    >    /etc/resolv.conf    <<FIM
 +
search gerencia.local
 +
nameserver 127.0.0.1
 +
FIM
 +
sed    -i    's/domain-name-servers.*/domain-name-servers 172.31.40.254;/g'    /etc/dhcp/dhcpd.conf
 +
service    isc-dhcp-server    restart
 +
--- CONTROLE DE VERSAO
 +
vi ~/.gitconfig
 +
[user]
 +
        name = <nome>
 +
        email = <email>
 +
apt-get install git
 +
cd /etc
 +
git init
 +
git add resolv.conf
 +
git add network/interfaces
 +
git add dhcp/dhcpd.conf
 +
git add bind/named.conf.options
 +
git add bind/named.conf.local
 +
git add bind/gerencia.local
 +
git add bind/40.31.172.in-addr.arpa
 +
git commit -a -m "Aula de 09/04/2015."
 +
</syntaxhighlight>

Edição das 11h28min de 9 de abril de 2015

Sobre a disciplina

Avaliação

Serão realizadas 4 avaliações ao longo do semestre. De caráter prático, contemplarão todo o conteúdo da disciplina ministrado até o momento.

Composição do conceito final

O conceito final será assim composto:

  • A: todas as avaliações com conceito A.
  • B: no máximo um C, e para cada C um A correspondente - exceto projeto final.
  • C: no máximo um D, e para cada D um A correspondente - exceto projeto final.
  • D: demais casos.

Observação: a composição do conceito final inclui os conceitos de todas as avaliações e recuperações.

Serviços

Serviço RFC Porta(s)
DHCP RFC 2131, RFC 2132 67/UDP
Syslog RFC 5424 514/UDP, 514/TCP
Cron - -
NTP RFC 5905 123/UDP
DNS RFC 1034 53/UDP, 53/TCP

Aulas

05/02: Revisão de S.O.

  • Apresentação da disciplina e discussão do plano de ensino.
  • Revisão: sistemas operacionais baseados no UNIX e comandos básicos de rede.

12/02: Revisão de S.O.

  • Revisão: sistemas operacionais baseados no UNIX.

19/02: Revisão de IPv4

Revisão: IPv4.

  1. Global

global[compact]=False global[mem]=32 global[vm]=4 global[clean]=False global[path]=/tmp/ger20706/lab


  1. Equipamentos

e0[type]=generic e1[type]=generic e2[type]=generic e3[type]=generic

s0[type]=generic s1[type]=generic

r0[type]=generic r1[type]=generic r2[type]=generic r3[type]=generic


  1. Enlaces

e0[eth0]=e0-s0 s0[eth0]=e0-s0

e1[eth0]=e1-s0 s0[eth1]=e1-s0

r0[eth0]=r0-s0 s0[eth2]=r0-s0

r0[eth1]=r0-r1 r1[eth0]=r0-r1

r0[eth2]=r0-r2 r2[eth0]=r0-r2

r1[eth1]=r1-r3 r3[eth2]=r1-r3

r2[eth1]=r2-r3 r3[eth1]=r2-r3

r3[eth0]=r3-s1 s1[eth2]=r3-s1

e2[eth0]=e2-s1 s1[eth1]=e2-s1

e3[eth0]=e3-s1 s1[eth0]=e3-s1 </syntaxhighlight>

  • Arquivo e0.startup:

  1. !/bin/bash

/hostlab/e0-auto.sh

  1. Enlace

ip link set eth0 up

  1. Rede: endereçamento

ip -4 addr add 192.168.0.2/29 dev eth0

  1. Rede: roteamento

ip -4 route add 0.0.0.0/0 via 192.168.0.1 </syntaxhighlight>

  • Arquivo e1.startup:

  1. !/bin/bash

/hostlab/e1-auto.sh

  1. Enlace

ip link set eth0 up

  1. Rede: endereçamento

ip -4 addr add 192.168.0.3/29 dev eth0

  1. Rede: roteamento

ip -4 route add 0.0.0.0/0 via 192.168.0.1 </syntaxhighlight>

  • Arquivo e2.startup:

  1. !/bin/bash

/hostlab/e2-auto.sh

  1. Enlace

ip link set eth0 up

  1. Rede: endereçamento

ip -4 addr add 192.168.0.10/29 dev eth0

  1. Rede: roteamento

ip -4 route add 0.0.0.0/0 via 192.168.0.9 </syntaxhighlight>

  • Arquivo e3.startup

  1. !/bin/bash

/hostlab/e3-auto.sh

  1. Enlace

ip link set eth0 up

  1. Rede: endereçamento

ip -4 addr add 192.168.0.11/29 dev eth0

  1. Rede: roteamento

ip -4 route add 0.0.0.0/0 via 192.168.0.9 </syntaxhighlight>

  • Arquivo r0.startup:

  1. !/bin/bash

/hostlab/r0-auto.sh

  1. Enlace

ip link set eth0 up ip link set eth1 up ip link set eth2 up

  1. Rede: endereçamento

ip -4 addr add 192.168.0.1/29 dev eth0 ip -4 addr add 192.168.0.17/30 dev eth1 ip -4 addr add 192.168.0.25/30 dev eth2

  1. Rede: roteamento

ip -4 route add 0.0.0.0/0 via 192.168.0.18 </syntaxhighlight>

  • Arquivo r1.startup:

  1. !/bin/bash

/hostlab/r1-auto.sh

  1. Enlace

ip link set eth0 up ip link set eth1 up

  1. Rede: endereçamento

ip -4 addr add 192.168.0.18/30 dev eth0 ip -4 addr add 192.168.0.21/30 dev eth1

  1. Rede: roteamento

ip -4 route add 0.0.0.0/0 via 192.168.0.22 </syntaxhighlight>

  • Arquivo r2.startup:

  1. !/bin/bash

/hostlab/r2-auto.sh

  1. Enlace

ip link set eth0 up ip link set eth1 up

  1. Rede: endereçamento

ip -4 addr add 192.168.0.26/30 dev eth0 ip -4 addr add 192.168.0.29/30 dev eth1

  1. Rede: roteamento

ip -4 route add 0.0.0.0/0 via 192.168.0.25 </syntaxhighlight>

  • Arquivo r3.startup:

  1. !/bin/bash

/hostlab/r3-auto.sh

  1. Enlace

ip link set eth0 up ip link set eth1 up ip link set eth2 up

  1. Rede: endereçamento

ip -4 addr add 192.168.0.9/29 dev eth0 ip -4 addr add 192.168.0.30/30 dev eth1 ip -4 addr add 192.168.0.22/30 dev eth2

  1. Rede: roteamento

ip -4 route add 0.0.0.0/0 via 192.168.0.29 </syntaxhighlight>

  • Arquivo s0.startup:

  1. !/bin/bash

/hostlab/s0-auto.sh

  1. Enlace

ip link set eth0 up ip link set eth1 up ip link set eth2 up

  1. Enlace: ponte

brctl addbr br0 brctl addif br0 eth0 brctl addif br0 eth1 brctl addif br0 eth2 ip link set br0 up

  1. Rede: endereçamento
  1. Rede: roteamento

</syntaxhighlight>

  • Arquivo s1.startup:

  1. !/bin/bash

/hostlab/s1-auto.sh

  1. Enlace

ip link set eth0 up ip link set eth1 up ip link set eth2 up

  1. Enlace: ponte

brctl addbr br0 brctl addif br0 eth0 brctl addif br0 eth1 brctl addif br0 eth2 ip link set br0 up

  1. Rede: endereçamento
  1. Rede: roteamento

</syntaxhighlight>

26/02: DHCP

  • Serviço DHCP: protocolo e implementações.

05/03: Syslog, Cron e NTP

  • Serviço syslog: abertura de porta no servidor.
  • Serviço cron: agendamento de usuário e de sistema.
  • Serviço NTP: visão geral do protocolo, funcionamento em rede e configuração do servidor.

Ao final da aula, integração dos serviços:

<graphviz>

digraph integracao {

 DHCP [shape=Mrecord]
 Syslog [shape=Mrecord]
 Cron [shape=Mrecord]
 NTP [shape=Mrecord]
 DHCP -> Syslog
 DHCP -> NTP
 Cron -> Syslog
 NTP -> Cron
 NTP -> Syslog

}

</graphviz>

Configuração do servidor Syslog (implementação rsyslog) indicando as linhas modificadas --- rsyslog.conf-original 2015-03-05 11:15:51.578716525 -0300 +++ rsyslog.conf 2015-03-05 16:25:45.342721925 -0300 @@ -15,12 +15,12 @@

#$ModLoad immark  # provides --MARK-- message capability

# provides UDP syslog reception

-#$ModLoad imudp -#$UDPServerRun 514 +$ModLoad imudp +$UDPServerRun 514

# provides TCP syslog reception

-#$ModLoad imtcp -#$InputTCPServerRun 514 +$ModLoad imtcp +$InputTCPServerRun 514


###########################

</syntaxhighlight>

Configuração do servidor DHCP:

  1. Autoridade sobre a sub-rede

authoritative;

  1. Integração com serviços

ddns-update-style none; log-facility local7;

  1. Tempos de "aluguel"

default-lease-time 3600; max-lease-time 14400;


  1. Sub-rede

subnet 172.31.40.0 netmask 255.255.255.0 {

   #
   # IP
   range 172.31.40.1 172.31.40.99;
   #
   # Máscara de sub-rede
   option subnet-mask 255.255.255.0;
   #
   # Broadcast
   option broadcast-address 172.31.40.255;
   #
   # Rota-padrão
   option routers 172.31.40.254;
   #
   # Servidores DNS
   option domain-name-servers 200.135.37.72;
   #
   # Servidor de log (syslog)
   option log-servers 172.31.40.254;
   #
   # Servidor de relógio (NTP)
   option time-offset -10800;
   option time-servers 172.31.40.254;

} </syntaxhighlight>

12/03: Gerência de configuração

O modelo FCAPS, apesar de considerado ultrapassado, ainda é usado como referência teórica dos serviços de gerência em redes de telecomunicações. Nesse modelo, a gerência de configuração é responsável pela aplicação e manutenção da configuração dos equipamentos de/em rede, algo que também está presente em ITIL. Para fins didáticos, foram utilizadas duas ferramentas que podem auxiliar no processo:

Em aula, a configuração do atual cenário foi migrada para o sistema de automatização de configuração integrado ao controle de versão. (em breve o repositório com o resultado da tarefa).

19/03: não houve aula

Feriado devido ao Dia de São José.

26/03: DNS

Introdução ao Domain Name System.

<graphviz>

digraph integracao {

 DHCP [shape=Mrecord]
 Syslog [shape=Mrecord]
 Cron [shape=Mrecord]
 NTP [shape=Mrecord]
 DNS [shape=Mrecord]
 DHCP -> Syslog
 DHCP -> NTP
 Cron -> Syslog
 NTP -> Cron
 NTP -> Syslog
 DHCP -> DNS
 DNS -> NTP
 DNS -> Syslog

}

</graphviz>

02/04: não houve aula

Sexta-feira Santa.

09/04: DNS

Registro do dia: URLs: http://root-servers.org Comandos: aptitude update aptitude install bind9 dpkg -L bind9 | grep bin dpkg -L bind9 | grep etc whereis named man named.conf cd /etc/bind cat named.conf cat named.conf.options dig @200.135.37.65 SOA ifsc.edu.br dig +norecurse @200.135.37.65 SOA ifsc.edu.br dig @200.135.37.65 SOA google.com dig +norecurse @200.135.37.65 SOA google.com dig +trace @200.135.37.65 SOA google.com head -n 5 named.conf.default-zones

   zone "." {
           type hint;
           file "/etc/bind/db.root";
   };

more db.root vi named.conf.options

   options {
   ...
   listen-on-v6 { any; };
   listen-on { any; };
   allow-query { any; };
   allow-query-cache { any; };
   allow-recursion { 127.0.0.0/8; 172.31.40.0/24; 192.168.1.0/24; } ;
   version "";
   };

tail -f /var/log/syslog & service bind9 restart vi /etc/bind/named.conf.local

   zone "gerencia.local" {
   type master;
   file "/etc/bind/gerencia.local";
   };
   zone "40.31.172.in-addr.arpa" {
   type master;
   file "/etc/bind/40.31.172.in-addr.arpa";
   };

vi /etc/bind/gerencia.local

   $TTL    86400
   @    IN    SOA    ns1.gerencia.local.    dns-admin.gerencia.local.   (
   2015040901 ; serial
   1d ; refresh
   1h ; retry
   1w ; expire
   1d ; negative cache ttl
   )
   @   IN   NS   ns1.gerencia.local.
   ns1   IN   A   172.31.40.254
   roteador    IN    CNAME    ns1.gerencia.local.
   ftp    IN    A    172.31.40.12

vi /etc/bind/40.31.172.in-addr.arpa

   $TTL    86400
   @    IN    SOA    ns1.gerencia.local.    dns-admin.gerencia.local.   (
   2015040901 ; serial
   1d ; refresh
   1h ; retry
   1w ; expire
   1d ; negative cache ttl
   )
   @   IN   NS   ns1.gerencia.local.
   254   IN   PTR   ns1.gerencia.local.
   12    IN    PTR    ftp.gerencia.local.

diff -u /etc/bind/gerencia.local /etc/bind/40.31.172.in-addr.arpa service bind9 restart

   Apr  9 10:02:44 localhost named[3072]: zone 40.31.172.in-addr.arpa/IN: loaded serial 2015040800
   Apr  9 10:02:44 localhost named[3072]: zone gerencia.local/IN: loaded serial 2015040800

sed -i 's/dns-nameservers.*/dns-nameservers 127.0.0.1/g' /etc/network/interfaces cat > /etc/resolv.conf <<FIM search gerencia.local nameserver 127.0.0.1 FIM sed -i 's/domain-name-servers.*/domain-name-servers 172.31.40.254;/g' /etc/dhcp/dhcpd.conf service isc-dhcp-server restart --- CONTROLE DE VERSAO vi ~/.gitconfig [user]

       name = <nome>
       email = <email>

apt-get install git cd /etc git init git add resolv.conf git add network/interfaces git add dhcp/dhcpd.conf git add bind/named.conf.options git add bind/named.conf.local git add bind/gerencia.local git add bind/40.31.172.in-addr.arpa git commit -a -m "Aula de 09/04/2015." </syntaxhighlight>