Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides
https://forum.ivorde.com/

FreeBSD list the outgoing interface for packets to a specific IP destination
https://forum.ivorde.com/freebsd-list-the-outgoing-interface-for-packets-to-a-specific-ip-destination-t14811.html
Page 1 of 1

Author:  mandrei99 [ Mon Jul 22, 2013 10:12 am ]
Post subject:  FreeBSD list the outgoing interface for packets to a specific IP destination

Man route quote:
Quote:
# man route
ROUTE(8) FreeBSD System Manager's Manual ROUTE(8)

NAME
route -- manually manipulate the routing tables

SYNOPSIS
route [-dnqtv] command [[modifiers] args]

DESCRIPTION
The route utility is used to manually manipulate the network routing
tables. It normally is not needed, as a system routing table management
daemon, such as routed(8), should tend to this task.

The route utility supports a limited number of general options, but a
rich command language, enabling the user to specify any arbitrary request
that could be delivered via the programmatic interface discussed in
route(4).

The following options are available:

-d Run in debug-only mode, i.e., do not actually modify the routing
table.

-n Bypass attempts to print host and network names symbolically when
reporting actions. (The process of translating between symbolic
names and numerical equivalents can be quite time consuming, and
may require correct operation of the network; thus it may be
expedient to forget this, especially when attempting to repair
networking operations).

-t Run in test-only mode. /dev/null is used instead of a socket.

-v (verbose) Print additional details.

-q Suppress all output from the add, change, delete, and flush com-
mands.

The route utility provides the following commands:

add Add a route.
flush Remove all routes.
delete Delete a specific route.
del Another name for the delete command.
change Change aspects of a route (such as its gateway).
get Lookup and display the route for a destination.
monitor Continuously report any changes to the routing information
base, routing lookup misses, or suspected network partition-
ings.

The monitor command has the syntax:

route [-n] monitor

The flush command has the syntax:

route [-n] flush [family]



Get the outgoing interface for traffic destined for specific IP address.
Code:
# route get 10.0.0.1
   route to: 10.0.0.1
destination: default
       mask: default
    gateway: apollo-vl10.ivorde.ro
  interface: vlan10
      flags: <UP,GATEWAY,DONE,STATIC>
recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
       0         0         0         0         0         0      1500         0 

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/