In this lab, we will use Linux IP Forwarding to connect 02 different subnets together.
We need 03 Linux VMWare machines with the model as below:
1. Linux 1: 01 NIC eth0, connect to VMNet2: 192.168.2.0/24
2. Linux 2: 02 NIC
– eth0 connect to VMNet2 192.168.2.0/24
– eth1 connect to VMNet3 192.168.3.0/24
3. Linux 3: 01 NIC eth0, connect to VMNet3: 192.168.3.0/24
After configuring, Linux 1 will ping Linux 3 successfully.
1. Configure Linux 1
All we need is set up eth0 of Linux 1 as below:
2. Configure Linux 3
All we need is set up eth0 of Linux 3 as below:
3. Configure Linux 2
This is the most important machine because it’s the bridge between 2 subnets. First, we need to set up eth0 and eth1 of Linux 2 as below:
Second, we need to enable ip forwarding function.
Edit file sysctl.conf as below:
Goto the line
net.ipv4.ip_forward = 0
Change it to
net.ipv4.ip_forward = 1
Save, exit, then restart network service:
service network restart
Ping Linux 3 from Linux 2 successfully.
This lab is done on:
[root@centos ~]# lsb_release -a | grep Description ; echo “Linux kernel: `uname -r`”
Description: CentOS release 5.7 (Final)
Linux kernel: 2.6.18-274.18.1.el5