Bonjour !
J’ai posé cette question sur les forums anglophones, mais je n’ai aucune réponse, pourtant ça devrait concerner beaucoup de monde…
Comment faire pour ajouter une adresse ip d’un réseau différent sur une même interface ?
Sur l’ancienne machine (ubuntu 9), j’avais la configuration suivante dans /etc/network/interfaces (j’ai changé les ip)
[code]auto eth0
iface eth0 inet static
address 95.125.209.64
netmask 255.255.255.0
network 95.125.209.0
broadcast 95.125.209.255
gateway 95.125.209.254
auto eth0:0
iface eth0:0 inet static
…
auto eth0:1
iface eth0:1 inet static
address 84.96.133.38
netmask 255.255.255.0
network 84.96.133.0
broadcast 84.96.133.255
gateway 84.96.133.254[/code]
Seulement, ça ne marche plus sur Wheezy.
[code]root@xxx:/# /etc/init.d/networking stop && /etc/init.d/networking start
[…] Deconfiguring network interfaces…RTNETLINK answers: No such process
done.
[…] Configuring network interfaces…RTNETLINK answers: File exists
Failed to bring up eth0:1.
done.
root@xxx:/# cat /etc/network/run/ifstate
lo=lo
eth0=eth0
root@xxx:/# ifconfig -a
eth0 Link encap:Ethernet HWaddr …
eth0:1 Link encap:Ethernet HWaddr 4c:72:b9:7b:b3:4d
inet addr:84.96.133.38 Bcast:84.96.133.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:20 Memory:fe500000-fe520000
lo Link encap:Local Loopback …[/code]
Vous remarquerez qu’ifconfig déclare que l’interface est là, alors qu’elle n’est pas censée exister.
J’ai lu dans diverses documentations qu’il fallait utiliser ip et non plus ifconfig
root@xxx:/# ifdown eth0 && ifup eth0
RTNETLINK answers: No such process
Euh ? C’est normal ça ?
Du coup, la nouvelle configuration devrait ressembler à cela :
auto eth0
allow-hotplug eth0
iface eth0 inet static
address x.x.x.x
netmask 255.255.255.0
network x.x.x.x
broadcast x.x.x.x
gateway x.x.x.x
up ip addr add dev eth0 local 84.96.133.38/24 broadcast 84.96.133.255 label eth0:1
up ip route add 84.96.133.38 proto static scope host dev eth0:1
#up ip route add 84.96.133.0/24 proto static scope host dev eth0:1 src 84.96.133.38
#up ip route add 0.0.0.0/0 proto static scope link dev eth0:1 via 84.96.133.254 src 84.96.133.38
down ip addr del dev eth0 local 84.96.133.38/24 broadcast 84.96.133.255 label eth0:1
down ip route del 84.96.133.38 scope link dev eth0:1
#down ip route del 84.96.133.0/24 proto kernel scope link dev eth0:1 src 84.96.133.38
#down ip route del 0.0.0.0/0 proto kernel scope link dev eth0:1 via 84.96.133.254 src 84.96.133.38
Alors, ça marchouille, mais seulement au reboot ( /etc/init.d/networking stop && /etc/init.d/networking start provoque une erreur, qui subsiste quels que soient les changements que l’on fait à /etc/network/interfaces. Est ce un bug ? )
root@xxx:~# /etc/init.d/networking stop && /etc/init.d/networking start
[ ok ] Deconfiguring network interfaces...done.
[....] Configuring network interfaces...RTNETLINK answers: File exists
Failed to bring up eth0.
RTNETLINK answers: File exists
Failed to bring up eth0.
done.
Euh (comment se fait il que je sois encore connecté ?)
Les lignes commentées ne fonctionnent pas, comment ajouter les passerelles pour les ip supplémentaires ? Suis je sur la bonne voie en essayant de créer des routes ?