RHCSA Rapid Track
In this lab, you will configure network settings using nmcli.
Outcomes
Convert a system from DHCP to static configuration.
Reset your serverX system.
View network settings using nmcli.
Show all connections.
[student@serverX ~]$nmcli con showNAME UUID TYPE DEVICE System eth0 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 802-3-ethernet eth0Display all configuration settings for the active connection.
[student@serverX ~]$nmcli con show "System eth0"connection.id: System eth0 connection.uuid: 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 connection.interface-name: eth0 connection.type: 802-3-ethernet connection.autoconnect: yes connection.timestamp: 1394813303 connection.read-only: no connection.permissions: ... IP4.ADDRESS[1]: ip = 172.25.X.11/24, gw = 172.25.X.254 IP4.DNS[1]: 172.25.254.254 IP4.DOMAIN[1]: example.com ...Show device status.
[student@serverX ~]$nmcli dev statusDEVICE TYPE STATE CONNECTION eth0 ethernet connected System eth0 lo loopback unmanaged --Display the settings for the eth0 device.
[student@serverX ~]$nmcli dev show eth0GENERAL.DEVICE: eth0 GENERAL.TYPE: ethernet GENERAL.HWADDR: 52:54:00:00:00:0B GENERAL.MTU: 1500 GENERAL.STATE: 100 (connected) GENERAL.CONNECTION: System eth0 GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/1 WIRED-PROPERTIES.CARRIER: on IP4.ADDRESS[1]: ip = 172.25.X.11/24, gw = 172.25.X.254 IP4.DNS[1]: 172.25.254.254 IP4.DOMAIN[1]: example.com IP6.ADDRESS[1]: ip = fe80::5054:ff:fe00:b/64, gw = ::
Create a static connection with the same IPv4 address, network prefix, and default gateway. Name the new connection static-eth0.
[student@serverX ~]$sudo nmcli con add con-name "static-eth0" ifname eth0 type ethernet ip4 172.25.Connection 'static-eth0' (f3e8dd32-3c9d-48f6-9066-551e5b6e612d) successfully added.X.11/24 gw4 172.25.X.254Modify the new connection to add the DNS setting.
[student@serverX ~]$sudo nmcli con mod "static-eth0" ipv4.dns 172.25.254.254Display and activate the new connection.
View all connections.
[student@serverX ~]$nmcli con showNAME UUID TYPE DEVICE static-eth0 f3e8dd32-3c9d-48f6-9066-551e5b6e612d 802-3-ethernet -- System eth0 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 802-3-ethernet eth0View the active connection.
[student@serverX ~]$nmcli con show --activeSystem eth0 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 802-3-ethernet eth0Activate the new connection.
[student@serverX ~]$sudo nmcli con up "static-eth0"Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/3)View the active connection.
[student@serverX ~]$nmcli con show --activeNAME UUID TYPE DEVICE static-eth0 f3e8dd32-3c9d-48f6-9066-551e5b6e612d 802-3-ethernet eth0
Test the connectivity using the new network addresses.
Verify the IP address.
[student@serverX ~]$ip addr show eth02: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 52:54:00:00:00:0b brd ff:ff:ff:ff:ff:ff inet 172.25.X.11/24 brd 172.25.X.255 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::5054:ff:fe00:b/64 scope link valid_lft forever preferred_lft foreverVerify the default gateway.
[student@serverX ~]$ip routedefault via 172.25.X.254 dev eth0 proto static metric 1024 172.25.X.0/24 dev eth0 proto kernel scope link src 172.25.X.11Ping the DNS address.
[student@serverX ~]$ping -c3 172.25.254.254PING 172.25.254.254 (172.25.254.254) 56(84) bytes of data. 64 bytes from 172.25.254.254: icmp_seq=1 ttl=64 time=0.419 ms 64 bytes from 172.25.254.254: icmp_seq=2 ttl=64 time=0.598 ms 64 bytes from 172.25.254.254: icmp_seq=3 ttl=64 time=0.503 ms --- 172.25.254.254 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 1999ms rtt min/avg/max/mdev = 0.419/0.506/0.598/0.077 ms
Configure the original connection so that it does not start at boot and verify that the static connection is used when the system reboots.
Disable the original connection from autostarting at boot.
[student@serverX ~]$sudo nmcli con mod "System eth0" \>connection.autoconnect noReboot the system.
[student@serverX ~]$rebootView the active connection.
[student@serverX ~]$nmcli con show --activeNAME UUID TYPE DEVICE static-eth0 f3e8dd32-3c9d-48f6-9066-551e5b6e612d 802-3-ethernet eth0