Solved network interface is plugged cable?

Solved issue

soolan

Member
Joined
Jan 13, 2023
Messages
66
Reaction score
4
Credits
626
with the following commands are my checks correct?

in the first option 1 ones cable is plugged in

Code:
lrwxrwxrwx 1 root root 0 Dec  7 09:58 ens1f0np0 -> ../../devices/pci0000:0e/0000:0f:04.0/0000:40:00.0/net/ens1f0np0
lrwxrwxrwx 1 root root 0 Dec  7 09:58 ens1f1np1 -> ../../devices/pci0000:0e/0000:0e:04.0/0000:40:00.1/net/ens1f1np1
lrwxrwxrwx 1 root root 0 Dec  7 09:58 ens4f0np0 -> ../../devices/pci0000:65/0000:65:04.0/0000:85:00.0/net/ens4f0np0
lrwxrwxrwx 1 root root 0 Dec  7 09:58 ens4f1np1 -> ../../devices/pci0000:65/0000:65:04.0/0000:85:00.1/net/ens4f1np1



in the second option, write the interfaces one by one and find the link detected: yes

Code:
[root@localhost network-scripts]# ethtool  ens4f0np0
Settings for ens4f0np0:
        Supported ports: [ TP ]
        Supported link modes:   1000baseT/Full
                                10000baseT/Full
        Supported pause frame use: Symmetric Receive-only
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  1000baseT/Full
                                10000baseT/Full
        Advertised pause frame use: Symmetric
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Speed: 10000Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 12
        Transceiver: internal
        Auto-negotiation: on
        MDI-X: Unknown
        Supports Wake-on: d
        Wake-on: d
        Current message level: 0x00002001 (8193)
                               drv hw
        Link detected: yes
 


in the second option, write the interfaces one by one and find the link detected: yes

This looks like some kind of exercise. Homework? Assignment? Work?

What are you trying to do and why?

with the following commands are my checks correct?

What command? I see no command.
 
This looks like some kind of exercise. Homework? Assignment? Work?

What are you trying to do and why?



What command? I see no command.


Code:
ll /sys/sınıf/net

Code:
lrwxrwxrwx 1 kök kök 0 7 Aralık 09:58 ens1f0np0 -> ../../devices/pci0000:0e/0000:0f:04.0/0000:40:00.0/net/ens1f0np0
lrwxrwxrwx 1 kök kök 0 7 Aralık 09:58 ens1f1np1 -> ../../devices/pci0000:0e/0000:0e:04.0/0000:40:00.1/net/ens1f1np1
lrwxrwxrwx 1 kök kök 0 7 Aralık 09:58 ens4f0np0 -> ../../devices/pci0000:65/0000:65:04.0/0000:85:00.0/net/ens4f0np0
lrwxrwxrwx 1 kök kök 0 7 Aralık 09:58 ens4f1np1 -> ../../devices/pci0000:65/0000:65:04.0/0000:85:00.1/net/ens4f1np1

I could see which network interface the cable was connected to by looking at the desktop. And I assign IP to that interface

I have seen the two methods in the first message on the internet to see from the omut line without desktop. I opened a topic to learn how more experienced linux users check
 
It's worth pointing out first that the command in post #3:
Code:
ll /sys/sinif/net
made no sense to me because there is no directory "sinif".

If however, one navigates thus:
Code:
cd /sys/class/net
one will find the ethernet interfaces.

The list of files associated with an interface (in this case enp3s0) are thus:
Code:
[tom@min /sys/class/net/enp3s0]$ ls
addr_assign_type    flags                 phys_port_name
address             gro_flush_timeout     phys_switch_id
addr_len            ifalias               power
broadcast           ifindex               proto_down
carrier             iflink                queues
carrier_changes     link_mode             speed
carrier_down_count  mtu                   statistics
carrier_up_count    name_assign_type      subsystem
device              napi_defer_hard_irqs  testing
dev_id              netdev_group          threaded
dev_port            operstate             tx_queue_len
dormant             phydev                type
duplex              phys_port_id          uevent

If the interface is connected, the following command and output is likely:
Code:
[tom@min /sys/class/net/enp3s0]$ cat carrier
1

If the ethernet cable is not connected, the following output is likely:
Code:
[tom@min /sys/class/net/enp3s0]$ cat carrier
cat: carrier: Invalid argument.

Another means of checking the connection is to use the command: ethtool, using the interface names. The results for the ethernet interfaces below show output where the first interface (enp2s0) is connected, but the second one (enp4s0) is not.
Code:
[flip@flop ~]$ ethtool -a enp2s0
Pause parameters for enp2s0:
Autonegotiate:  on
RX:             off
TX:             off
RX negotiated: off
TX negotiated: off

[flip@flop ~]$ ethtool -a enp4s0
Pause parameters for enp4s0:
Autonegotiate:  on
RX:             off
TX:             off
netlink error: failed to retrieve link settings
netlink error: No such device
 
Last edited:

Staff online

Members online


Latest posts

Top