Ambas as NICs estão funcionando. Um deles tem os endereços IP individuais de:
eth0: 172.22.1.112
and
etho1: 172.22.1.113
Você pode verificar se os dois estão funcionando fazendo ping de um dos endereços IP:
$ ping -c10 172.22.1.112
$ ping -c10 172.22.1.113
Se você tiver outro computador em sua rede, também poderá acessar seu computador a partir de um dos endereços IP.
Se você configurar um servidor da Web em sua máquina, poderá acessar o servidor da web usando um dos endereços IP:
http://172.22.1.112
http://172.22.1.113
O acesso (a saída que você vê com um desses exemplos é a verificação de que ambos estão funcionando. Além disso, o fato de seu dhcp
server poder acessá-los e atribuir endereços IP é outra verificação de que eles estão funcionando.
Execute este script para testar as NICs separadas:
Copie e cole o script abaixo. Você pode nomear: testnic.sh
.
Execute o script individualmente enquanto cada nic estiver conectado ao computador e ao roteador / modem.
testnic.sh:
#!/bin/bash
ifconfig
route -n
sudo route del default gw 172.22.1.1
sudo route add default gw 172.22.1.1
ping -c5 8.8.8.8
Execute o comando como:
$ ./testnic.sh
Mostre o comando e a saída.
Atualização:
Sua saída anterior mostra que o problema, conforme mencionado, está na rota. Você tem que apagar a raiz anterior quando você remover esse nic, então crie outra rota em seu lugar.
Abaixo está um script de exemplo para ajudá-lo nessa tarefa. O script terá que ser testado e ajustado para o seu ambiente. Mas a resposta à sua pergunta é específica, e as duas estão funcionando. A diferença que você está vendo é o resultado de como você os configurou.
Ao remover um NIC, altere sua configuração de rede para usar o roteamento de um remining.
Este é outro exemplo de script para facilitar a alteração de configurações quando você alterna as NICs.
#!/bin/bash
currentroute=$(route -n | awk '/UG/{print $NF}')
available="none"
route="0"
available="none"
find /sys/class/net/en* -exec echo "{}/operstate" \; | while read line; do
# echo "[$line]"
IFS='/' read -r -a array <<< "$line"
device="${array[4]}"
state="$(cat $line)"
thisdevice="$device:$state"
if [[ "$thisdevice" == "$currentroute:down" ]] ; then
route="0"
fi
if [[ "$state" == "up" ]]
then
echo "The device $device is available"
echo "$device" > /tmp/available
fi
done
read -r available </tmp/available
if [[ "$route" == "0" ]]; then
route del default gw 172.22.1.1 $currentdevice
route add default gw 172.22.1.1 $available
fi
echo "[$route/$available]"