Red Hat Enterprise Linux




Chapters     |     Exercises     |     Workshop     |    

Networking



Network Interfaces

Usual Commands

[root@lab ~]# ifconfig active interfaces list and settings
[root@lab ~]# ifconfig interface-name display an interface settings.
[root@lab ~]# ifconfig -a active & inactive interfaces list and their properties
[root@lab ~]# ifup interface activate an interface
[root@lab ~]# ifconfig interface-name up activate an interface
[root@lab ~]# ifconfig interface-name down deactivate an interface
[root@lab ~]# ifconfig interface-name IPaddress netmask mask attribute temporary an IP address to an interface

[root@lab ~]# ip addr Show all Devices and address information
[root@lab ~]# ip addr show interface Show Device and address information
[root@lab ~]# ip -s link show interface Show statistics about network performance

Static Addressing

Method 1 : nmstate (RHEL 9)

Install nmsate package:


Create YAML format of network cards profile file


Edit YAML file


Apply Profile




Configuration Files


/etc/services services and their ports
/etc/sysconfig/network-scripts/ Network Cards Configuration files Directory
/etc/sysconfig/network-scripts/ifcfg-interfacename [+]

/etc/nsswitch DNS order file
/etc/resolv.conf DNS client file [+]

NB: Il est possible d'éditer le fichier /etc/resolv.conf pour indiquer les adresses des serveurs DNS. Mais la configuration sera temporaire car c'est un fichier qui est généré au démarrage du networking

Pour configurer les adresses DNS de facon permanente il faur l'éditer dans le fichier de configuration de la carte réseau


Ports and Services

netstat    |     ss

[root@lab ~]# netstat network statistics
[root@lab ~]# netstat -a all
[root@lab ~]# netstat -t specify TCP connections
[root@lab ~]# netstat -u specify UDP connections
[root@lab ~]# netstat -r show routage table
[root@lab ~]# netstat -c show in real time

[root@lab ~]# ss Display Sockets Statistics

Check opened port
  1. [root@redhat ~]# nc -Transport_protocol -z Host Port

  2. [root@redhat ~]# telnet Host Port

[root@redhat ~]# nc -u -z 10.0.0.7 53

[root@redhat ~]# nc -t -z 10.0.0.7 80


Routing

add a route
route add –net netIP/mask gw gatewayIP dev interface
route add default gw gatewayIP dev interface       for any network (0.0.0.0)

activate routage
edit /etc/sysctl.conf
net.ipv4.ip_forward = 0 change 0 to 1
tape command sysctl –p to activate settings and show settings

Show Routing Table

[root@lab ~]# route –n
[root@lab ~]# ip route
[root@lab ~]# netstat -r

Tracing Route
[root@lab ~]# traceroute host
[root@lab ~]# tracepath host

Eninam BAGNABANA     |         |     bagnadavid@outlook.fr     |