-
Regroupement des commandes => ip.
- Utilisation au niveau des interfaces :
oleron# ip link show
1: lo: <LOOPBACK,UP> mtu 16144 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,UP> mtu 1500 qdisc pfifo_fast qlen 100
link/ether 00:10:b5:03:88:44 brd ff:ff:ff:ff:ff:ff
oleron# ip link set eth0 down
oleron# ip link set eth0 address 00:10:b5:03:88:44
- Utilisation pour affecter les adresses IP :
oleron# ip address add dev eth0 193.48.64.200/24 broadcast +
oleron# ip address show eth0
5: eth0: <BROADCAST,UP> mtu 1500 qdisc pfifo_fast qlen 100
link/ether 00:10:b5:03:88:44 brd ff:ff:ff:ff:ff:ff
inet 193.48.64.39/24 brd 193.48.64.255 scope global eth0
inet 193.48.64.200/24 brd 193.48.64.255 scope global secondary eth0
inet6 fe80::210:b5ff:fe03:8844/10 scope link
- Contrôle de la résolution d'adresses physiques :
oleron# ip neighbour show dev eth0
193.48.64.1 lladdr 00:d0:bc:bf:6c:38 nud reachable
193.48.64.47 lladdr 00:10:b5:07:36:82 nud stale
193.48.64.45 lladdr 00:10:b5:07:34:97 nud reachable
oleron# ip neighbour add 193.48.64.250 lladdr 00:10:b5:03:88:44 dev eth0
- Mise à jour d'une table de routage :
-
le routage traditionnel (unicast) :
oleron# ip route add 10.0.0.0/8 via 193.48.64.200
oleron# ip route show
193.48.64.0/24 dev eth0 proto kernel scope link src 193.48.64.39
10.0.0.0/8 via 193.48.64.200 dev eth0
default via 193.48.64.1 dev eth0
- le routage multi-chemin :
pevele# ip route add default nexthop via 193.48.57.33
nexthop via 193.48.57.62
- autres types de routage :
-
un exemple avec le type prohibit :
artois# ip route add prohibit 207.46.0.0/16
gayant08$ ping -v www.microsoft.com
PING microsoft.com (207.46.130.45): 56 data bytes
112 bytes from artois.escaut.net (172.26.16.7): Packet Filtered
- un exemple avec le type nat :
artois# ip route add nat 193.48.57.48/29 via 172.26.17.136
- Ajout d'une règle de stratégie de routage :
artois# ip route add 193.48.57.32/27 dev eth0 table 100
artois# ip route add 172.26.16.0/20 dev eth1 table 100
artois# ip route show table 100
193.48.57.32/27 dev eth0 scope link
172.26.16.0/20 dev eth1 scope link
artois# ip rule add priority 310 from 172.26.17.128/29 lookup table 100
0: from all lookup local
310: from 172.26.17.128/29 lookup 100
32766: from all lookup main
32767: from all lookup default
artois# ip rule add priority 320 from 172.26.17.136/29 nat 193.48.57.48
artois# ip rule show
0: from all lookup local
310: from 172.26.17.128/29 lookup 100
320: from 172.26.17.136/29 lookup main map-to 193.48.57.48
32766: from all lookup main
32767: from all lookup default
- Configuration de tunnels :
artois# ip tunnel show
tunl0: ip/ip remote any local any ttl inherit nopmtudisc
gre0: gre/ip remote any local any ttl inherit nopmtudisc
sit0: ipv6/ip remote any local any ttl 64 nopmtudisc
sit1: ipv6/ip remote 206.123.31.102 local any ttl 64