Linux Networking
Interfaces
List Ethernet Interfaces on Host
You can use lspci
to list PCI-based Ethernet devices on a system.
[root@mawenzi-04 ~]# lspci | grep -i ethernet
c6:00.0 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)
c6:00.1 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)
c6:00.2 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)
c6:00.3 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)
Bringing Interfaces Up/Down
Two methods can be used to bring interfaces up or down.
This does not persist across boots. Once you reboot the node, the link will return to its default state. |
Using ip
# ip link set dev <interface> up
# ip link set dev <interface> down
Examples:
ip link set dev eth0 up
ip link set dev eth0 down
Using ifconfig`
# /sbin/ifconfig <interface> up
# /sbin/ifconfig <interface> down
Examples:
/sbin/ifconfig eth0 up
/sbin/ifconfig eth0 down
Hostname
Set hostname using hostnamectl
hostnamectl set-hostname NAME
Set hostname at boot time by editing the grub boot parameters and adding hostname=NAME
Proxies
Set proxy environment for HPE LR1: See Proxies
Firewalls
Disable the firewalld
firewall daemon:
systemctl stop firewalld
systemctl disable firewalld
Disable SELinux
setenforce 0
RHEL NetworkManager
The newer style of managing Linux networking, particularly in Rocky Linux 9.X going forward. The older ifconfig
network scripts are no longer being used.
In NetworkManager, devices need to be mapped to connections. A connection is a set of configuration options that can be applied to a device. A device can only have one active connection at a time.
NOTE:
Network Manager stores its connections in /etc/NetworkManager/system-connections
:
[root@mawenzi-06 ~]# ls /etc/NetworkManager/system-connections
ens10f0.nmconnection ens10f1.nmconnection ibs1.nmconnection ibs2.nmconnection
Cracking one of these open we can find critical information about the connection:
[root@mawenzi-06 ~]# cat /etc/NetworkManager/system-connections/ibs1.nmconnection
[connection]
id=ibs1
uuid=bb07b153-64ef-40a9-a703-6beb14b779da
type=infiniband
interface-name=ibs1
timestamp=1702504605
[infiniband]
transport-mode=datagram
[ipv4]
address1=192.168.0.106/24
method=manual
[ipv6]
addr-gen-mode=eui64
method=auto
[proxy]
Network Manager CLI (nmcli
)
CLI tool to manage network connections and devices.
Basic Usage
[root@mawenzi-06 ~]# nmcli connection show --active
NAME UUID TYPE DEVICE
ens10f0 8a649da4-5810-42a2-b166-2040fddf936c ethernet ens10f0
ibs1 bb07b153-64ef-40a9-a703-6beb14b779da infiniband ibs1
lo 60cee16c-b863-49a7-a05b-0799d42d0a8f loopback lo
[root@mawenzi-06 ~]# nmcli connection show
NAME UUID TYPE DEVICE
ens10f0 8a649da4-5810-42a2-b166-2040fddf936c ethernet ens10f0
ibs1 bb07b153-64ef-40a9-a703-6beb14b779da infiniband ibs1
lo 60cee16c-b863-49a7-a05b-0799d42d0a8f loopback lo
ens10f1 31322100-19b2-4893-83a7-c144ad23ec40 ethernet --
ibs2 95566e3f-d259-40c7-8cec-744694d0ba38 infiniband --
[root@mawenzi-06 ~]# nmcli device status
DEVICE TYPE STATE CONNECTION
ens10f0 ethernet connected ens10f0
ibs1 infiniband connected ibs1
lo loopback connected (externally) lo
ens10f1 ethernet unavailable --
ibs2 infiniband unavailable --
[root@mawenzi-06 ~]# nmcli device show ibs1
GENERAL.DEVICE: ibs1
GENERAL.TYPE: infiniband
GENERAL.HWADDR: 00:00:10:29:FE:80:00:00:00:00:00:00:94:40:C9:FF:FF:B3:3B:60
GENERAL.MTU: 2044
GENERAL.STATE: 100 (connected)
GENERAL.CONNECTION: ibs1
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/3
IP4.ADDRESS[1]: 192.168.0.106/24
IP4.GATEWAY: --
IP4.ROUTE[1]: dst = 192.168.0.0/24, nh = 0.0.0.0, mt = 150
IP6.ADDRESS[1]: fe80::9640:c9ff:ffb3:3b60/64
IP6.GATEWAY: --
IP6.ROUTE[1]: dst = fe80::/64, nh = ::, mt = 1024
[root@mawenzi-06 ~]# nmcli device show ibs2
GENERAL.DEVICE: ibs2
GENERAL.TYPE: infiniband
GENERAL.HWADDR: 00:00:10:29:FE:80:00:00:00:00:00:00:94:40:C9:FF:FF:88:DD:98
GENERAL.MTU: 4092
GENERAL.STATE: 20 (unavailable)
GENERAL.CONNECTION: --
GENERAL.CON-PATH: --
IP4.GATEWAY: --
IP6.GATEWAY: --