[j-nsp] juniper switch ex2200 how to find port from ip address?

Phil Mayers p.mayers at imperial.ac.uk
Tue Aug 26 08:06:00 EDT 2014


On 26/08/14 12:22, Evangelos Kanarelis wrote:
> Hello everybody
>
> I am relatively new to networking and I am currently managing a few
> EX2200 switches.
>
> I need to find to which port a machine is connected to, but all I
> have is an IP Address. I know that I can use show ethernet-switching
> table brief but unfortunately I do not have the MAC address.
>
> Any help would be greatly appreciated.

When you have time, consider looking into running something like 
Netdisco against your switches and routers.

Without a MAC, it's not straightforward.

It's not really difficult either, but if you're new to networking all 
the suggestions I can think of (put an IP address on the ports vlan, 
ping the host, look in the ARP table; put a logging firewall filter in, 
look for matches; enable DHCP/ARP snooping) carry a risk of breaking things.

It would be a lot easier if you could find the MAC address from the 
router. Can you really not do that?

Or if you can get to the host, just unplug then re-attach the host, then 
look in the switch logs for which port just came up.

If not, the "safest" thing is probably to modify the switch to have an 
IP address on the port VLAN and ping the host, then find the MAC from 
the ARP table like so:

== Add the IP to the vlan ==

configure
set vlan <name> l3-interface vlan.<tag>
set interfaces vlan unit <tag> family inet address <ip/mask>
commit

== Find the IP/MAC/port ==

run ping <ip> count 1
run show arp no-resolve hostname <ip>
run show ethernet-switching table | match <MAC from the ARP output>

== Undo adding the IP

rollback 1
commit



More information about the juniper-nsp mailing list