Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides

FAQ
It is currently Tue Nov 20, 2018 4:24 am


Internet Protocol, Transport Control Protocol, Network protocols, Routing, Routers, IP aliases, Routes, Ethernet

Author Message
mandrei99
Post  Post subject: Linux list the outgoing interface for packets to a specific IP destination  |  Posted: Mon Jul 22, 2013 10:17 am

Joined: Tue Aug 04, 2009 9:16 am
Posts: 250

Offline
 

Linux list the outgoing interface for packets to a specific IP destination

To be able to get the outgoing interface for traffic to a specific destination, the iproute package needs to be installed:
Code:
# dpkg -S `which ip`
iproute: /sbin/ip


Use "apt-get install iproute" or "yum install iproute" command for Debian/Ubuntu and Centos/RHEL/Fedora (assuming correct repositories are enabled).

Code:
# ip ro get help
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 ]
             [ mpath MP_ALGO ]
INFO_SPEC := NH OPTIONS FLAGS [ nexthop NH ]...
NH := [ via ADDRESS ] [ dev STRING ] [ weight NUMBER ] NHFLAGS
OPTIONS := FLAGS [ mtu NUMBER ] [ advmss NUMBER ]
           [ rtt NUMBER ] [ rttvar NUMBER ]
           [ window NUMBER] [ cwnd NUMBER ] [ initcwnd NUMBER ]
           [ ssthresh NUMBER ] [ realms REALM ]
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 ]

# ip ro get 10.1.1.1
10.1.1.1 via 172.30.10.1 dev eth0  src 172.30.10.230
    cache  mtu 1500 advmss 1460 hoplimit 64


The above output shows that traffic for destination IP 10.1.1.1 will go out the box via eth0 interface using source 172.30.10.230





Top
Display posts from previous:  Sort by  
E-mail friendPrint view

Topics related to - "Linux list the outgoing interface for packets to a specific IP destination"
 Topics   Author   Replies   Views   Last post 
There are no new unread posts for this topic. FreeBSD list the outgoing interface for packets to a specific IP destination

mandrei99

0

1332

Mon Jul 22, 2013 10:12 am

mandrei99 View the latest post

There are no new unread posts for this topic. FreeBSD + IPerf send multicast source traffic via specific interface

mandrei99

3

4017

Sat Apr 11, 2015 5:28 am

areeba View the latest post

There are no new unread posts for this topic. FreeBSD + IPERF sending IGMP v2 multicast group join / leave via specific interface

mandrei99

0

4636

Mon Jul 22, 2013 10:41 am

mandrei99 View the latest post

There are no new unread posts for this topic. KVM: List MAC address table and interface that learned them.

mandrei99

0

2193

Sun Feb 01, 2015 6:26 am

mandrei99 View the latest post

There are no new unread posts for this topic. FreeBSD list interface multicast group membership

mandrei99

0

2475

Tue Dec 03, 2013 9:02 am

mandrei99 View the latest post

There are no new unread posts for this topic. Linux How to change hardware MAC address of an interface

debuser

1

1769

Tue Dec 06, 2011 6:26 am

Zettie49 View the latest post

There are no new unread posts for this topic. Linux script for interface network bandwidth monitoring

admin

0

2117

Mon Feb 09, 2015 7:05 pm

admin View the latest post

There are no new unread posts for this topic. Linux: How to list IPv6 neighbors

mandrei99

0

1877

Thu Oct 09, 2014 3:11 am

mandrei99 View the latest post

There are no new unread posts for this topic. "OSPF not enabled on this interface" FreeBSD Quagga ospfd interface status

debuser

1

3741

Thu Apr 01, 2010 5:55 am

debuser View the latest post

There are no new unread posts for this topic. TCP ack after two packets

MichaM

2

1379

Tue Dec 13, 2016 10:04 am

humdrum View the latest post

 

Who is online
Users browsing this forum: No registered users and 1 guest
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
Jump to:  
News News Site map Site map SitemapIndex SitemapIndex RSS Feed RSS Feed Channel list Channel list


Delete all board cookies | The team | All times are UTC - 5 hours [ DST ]



phpBB SEO