tech:notes_-_routage_statique
Table des matières
Notes - routage statique
Voir aussi :
AWS RedHat
/etc/sysconfig/network-scripts/route-eth0
10.0.0.0/8 via 10.240.122.1 dev eth0
/etc/sysconfig/network-scripts/ec2net-functions
#DEFROUTE=no
/etc/sysconfig/network-scripts/ifcfg-eth1
#DEFROUTE=no
Paquets sur la même interface
I want packets to leave the same interface they came in.
Nommer les nouvelles tables
echo "100 net0" >> /etc/iproute2/rt_table echo "101 net1" >> /etc/iproute2/rt_table
/etc/sysconfig/network-scripts/route-eth0
10.0.0.0/8 via 10.240.122.1 dev eth0 table net0
/etc/sysconfig/network-scripts/route-eth1
10.0.0.0/8 via 10.240.123.1 dev eth1 table net1
/etc/sysconfig/network-scripts/rule-eth0
#iff lo table net0 iif eth0 table net0 from 10.240.122.223 table net0
Ici 10.240.122.223 est l'adresse IP de eth0
/etc/sysconfig/network-scripts/rule-eth1
iif eth1 table net1 from 10.240.123.30 table net1
10.240.123.30 est l'adresse IP de eth1
Appliquer la conf
#ip route flush cache #ip route flush table net0 #ip route flush table net1 systemctl restart network
Debian
Source : https://blog.bluemalkin.net/multiple-ips-and-enis-on-ec2-in-a-vpc/
echo "101 eth1_rt" >> /etc/iproute2/rt_table
/etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp
# The second network interface
auto eth1
iface eth1 inet static
address 10.0.2.10
netmask 255.255.255.0
network 10.0.2.0
broadcast 10.0.2.255
up ip route add default via 10.0.2.1 dev eth1 table eth1_rt
up ip rule add from 10.0.2.0/24 lookup eth1_rt prio 1000
Commande ip iproute2
man ip-route man ip-rule
Pb
Err argument "lock" is wrong
# ip route show default default via 192.168.1.1 dev ens4 proto dhcp src 192.168.1.190 metric 100 rto_min lock 8ms default via 192.168.1.1 dev ens4 proto dhcp src 192.168.1.190 metric 100 # ip route delete default via 192.168.1.1 dev ens4 proto dhcp src 192.168.1.190 metric 100 rto_min lock 8ms Error: argument "lock" is wrong: "rto_min" value is invalid
Solution
Rappeler la commande sans le paramètre lock
ip route delete default via 192.168.1.1 dev ens4 proto dhcp src 192.168.1.190 metric 100 rto_min 8ms
Voir aussi : ip route replace
tech/notes_-_routage_statique.txt · Dernière modification : de Jean-Baptiste
