+ Responder ao Tópico



  1. #1
    guardian_metal
    Visitante

    Padrão Configurar rede (problemas na rota)

    [root@lasertools-serv lsts]# /sbin/route del default
    [root@lasertools-serv lsts]# /sbin/route add default eth1
    [root@lasertools-serv lsts]# /sbin/route add default gw 192.168.172.1
    [root@lasertools-serv lsts]# /etc/init.d/network restart
    Shutting down interface eth0: [ OK ]
    Shutting down interface eth1: [ OK ]
    Shutting down loopback interface: [ OK ]
    Disabling IPv4 packet forwarding: [ OK ]
    Setting network parameters: [ OK ]
    Bringing up loopback interface: [ OK ]
    Bringing up interface eth0: [ OK ]
    Bringing up interface eth1: [ OK ]
    [root@lasertools-serv lsts]# /sbin/route
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    192.168.172.0 * 255.255.255.0 U 0 0 0 eth0
    192.168.172.0 * 255.255.255.0 U 0 0 0 eth1
    169.254.0.0 * 255.255.0.0 U 0 0 0 eth1
    default 192.168.172.1 0.0.0.0 UG 0 0 0 eth0

    Pelo o que me parece é que ele usa o endereço 192.168.172.1 como gateway na eth0 mas eu adicionei o gateway 192.168.172.1 na eth1.

    O que há de errado?

    Agora vejam isso:

    [root@lasertools-serv network-scripts]# cat ifcfg-eth0
    BOOTPROTO=none
    PEERDNS=no
    IPV6INIT=no
    TYPE=Ethernet
    HWADDR=00:07:E9:19:EB:AA
    DEVICE=eth0
    MTU=""
    NETMASK=255.255.255.0
    BROADCAST=192.168.172.255
    IPADDR=192.168.172.4
    NETWORK=192.168.172.0
    USERCTL=no
    ONBOOT=yes
    You have new mail in /var/spool/mail/henrique
    [root@lasertools-serv network-scripts]# cat ifcfg-eth1
    GATEWAY=192.168.172.1
    BOOTPROTO=none
    PEERDNS=no
    HWADDR=00:0BB:8E:98:9B
    TYPE=Ethernet
    IPV6INIT=no
    DEVICE=eth1
    MTU=""
    NETMASK=255.255.255.0
    BROADCAST=192.168.172.255
    IPADDR=192.168.172.2
    NETWORK=192.168.172.0
    ONBOOT=yes
    USERCTL=no

    O gateway esta na interface eth1 mas o comando route me mostra na eth0. O que faço agora?

    Minhas linhas de nat.

    iptables=/sbin/iptables
    #
    IF_EXTERNA=eth1
    IF_INTERNA=eth0
    #
    #Habilita (NAT)
    $iptables -t nat -A POSTROUTING -o $IF_EXTERNA -j MASQUERADE
    #
    #Redireciona Todas as portas para a 8080 (http) (Squid)
    $iptables -t nat -A PREROUTING -s 192.168.172.0/24 -p tcp --dport 80 -j REDIRECT --to 8080
    $iptables -t nat -A PREROUTING -s 192.168.172.0/24 -p udp --dport 80 -j REDIRECT --to 8080
    $iptables -t nat -A PREROUTING -s localhost -p tcp --dport 80 -j REDIRECT --to 8080
    $iptables -t nat -A PREROUTING -s localhost -p udp --dport 80 -j REDIRECT --to 8080

  2. #2
    abc
    Visitante

    Padrão Rotas

    Desabilita as interfaces, e levanta tudo na mao,:

    ifconfig e route

    E veja o que acontece

    Se der certo coloque no rc.local

  3. #3
    estanisgeyer
    Visitante

    Padrão Configurar rede (problemas na rota)

    Você fez uma pequena confusão. Seria assim:

    # route del default
    # route add default gw 192.168.172 eth1
    # service network restart


    Att.

  4. #4
    guardian_metal
    Visitante

    Padrão Configurar rede (problemas na rota)

    Reiniciei cada uma das interfaces na mão e continua igual e:

    [root@lasertools-serv lsts]# /sbin/route del default
    [root@lasertools-serv lsts]# /sbin/route add default gw 192.168.172.1 eth1
    [root@lasertools-serv lsts]# /etc/init.d/network restart
    Shutting down interface eth0: [ OK ]
    Shutting down interface eth1: [ OK ]
    Shutting down loopback interface: [ OK ]
    Disabling IPv4 packet forwarding: [ OK ]
    Setting network parameters: [ OK ]
    Bringing up loopback interface: [ OK ]
    Bringing up interface eth0: [ OK ]
    Bringing up interface eth1: [ OK ]
    [root@lasertools-serv lsts]# /sbin/route
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    192.168.172.0 * 255.255.255.0 U 0 0 0 eth0
    192.168.172.0 * 255.255.255.0 U 0 0 0 eth1
    169.254.0.0 * 255.255.0.0 U 0 0 0 eth1
    default 192.168.172.1 0.0.0.0 UG 0 0 0 eth0

  5. #5
    guardian_metal
    Visitante

    Padrão Configurar rede (problemas na rota)

    Pra quem acha maluko, veja só:

    1. Configurando o Gateway padrão e reiniciando a rede:

    [root@lasertools-serv lsts]# /sbin/route del default
    [root@lasertools-serv lsts]# /sbin/route add default gw 192.168.172.1 eth1
    [root@lasertools-serv lsts]# /etc/init.d/network restart
    Shutting down interface eth0: [ OK ]
    Shutting down interface eth1: [ OK ]
    Shutting down loopback interface: [ OK ]
    Setting network parameters: [ OK ]
    Bringing up loopback interface: [ OK ]
    Bringing up interface eth0: [ OK ]
    Bringing up interface eth1: [ OK ]
    [root@lasertools-serv lsts]# /sbin/route
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    192.168.172.0 * 255.255.255.0 U 0 0 0 eth0
    192.168.172.0 * 255.255.255.0 U 0 0 0 eth1
    169.254.0.0 * 255.255.0.0 U 0 0 0 eth1
    default 192.168.172.1 0.0.0.0 UG 0 0 0 eth0

    Obs: Mesmo configurando o gateway na eth1, ele só funciona na eth0 quando reinicio a rede.

    2. Configurando o Gateway padrão e não reiniciando a rede:

    [root@lasertools-serv lsts]# /sbin/route del default
    [root@lasertools-serv lsts]# /sbin/route add default gw 192.168.172.1 eth1
    [root@lasertools-serv lsts]# /sbin/route
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    192.168.172.0 * 255.255.255.0 U 0 0 0 eth0
    192.168.172.0 * 255.255.255.0 U 0 0 0 eth1
    169.254.0.0 * 255.255.0.0 U 0 0 0 eth1
    default 192.168.172.1 0.0.0.0 UG 0 0 0 eth1

    Obs: Mesmo configurando o gateway na eth1, ele só funciona na eth1 se o serviço rede não for reiniciado.

    Solução: Colocar o seguinte em rc.local;

    /sbin/route del default
    /sbin/route add default gw 192.168.172.1 eth1

    E pronto. Loko, né?

  6. #6
    felco
    Visitante

    Padrão Configurar rede (problemas na rota)

    Red Hat sux alot

  7. #7
    Rodrigo Ortiz
    Visitante

    Padrão ROTA

    Seguinte o redhat , fedora e similares, criam o gateway default apartir do arwuiov /etc/sysconfig/network


    Dentro deste arquivo tem a variável GATEWAYNA QUAL PODE SER SETADO TAMBÉM O GATEWAYDEV.....

    Veja o que diz esse arquivio para que seja utilizado o que está descxito no ifcfg-eth0 ou 1


    Rodrigo Ortiz

  8. #8
    guardian_metal
    Visitante

    Padrão Configurar rede (problemas na rota)

    esse arquivos estavam com o gateway na eth1 mas o comando route mostrava que o gateway tava na eth0.

  9. #9
    cleziano
    Visitante

    Padrão Configurar rede (problemas na rota)

    acho estranho esse detalhe:

    192.168.172.0 * 255.255.255.0 U 0 0 0 eth0
    192.168.172.0 * 255.255.255.0 U 0 0 0 eth1

    duas placas diferentes tem o mesmo destino?

    acho que ele tá pegando por default a primeira rota que vai para a eth0.

  10. #10
    guardian_metal
    Visitante

    Padrão Configurar rede (problemas na rota)

    Por motivos administrativos aqui, me pediram pra colocar o ip 192.168.172.10 na eth1 e 192.168.172.11 na eth0 e meu gateway é um D-Link 192.168.172.1.

  11. #11
    cleziano
    Visitante

    Padrão Configurar rede (problemas na rota)

    acho que se as duas placas de rede estão na mesma rede (192.168.172.0) então tanto faz o getway ser a eth0 como a eth1...

    tenho duas sugestões:

    1- colocar um ip da rede 169.254.0.0 netmask 255.255.0.0 na eth0 e deixar o ip da rede 192.168.172.0 netmask 255.255.255.0 na eth1 para que o getway seja a eth1 ou

    2- mudar o ip da eth1 para a rede 169.254.0.0 netmask 255.255.0.0 e deixar a tebela de rotas como está, tirando apenas a rota 192.168.172.0 * 255.255.255.0 U 0 0 0 eth1 que estará na eth0.

  12. #12

    Padrão Configurar rede (problemas na rota)

    aproveitando o embalo, tenho aqui 2 placas de rede iguais e o driver e o mesmo so que cada ves que eu reinicio a maquina ele muda o a eth0 de placa, tipo ele se atrapalha e horas pega a placa de cima e horas pega a placa de baixo, e ae qual e a solução?

  13. #13
    sigmanalo
    Visitante

    Padrão duas placas

    no debian ao menos existe como definir a placa de rede pelo mac address no arquivo de interfaces de rede, é só acrescentar a diretiva
    hwaddress ether XY:XY:XY:XY:XY:XY
    na respectiva placa.