















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A step-by-step guide on how to configure linux as a router and enable ip forwarding. It explains the concept of ip networks, the need for ip forwarding, and the process of configuring linux as a router using rhel 7.2 and ubuntu 18.04 as examples. The document also covers setting ip addresses, configuring gateway ips, and testing connectivity.
Typology: Study notes
1 / 23
This page cannot be seen from the preview
Don't miss anything!
















Upon completion of this topic students will
able to:
o Configure and use Linux as a Router
o Explains how to enable IP forwarding in
Linux.
o Router is a special device that not only provides the
IP forwarding as the main function but also supports
several other IP based features such as; packet
filtering, voice over IP, IP firewall, etc.
o Router is an expensive device.
o Configuring it is also a complex task.
o Not every network, especially the small and home
office network, can afford it.
o Linux provides a zero-cost solution for the IP
forwarding.
o If you have a Linux system in your network, you can
use it for the IP forwarding.
The following image shows the IP configuration of
the PC-A (Windows 7).
The following image shows the IP configuration of
the PC-B (Ubuntu 18.04).
o Make a list of all gateway IPs which you assigned in your
network.
o For example, in my LAB I have two networks and the
default gateway IPs of both are; 192.168.1.1 and
o Now, configure all these gateway IP addresses in the
Linux system.
o You can use an individual network interface (LAN) for
each gateway IP or can use a single network interface for
all gateway IPs.
o Login from the root account and run the nmtui command.
o Select "Edit a connection" option and press
the Enter key.
o Confirm the IP configuration. To print the IP configuration of
all network interfaces, use the "ip addr" command.
o At this point, systems from different networks can access the
default gateway, but they can't access the system of another
network.
o To verify connectivity between systems and gateway, you can
use the ping command.
o Enabling IP forwarding on Linux
o Run the following command to enable the IP forwarding.
o #echo "1" > /proc/sys/net/ip4/ip_forward
o This command enables IP forwarding in the current
session. It does not make a change in that configuration
file which Linux reads at the startup. By default, the state
of IP forwarding is disabled in the configuration file. It
means Linux will automatically disable the IP
forwarding again when you will restart the system.