Linux : modifier l’IP de sortie en configuration multi-alias

Boris HUISGEN December 2, 2014

administration linux réseau système

# ip addr

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:1e:c9:ae:fc:6f brd ff:ff:ff:ff:ff:ff
inet 172.16.170.4/16 brd 172.29.255.255 scope global eth0:1
inet 172.16.170.5/16 brd 172.29.255.255 scope global secondary eth0:2
inet 172.16.170.6/16 brd 172.29.255.255 scope global secondary eth0:3
inet 172.16.170.7/16 brd 172.29.255.255 scope global secondary eth0:4
inet 172.16.0.3/16 brd 172.29.255.255 scope global secondary eth0
inet6 fe80::21e:c9ff:feae:fc6f/64 scope link
valid_lft forever preferred_lft forever

# ip route

default via 172.16.0.1 dev eth0
172.16.0.0/16 dev eth0  proto kernel  scope link  src 172.16.170.4

# ip route get 8.8.8.8

8.8.8.8 via 172.16.0.1 dev eth0  src 172.16.170.4
cache

# ip route replace default via 172.16.0.1 src 172.16.0.3
# ip route get 8.8.8.8

8.8.8.8 via 172.16.0.1 dev eth0  src 172.16.0.3
cache

See also

Amazon Route 53 : alias sur le root domain
Read more
CloudFlare : redirection du root domain vers un CNAME
Read more
Systemd : unité timer pour simuler un script cron
Read more