I have 2 Network Interface Cards (NICs), each on a different network, and I need each NIC to route to the network to which it is connected. I do not want this machine set up as a router. How do I use multi-homing?

The behavior you are trying to configure for your network is the way your system will act by default. This setup, where the system is a member of two distinct networks, is commonly known as “multi-homing” and can be achieved by simply assigning an IP address to each interface.

You can configure a dynamic IP address by using DHCP or you can configure a static IP address with the ifconfig utility. Often people confuse the idea of multi-homing with the concept of routing or IP forwarding and assume that setting up two interfaces on a system will allow them to route.

In order to enable this additional routing feature, multi-homing must be set-up and then forwarding must be manually enabled with the following command:

echo 1 > /proc/sys/net/ipv4/ip_forward

You can set this feature permanently in the /etc/sysctl.conf file with the following notation:

# Controls IP packet forwarding
net.ipv4.ip_forward = 1

Run the command sysctl -p after updating this file for the change to take effect immediately.

The Linux kernel will route traffic to each directly-connected network through the appropriate interface, but will not forward frames between networks.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: