Configure dual-nic forwarding in LINUX

Source: Internet
Author: User
LINUX dual-nic forwarding configuration-Linux Enterprise Application-Linux server application information. For more information, see. Network Configuration:

CLIENT 1 <-------> | SERVER 1 | <--------> CLIENT 2
|
Interfaces: eth1 eth2

CLIENT 1 connects to CLIENT 2 through SERVER 1, and SERVER 1 has two NICs, eth1 and eth2.

1. Configure the IP address and mask of eth1 and eth2 of SERVER 1.

Make sure that the forwarding at/proc/sys/net/ipv4/ip_forward is enabled. "1" indicates that the forwarding function is enabled.

Ifconfig ethx xxx. xxx netmask xxx. xxx

Assume that eth1 is configured as 10.1.0.1 and eth2 is configured as 10.2.0.1.

Then add the route: route add-net 10.1.0.0 netmask route 255.255.0 dev eth1

Route add-net 10.2.0.0 netmask 255.255.255.0 dev eth2

Note that you should add a default route as needed.

2. Configure the network card of CLIENT 1 and point its gateway to eth1 of SERVER 1. Add the route so that the data sent to CLIENT 2 passes through the gateway eth2.

Route add-net 10.2.0.0 netmask 255.255.255.0 gw 10.2.0.1 dev ethx

Ethx indicates the local Nic Device of CLIENT 1.

3. Configure CLIENT2 in the same way as CLIENT 1.

PING fails until CLIENT 2 is configured successfully.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.