Linux IP Forwarding

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:

vi /etc/sysctl.conf

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

4. Test:

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

dongthao

About dongthao

The best things in life, they are free ... (Cry on my shoulder lyric)
This entry was posted in Linux, Linux Tutorial and tagged , , . Bookmark the permalink.

Có 1 phản hồi tại Linux IP Forwarding

  1. phong nói:

    Phần test phải là “Ping Linux 3 from Linux 1 successfully” chứ ạ,chứ em tưởng mặc định Linux 2 nó đã ping đc 3 rồi

Gửi phản hồi

Mời bạn điền thông tin vào ô dưới đây hoặc kích vào một biểu tượng để đăng nhập:

WordPress.com Logo

Bạn đang bình luận bằng tài khoản WordPress.com Log Out / Thay đổi )

Twitter picture

Bạn đang bình luận bằng tài khoản Twitter Log Out / Thay đổi )

Facebook photo

Bạn đang bình luận bằng tài khoản Facebook Log Out / Thay đổi )

Google+ photo

Bạn đang bình luận bằng tài khoản Google+ Log Out / Thay đổi )

Connecting to %s