|
O
que vou mostrar neste texto como mudar as configuracoes padroes de
loopback usadas pelo linux e outros unixes.
Mudar o hostname (localhost) eh a coisa mais basica que tem, e todos
devem ta ligado de como faz. Mas soh pra lembrar...
[root@localhost
rc.d]# hostname elito.br
[root@localhost rc.d]# bash
[root@elito rc.d]#
Isso voce consegue encontrar nos livros "Introduzindo ao linux"
(Nao
sei c existe, foi soh um exemplo. Introduzir rlz!). Entao vo mostar algo
mais legalzinhu de fazer...
O objetivo aki eh mudar o ip (127.0.0.1) para (1.3.3.7). Vejamos o log:
[root@localhost fe]# route
Tabela de Roteamento IP do Kernel
Destino Roteador MáscaraGen. Opções Métrica
Ref Uso Iface
127.0.0.0 * 255.0.0.0 U 0 0 2 lo
[root@localhost fe]# ifconfig
lo Encapsulamento do Link: Loopback Local
end. inet:127.0.0.1 Bcast:127.255.255.255 Masc:255.0.0.0
UP BROADCAST LOOPBACK RUNNING MTU:3584 Métrica:1
Pacotes RX:88 erros:0 descartados:0 sobreposições:0 quadros:0
Pacotes TX:88 erros:0 descartados:0 sobreposições:0 portadora:0
colisões:0
Issu
foi feito em um conectiva... por issu ta traduzido...
ifconfig configura interfaces de rede.
route manipula a tabela de roteamento IP.
O que faremos eh apagar todas as configuracoes atuais e reescreve-las.
[root@localhost
fe]# route del -net 127.0.0.0 netmask 255.0.0.0 lo
[root@localhost fe]# route
Tabela de Roteamento IP do Kernel
Destino Roteador MáscaraGen. Opções Métrica
Ref Uso Iface
[root@localhost fe]# ifconfig lo down
[root@localhost fe]# ifconfig
Ta
apagado.
Agora reconfigurando...
[root@localhost
fe]# ifconfig -a lo 1.3.3.7
[root@localhost fe]# ifconfig
lo Encapsulamento do Link: Loopback Local
end. inet:1.3.3.7 Bcast:127.255.255.255 Masc:255.0.0.0
UP BROADCAST LOOPBACK RUNNING MTU:3584 Métrica:1
Pacotes RX:88 erros:0 descartados:0 sobreposições:0 quadros:0
Pacotes TX:88 erros:0 descartados:0 sobreposições:0 portadora:0
colisões:0
[root@localhost
fe]# route add -host 1.3.3.7 lo
[root@localhost fe]# route
Tabela de Roteamento IP do Kernel
Destino Roteador MáscaraGen. Opções Métrica
Ref Uso Iface
1.3.3.7 * 255.255.255.255 UH 0 0 0 lo
Pronto!
Vamos ver c funfa???
[root@localhost
fe]# ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1): 56 data bytes
ping: sendto: Network is unreachable
ping: wrote 127.0.0.1 64 chars, ret=-1
ping: sendto: Network is unreachable
ping: wrote 127.0.0.1 64 chars, ret=-1
ping: sendto: Network is unreachable
ping: wrote 127.0.0.1 64 chars, ret=-1
ping: sendto: Network is unreachable
ping: wrote 127.0.0.1 64 chars, ret=-1
ping: sendto: Network is unreachable
ping: wrote 127.0.0.1 64 chars, ret=-1
---
127.0.0.1 ping statistics ---
5 packets transmitted, 0 packets received, 100% packet loss
[root@localhost fe]# ping 1.3.3.7
PING 1.3.3.7 (1.3.3.7): 56 data bytes
64 bytes from 1.3.3.7: icmp_seq=0 ttl=64 time=0.2 ms
64 bytes from 1.3.3.7: icmp_seq=1 ttl=64 time=0.1 ms
64 bytes from 1.3.3.7: icmp_seq=2 ttl=64 time=0.1 ms
64 bytes from 1.3.3.7: icmp_seq=3 ttl=64 time=0.1 ms
64 bytes from 1.3.3.7: icmp_seq=4 ttl=64 time=0.1 ms
---
1.3.3.7 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 0.1/0.1/0.2 ms
Rulah!!!
O 127.0.0.1 agora eh 1.3.3.7!!!
Soh nao esqueca de mudar no /etc/hosts ou o localhost nao vai funfa se
não da merda! |