Não consegui obter 2 NICs trabalhando juntas

0

Eu tenho um servidor Ubuntu 10.04 com esta configuração:

eth0: 192.168.10.XXX máscara 255.255.255.0 gw 192.168.10.254
máscara eth1: 192.168.0.XXX 255.255.255.0 gw 192.168.0.3

eth0 é usada para tráfego de entrada e saída (servidor interno da web)
eth1 eu quero usar para acessar a rede: 192.168.51.0/24 pelo gateway 192.168.0.1

quando o eth1 está inativo, o servidor da web é acessível.

Quando eu quero trazer o estado de eth1 para cima, eu uso os seguintes comandos:

$ sudo su
# ifconfig eth1 up
# route add -net 192.168.51.0 netmask 255.255.255.0 gw 192.168.0.1
# ping 192.168.51.XXX
[i've got contact]

# ip route add default via 192.168.10.254
# ping 192.168.51.XXX
[i've got contact]

mas quando eu quero acessar o servidor, não consigo contato.

Alguém por favor pode me dar algum conselho para que a rede .51 E o servidor web (rede .10) seja alcançável?

ifconfig

# ifconfig
eth0      Link encap:Ethernet  HWaddr mymac  
          inet addr:192.168.10.2  Bcast:192.168.10.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fee0:39c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:23207 errors:0 dropped:0 overruns:0 frame:0
          TX packets:24924 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2683656 (2.6 MB)  TX bytes:12841148 (12.8 MB)

eth0:1    Link encap:Ethernet  HWaddr mymac  
          inet addr:192.168.10.10  Bcast:192.168.10.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

eth1      Link encap:Ethernet  HWaddr mymac  
          inet addr:192.168.0.237  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fee0:3a6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3742 errors:0 dropped:0 overruns:0 frame:0
          TX packets:143 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:318099 (318.0 KB)  TX bytes:12994 (12.9 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:3175 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3175 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:221390 (221.3 KB)  TX bytes:221390 (221.3 KB)

route -n

# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.51.0    192.168.0.1     255.255.255.0   UG    0      0        0 eth1
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
192.168.10.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0
0.0.0.0         192.168.10.254  0.0.0.0         UG    0      0        0 eth0
0.0.0.0         192.168.10.254  0.0.0.0         UG    100    0        0 eth0
0.0.0.0         192.168.10.254  0.0.0.0         UG    100    0        0 eth0

/ etc / network / interfaces

# cat /etc/network/interfaces 

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static 
address 192.168.10.2
netmask 255.255.255.0
gateway 192.168.10.254

# A second ip address for SSL
auto eth0:1
iface eth0:1 inet static
address 192.168.10.10
netmask 255.255.255.0
gateway 192.168.10.254

auto eth1
iface eth1 inet static
address 192.168.0.237
netmask 255.255.255.0
gateway 192.168.0.3
post-up route add -net 192.168.51.0 netmask 255.255.255.0 gw 192.168.0.1 
    
por Falco van Dooremolen 23.10.2012 / 08:50

2 respostas

1

Eu tenho a solução!

O comando que eu executei era:

# route del -net 192.168.0.0 netmask 255.255.255.0 eth1

Depois desse comando minha: rede 0, rede 10 E rede 51 estava acessível. Eu também editei /etc/sysctl.conf e descomentei net.ipv4.ip_forward=1 antes, mas não tenho certeza se isso é necessário.

minhas configurações:

ifconfig -a

eth0      Link encap:Ethernet  HWaddr 00:0c:29:e0:03:9c  
          inet addr:192.168.10.2  Bcast:192.168.10.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fee0:39c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:53794 errors:0 dropped:0 overruns:0 frame:0
          TX packets:53916 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:6812117 (6.8 MB)  TX bytes:21573511 (21.5 MB)

eth0:1    Link encap:Ethernet  HWaddr 00:0c:29:e0:03:9c  
          inet addr:192.168.10.10  Bcast:192.168.10.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

eth1      Link encap:Ethernet  HWaddr 00:0c:29:e0:03:a6  
          inet addr:192.168.0.237  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fee0:3a6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:29845 errors:0 dropped:0 overruns:0 frame:0
          TX packets:469 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2555869 (2.5 MB)  TX bytes:42872 (42.8 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:8157 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8157 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:624350 (624.3 KB)  TX bytes:624350 (624.3 KB)

route -n

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.51.0    192.168.0.1     255.255.255.0   UG    0      0        0 eth1
192.168.10.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0
0.0.0.0         192.168.10.254  0.0.0.0         UG    0      0        0 eth0
0.0.0.0         192.168.10.254  0.0.0.0         UG    100    0        0 eth0
0.0.0.0         192.168.10.254  0.0.0.0         UG    100    0        0 eth0

/ etc / network / interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static 
address 192.168.10.2
netmask 255.255.255.0
gateway 192.168.10.254

auto eth0:1
iface eth0:1 inet static
address 192.168.10.10
netmask 255.255.255.0
gateway 192.168.10.254

auto eth1
iface eth1 inet static
address 192.168.0.237
netmask 255.255.255.0
gateway 192.168.0.1
post-up route add -net 192.168.51.0 netmask 255.255.255.0 gw 192.168.0.1 
    
por Falco van Dooremolen 24.10.2012 / 13:36
0

Por favor, publique os resultados dos seguintes comandos:

$ifconfig
$route -n

Publique também o conteúdo de /etc/network/interfaces . Você pode usar este comando para isso:

sudo gedit /etc/network/interfaces

UPDATE 1: Ok, em /etc/network/interfaces , defina o gateway de eth0 para 192.168.0.1 e remova todas as outras entradas do gateway. Reinicialize o sistema e veja se funciona agora.

E presumo que você também tenha editado o gateway padrão na configuração do roteador, já que a maioria dos roteadores está configurada com um gateway padrão de 192.168.1.1 . Verifique o gateway do roteador de uma vez.

    
por TomKat 23.10.2012 / 09:11