# How to correlate PCI NIC port with device file in /dev



## kezogergs (Aug 23, 2017)

`pciconf`tells me I have a 2 port ix NIC in PCI slot. The interfaces are working fine. I need to figure out which files in /dev correspond to the interfaces on the card. Any help would be greatly appreciated. More generally, how do I tell what some of these files are? I recognize some basic ones, but I have no idea what some the others are. I'm sure this has been asked before, but google and I have not found the answer. 


```
[root@node0 /dev]# ls -a 

.        bpf0        cpuctl18    cpuctl3        cuau1        ipmi0        mem        random        ttyu1.init    ttyvb    ukbd0

..        console        cpuctl19    cpuctl30    cuau1.init    kbd0        midistat    reroot        ttyu1.lock    ttyvc    ums0

acpi        consolectl    cpuctl2        cpuctl31    cuau1.lock    kbd1        nfslock        ses0        ttyv0        ttyvd    urandom

ad12        cpuctl0        cpuctl20    cpuctl4        devctl        kbdmux0        node0hdd0    ses1        ttyv1        ttyve    usb

ad12p1        cpuctl1        cpuctl21    cpuctl5        devctl2        klog        null        sndstat        ttyv2        ttyvf    usbctl

ad12s2        cpuctl10    cpuctl22    cpuctl6        devstat        kmem        nvd0        stderr        ttyv3        ufssuspend    xpt0

ada0        cpuctl11    cpuctl23    cpuctl7        diskid        label        nvme0        stdin        ttyv4        ugen0.1    zero

ada0p1        cpuctl12    cpuctl24    cpuctl8        dumpdev        led        nvme0ns1    stdout        ttyv5        ugen0.2

ada0s2        cpuctl13    cpuctl25    cpuctl9        fd        log        pass0        sysmouse    ttyv6        ugen0.3

apm        cpuctl14    cpuctl26    ctty        fido        md0        pass1        ttyu0        ttyv7        ugen1.1

apmctl        cpuctl15    cpuctl27    cuau0        geom.ctl    md1        pass2        ttyu0.init    ttyv8        ugen1.2

audit        cpuctl16    cpuctl28    cuau0.init    hpet0        md2        pci        ttyu0.lock    ttyv9        ugen2.1

bpf        cpuctl17    cpuctl29    cuau0.lock    io        mdctl        pts        ttyu1        ttyva        ugen2.2
```


----------



## obsigna (Aug 23, 2017)

kezogergs said:


> `pciconf`tells me I have a 2 port ix NIC in PCI slot. The interfaces are working fine. I need to figure out which files in /dev correspond to the interfaces on the card. Any help would be greatly appreciated. More generally, how do I tell what some of these files are? I recognize some basic ones, but I have no idea what some the others are. I'm sure this has been asked before, but google and I have not found the answer.
> 
> `[root@node0 /dev]# ls -a
> 
> ...


The output of the command `ifconfig` will tell you the device identifiers of your interfaces. Don't ask me why, however, as a matter of fact, the NIC devices are not instantiated in the /dev directory, and for this reason you don't find your NIC devices in there.

Anyway, most of the devices are documented by man(1) files. Simply try `man bpf` or `man cpuctl` or `man ix` or ... You need to ask for the manual of the device identifier without the index, e.g. `man ada` and NOT `man ada0`.


----------



## ShelLuser (Aug 23, 2017)

(ninja'd but.. oh well )



kezogergs said:


> `pciconf`tells me I have a 2 port ix NIC in PCI slot. The interfaces are working fine. I need to figure out which files in /dev correspond to the interfaces on the card.


None. All network configuration is done using ifconfig(8).

/dev is a virtual filesystem which is managed through devfs and to my knowledge only disk, memory, tape and tty type files are included there. I base this conclusion on devfs(8).

_However..._ If you set up a virtual network device, for example a tunnel device (see tun(4)) then this will show up. From what I gather from the manual pages the main reason for that is because the tunnel device is considered to be loosely related to pty(4). This behavior can be configured through use of the net.link.tun.devfs_cloning node (see sysctl(8)).

I do not know the official reason why network devices don't show up in /dev, but my theory is that this is mostly because of the way network devices behave. A NIC doesn't really use serial data (or a data stream) but instead relies on packets which is basically a collection of data.

So I think this eventually made /dev entries for network interfaces obsolete. Most network based software (that I know off) doesn't use bother with raw data at all anymore (so for example: something you might get from `# cat /dev/lo0`). You can easily see this for yourself: if you want to dump network traffic you'd normally use tcpdump(1). Well, check the manual page and you'll notice that it only dumps (and uses) packets, not raw serialized data.

As always: just my 2 cents here.


----------

