Linux
HOGENT toegepaste informatica
Thomas Parmentier, Andy Van Maele, Bert Van Vreckem, Jan Willem
2025-2026
Om Internettoegang mogelijk te maken zijn er 3 instellingen nodig:
ip address (ip a)ip route (ip r)cat /etc/resolv.confsystemd-resolved: resolvectl dnsWat is mijn publiek IP-adres?
(op de AlmaLinux VM, vóór uitvoeren van labo 3.4)
hogent@almaserver:~$ ip -4 a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
altname enx08002743cbc1
inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic noprefixroute enp0s3
valid_lft 86250sec preferred_lft 86250secProbeer dit ook op de Linux GUI VM. Overeenkomsten? Verschillen?
Probeer ook:
ip a show dev enp0s3ip -br aip -6 aip link of ip lip route, ip -6 routeip neigh of ip nTip: tab-completion werkt ook (mits installatie
bash-completion)
Voor deze opstelling:
lo (loopback): 127.0.0.1/8eth0/enp0s3 = 1e VirtualBox adapter (NAT):
10.0.2.15/24eth1/enp0s8 = 2e VirtualBox adapter
(intnet):
Met NetworkManager, via nmcli. Probeer:
$ nmcli connection show
$ nmcli -f ipv4 connection show enp0s3
$ nmcli device status
$ nmcli device show enp0s3
$ nmcli -f IP4 device show enp0s3
hogent@almaserver:~$ sudo nmcli connection modify enp0s8 ipv4.method static ipv4.addresses 192.168.76.254/24
hogent@almaserver:~$ sudo nmcli connection up enp0s8
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)
hogent@almaserver:~$ ip -br -4 a show dev enp0s8
enp0s8 UP 192.168.76.254/24
Configuratiebestanden:
/etc/NetworkManager/system-connections/
Configuratiebestand /etc/network/interfaces
Voorbeeld met DHCP:
# DHCP
allow-hotplug enp0s3
iface enp0s3 inet dhcp
iface enp0s3 inet6 auto
pre-up sleep 2
Voorbeeld met vast IP-adres:
# Static
allow-hotplug enp0s8
iface enp0s8 inet static
address 192.168.76.13
netmask 255.255.255.0
of
Let op: kan niet op EL10!
Zoek de naam van de package om ISC DHCP te installeren!
Zie opgave labo 3.4
/etc/dhcp/dhcpd.conf/usr/share/doc/dhcp-server/dhcpd.conf.examplesystemctlsudo systemctl start dhcpdsystemctl status dhcpdsudo systemctl restart dhcpd
sudo systemctl enable [--now] dhcpd
--now start meteenZie https://hogenttin.github.io/linux-training-hogent/opslinux/dhcp_kea/
/etc/kea/kea-dhcp4.conf/usr/share/doc/kea/examples/kea4/single-subnet.jsonsystemctlsudo systemctl start kea-dhcp4systemctl status kea-dhcp4sudo systemctl restart kea-dhcp4
sudo systemctl enable [--now] kea-dhcp4tcpdump, bv.
sudo tcpdump -w dhcp.pcap -i eth1 port 67 or port 68sudo tcpdump -r dhcp.pcap -ne#sudo journalctl -f -u dhcpd.servicesudo journalctl -f -u kea-dhcp4.service