Problème de routage

Bonjour,

J’aurais besoin de votre aide concernant un souci de règles de routage sur mon PC.

Mon PC (sous Debian Jessie) est configuré comme tel :

  • eth0 avec IP fixée à 192.168.3.2 (déclarée dans /etc/network/interfaces)
  • wlan0 en bail DHCP statique (fixé à la MAC) sur 192.168.4.2

J’ai branché mon NAS sur l’interface eth0 de mon PC et wlan0 me sert pour me connecter à Internet (via ma Freebox).

Le problème est que lorsque je démarre, j’ai accès à mon NAS mais je n’ai pas accès à internet.
Je suis donc obligé de couper eth0 pour accéder à Internet (mais je perds évidemment l’accès à mon NAS).
Autrement dit, je n’arrive pas à faire en sorte d’accéder à mes deux réseaux simultanément.

Voici le détail :

Au démarrage, pas d’accès à Internet :

root@whitelight:/home/openpanic# ping 8.8.8.8 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. From 192.168.3.2 icmp_seq=1 Destination Host Unreachable From 192.168.3.2 icmp_seq=2 Destination Host Unreachable From 192.168.3.2 icmp_seq=3 Destination Host Unreachable ^C --- 8.8.8.8 ping statistics --- 4 packets transmitted, 0 received, +3 errors, 100% packet loss, time 3015ms pipe 3

Voici l’état de ma table de routage :

root@whitelight:/home/openpanic# route -n Table de routage IP du noyau Destination Passerelle Genmask Indic Metric Ref Use Iface 0.0.0.0 192.168.3.1 0.0.0.0 UG 0 0 0 eth0 0.0.0.0 192.168.4.254 0.0.0.0 UG 1024 0 0 wlan0 192.168.3.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 192.168.4.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0

Et mes interfaces :

root@whitelight:/home/openpanic# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000 link/ether 14:da:e9:43:2f:14 brd ff:ff:ff:ff:ff:ff inet 192.168.3.2/24 brd 192.168.3.255 scope global eth0 valid_lft forever preferred_lft forever 3: eth1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000 link/ether 14:da:e9:43:27:ad brd ff:ff:ff:ff:ff:ff 4: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:18:f8:a4:6e:10 brd ff:ff:ff:ff:ff:ff inet 192.168.4.2/24 brd 192.168.4.255 scope global dynamic wlan0 valid_lft 43009sec preferred_lft 43009sec inet6 fe80::218:f8ff:fea4:6e10/64 scope link valid_lft forever preferred_lft forever

Et si je coupe eth0, je récupère internet :

root@whitelight:/home/openpanic# ifdown eth0 root@whitelight:/home/openpanic# ping 8.8.8.8 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_seq=2 ttl=56 time=30.9 ms 64 bytes from 8.8.8.8: icmp_seq=3 ttl=56 time=29.4 ms ^C --- 8.8.8.8 ping statistics --- 3 packets transmitted, 2 received, 33% packet loss, time 2000ms rtt min/avg/max/mdev = 29.451/30.210/30.969/0.759 ms

Le contenu de mon fichier /etc/network/interfaces :

[code]root@whitelight:/home/grobs# cat /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

auto eth0
iface eth0 inet static
gateway 192.168.3.1
network 192.168.3.0
netmask 255.255.255.0
address 192.168.3.2[/code]

Merci d’avance :slightly_smiling:
OpenPanic

Alors que vient faire l’option “gateway” dans la définition d’eth0 ? A supprimer si 192.168.3.1 n’est pas l’adresse d’un routeur assurant l’accès internet.

Ralala, c’était tellement évident que je ne l’ai pas vu.
En fait, avant j’avais un routeur entre mon NAS et mon PC… qui avait l’adresse 192.168.3.1 …
Mystère résolu, merci beaucoup :slightly_smiling: