Configure Linux IPv4 Routing

In this “Configure Linux IPv4 Routing” hands-on virtual lab, learners will learn how to configure Linux IPv4 routing by using the Netplan config YAML file and two subnets. The skills learned in this virtual lab are important for learners to be effective in the Linux administrator job role in IT.

1 hour
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *

Already have an account? Sign In »


IP routing is the method of moving data from source to target on a defined path over two or more networks. It allows two or more devices on various TCP/IP networks to connect. IP routing gives the path for touching the target device. Internet Protocol version 4 (IPv4) is a communications protocol. It is utilized for sending network packets over a collection of connected networks using the Internet Protocol Suite. Routing sends network-layer data packets across correlated autonomous subnets. Each subnet is allotted an IP address range, and each device on the subnet is given an IP address from that range.

In other words, IP Routing is an essential term for the collection of protocols that define the path that data pursues to move over multiple networks from its source to its target. Information is routed from its origin to its destination over a series of routers, and various networks. In this hands-on lab, learners will learn how to configure Linux IPv4 routing. The other expert challenge in this series is “Can You Troubleshoot Linux Network Problems?”.

Understand the Scenario

In this virtual lab, you are the Linux administrator for your organization. Your manager has asked you to configure a multi-homed Ubuntu Linux host named Ubuntu1 as an IPv4 router between two subnets ( and For accomplishing this challenge, you will use a different Linux host named Ubuntu2 to test routing through Ubuntu1. In this challenge, learners will use two Ubuntu Linux virtual machines called Ubuntu1 and Ubuntu2.

Assign IPv4 addresses to Ubuntu1

IPv4 address relates to a logical address. It is a configurable address utilized to recognize which network this host refers to and also a network-specific host number. In other words, an IPv4 address has two components; a network part and a host part. In this first section of the virtual lab, learners will learn how to assign IPv4 addresses to Ubuntu1. On the Ubuntu1 virtual machine, they will use the netplan config YAML file to configure the following:

  • Assign to the eth0 interface on Ubuntu1.
  • Assign to the eth1 interface on Ubuntu1.
  • Configure as default gateway IP address for Ubuntu1.
  • Enable IPv4 forwarding on Ubuntu1.
  • Apply the netplan settings.

Netplan is used for the configuration of networking on several Linux distributions. It applies YAML specification files.

Assign an IPv4 address to Ubuntu2

After assigning the IPv4 address to Ubuntu1, in this section, learners will now assign IPv4 to Ubuntu2. For this, on the Ubuntu2 virtual machine they will edit the netplan config YAML file to configure the following:

  • Assign to the eth0 interface on Ubuntu2.
  • Configure (Ubuntu1) as default gateway IP address for Ubuntu2.
  • Do not alter the eth1 and eth2 interfaces.
  • Apply the netplan settings.

Learners will use the IP route command to determine the default route via the local subnet IP address of the server to make sure the routing is correct. Finally, they will make sure that both IP addresses are pingable from the server.

Lab Summary Conclusion

After completing the “Configure Linux IPv4 Routing” virtual lab, you will have accomplished the following:

  • Configured IPv4 addressing on Linux hosts.
  • Enabled and tested IP forwarding on a Linux host with two network interfaces.

Quick Info

  • Skills: Edit network interface addresses and gateways as part of netplan configuration, Verify routing using route commands, Verify connectivity using pings
  • Time limit: 60 minutes
  • Skill level: Advanced/Intermediate
  • Work Roles: All-Source Analyst, All Source-Collection Manager, Cyber Defense Forensics Analyst, Cyber Intel Planner, Cyber Operator, Cyber Ops Planner, Exploitation Analyst, Target Developer, Target Network Analyst, Technical Support Specialist, Threat/Warning Analyst, Vulnerability Assessment Analyst