Iproute2
Inhaltsverzeichnis
general
for all commands (route|rule|...) the subcommand 'show' is the default!
so if you run command e.g.: 'ip route' its the same as 'ip route show'.
routing table
Show, add, delete and manipulate routes!
show routes
ip route
or
ip route show
or
ip route show table MyFuckingROUTES
be sure to add something like this to the file where the names (they identify by number normally)
for routing tables are defined/mapped to the numbers.
so edit the file: /etc/iproute2/rt_tables and add a line like:
200 MyFuckingROUTES
the numbers 253, 254, 255 and 0 are reserved!
since iproute can handle multiple routing tables
and you can decide which table has to be used on specific packet attributes
these rules can be shown/set using ip rules command.
get routing decision
ip route get returns the routing decision based on the parameters
if such a packet would reach the system through network.
# ip route get 10.20.30.40 from 192.168.5.6 10.20.30.40 from 192.168.5.6 via 172.16.10.1 dev eth0 cache mtu 1500 advmss 1460 hoplimit 64
Usage:
ip route get ADDRESS [ from ADDRESS iif STRING ] [ oif STRING ] [ tos TOS ]
Usage: ip route
Usage: ip route { list | flush } SELECTOR ip route get ADDRESS [ from ADDRESS iif STRING ] [ oif STRING ] [ tos TOS ] ip route { add | del | change | append | replace | monitor } ROUTE SELECTOR := [ root PREFIX ] [ match PREFIX ] [ exact PREFIX ] [ table TABLE_ID ] [ proto RTPROTO ] [ type TYPE ] [ scope SCOPE ] ROUTE := NODE_SPEC [ INFO_SPEC ] NODE_SPEC := [ TYPE ] PREFIX [ tos TOS ] [ table TABLE_ID ] [ proto RTPROTO ] [ scope SCOPE ] [ metric METRIC ] INFO_SPEC := NH OPTIONS FLAGS [ nexthop NH ]... NH := [ via ADDRESS ] [ dev STRING ] [ weight NUMBER ] NHFLAGS OPTIONS := FLAGS [ mtu NUMBER ] [ advmss NUMBER ] [ rtt TIME ] [ rttvar TIME ] [ window NUMBER] [ cwnd NUMBER ] [ hoplimit NUMBER ] [ initcwnd NUMBER ] [ ssthresh NUMBER ] [ realms REALM ] [ src ADDRESS ] [ rto_min TIME ] TYPE := [ unicast | local | broadcast | multicast | throw | unreachable | prohibit | blackhole | nat ] TABLE_ID := [ local | main | default | all | NUMBER ] SCOPE := [ host | link | global | NUMBER ] FLAGS := [ equalize ] MP_ALGO := { rr | drr | random | wrandom } NHFLAGS := [ onlink | pervasive ] RTPROTO := [ kernel | boot | static | NUMBER ] TIME := NUMBER[s|ms|us|ns|j]
routing rules
ip rule show
![]() |
TODO: mach et! |
Usage: ip rule
Usage: ip rule [ list | add | del | flush ] SELECTOR ACTION SELECTOR := [ not ] [ from PREFIX ] [ to PREFIX ] [ tos TOS ] [ fwmark FWMARK[/MASK] ] [ dev STRING ] [ pref NUMBER ] ACTION := [ table TABLE_ID ] [ prohibit | reject | unreachable ] [ realms [SRCREALM/]DSTREALM ] [ goto NUMBER ] TABLE_ID := [ local | main | default | NUMBER ]