Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Man ip route add:
- Synopsis:
- ip route { add | del | change | append | replace } 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 ] [ reordering NUMBER ] [ window NUMBER ] [ cwnd NUMBER ] [ ssthresh REALM ] [ realms REALM ] [ rto_min TIME ] [ initcwnd NUMBER ] [ initrwnd NUMBER
- ] [ quickack BOOL ]
- TYPE := [ unicast | local | broadcast | multicast | throw | unreachable | prohibit | blackhole | nat ]
- TABLE_ID := [ local| main | default | all | NUMBER ]
- SCOPE := [ host | link | global | NUMBER ]
- NHFLAGS := [ onlink | pervasive ]
- RTPROTO := [ kernel | boot | static | NUMBER ]
- Description
- ip route add
- add new route
- Example
- ip route add default via 192.168.1.1 dev eth0
- Adds a default route (for all addresses) via the local gateway 192.168.1.1 that can be reached on device eth0.
- Man route add:
- SYNOPSIS
- route [-v] [-A family |-4|-6] add [-net|-host] target [netmask Nm] [gw Gw] [metric N] [mss M] [window W] [irtt I] [reject] [mod] [dyn] [reinstate] [[dev] If]
- DESCRIPTION
- Route manipulates the kernel's IP routing tables. Its primary use is to set up static routes to specific hosts or networks via an interface after it has been configured with the ifconfig(8) program.
- When the add or del options are used, route modifies the routing tables. Without these options, route displays the current contents of the routing tables.
- OPTIONS
- Concise and to the point descriptions for each option
- EXAMPLES (Lots of them!!)
- route add -net 127.0.0.0 netmask 255.0.0.0 dev lo
- adds the normal loopback entry, using netmask 255.0.0.0 and associated with the "lo" device (assuming this device was previously set up correctly with ifconfig(8)).
- route add -net 192.56.76.0 netmask 255.255.255.0 dev eth0
- adds a route to the local network 192.56.76.x via "eth0". The word "dev" can be omitted here.
- route del default
- deletes the current default route, which is labeled "default" or 0.0.0.0 in the destination field of the current routing table.
- route add default gw mango-gw
- adds a default route (which will be used if no other route matches). All packets using this route will be gatewayed through "mango-gw". The device which will actually be used for that route depends on how we can reach
- "mango-gw" - the static route to "mango-gw" will have to be set up before.
- route add ipx4 sl0
- Adds the route to the "ipx4" host via the SLIP interface (assuming that "ipx4" is the SLIP host).
- route add -net 192.57.66.0 netmask 255.255.255.0 gw ipx4
- This command adds the net "192.57.66.x" to be gatewayed through the former route to the SLIP interface.
- route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
- This is an obscure one documented so people know how to do it. This sets all of the class D (multicast) IP routes to go via "eth0". This is the correct normal configuration line with a multicasting kernel.
- route add -net 10.0.0.0 netmask 255.0.0.0 reject
- This installs a rejecting route for the private network "10.x.x.x."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement