Following tip is submitted by Raj.
If you have 2 NIC (network Lan card) each connected to different networks:
=> eth0: 192.168.1.0/24
=> eth1: 192.168.2.0/24
Consider above setup. Now if you want to route traffic to connected network only (eth0 and eth1) w/o setting Linux server as a router. This is generally called multi homing setup. You don’t have to setup Linux box as a router to use multi homing :). Just assign as IP address to each NIC and you are done.
How do I configure Linux multi homing?
Just assign each interface IP address using ifconfig or use DHCP and multi homing will be turned on:
# ifconfig eth0 192.168.1.254 up
# ifconfig eth1 192.168.2.254 up
Commonly, most admin confuse the idea of multi-homing with the concept of routing or IP forwarding. Once two IP address assigned your system follows the default. No special configuration needed. Your multi-homing is up and running :).
You can turn on additional routing feature, with multi-homing. Just enable forwarding:
# echo 1 > /proc/sys/net/ipv4/ip_forwarding
If you reboot system you will lost additional routing setup. Add following line to your /etc/sysctl.conf file:
# vi /etc/sysctl.conf Add following line:
net.ipv4.ip_forward = 1
Save and type command:
# sysctl -p
But, what is the difference between routing and multi homing setup?
=> Multi homing route traffic to each connected network but no frames are forwarded between two networks.
=> Routing forward frames between two networks. See these (setup Linux as a router for DSL, T1 line etc) previous articles (setup vmware host router) on how to setup Linux as a router.
Updated for accuracy by nixCraft.
|Category||List of Unix and Linux commands|
|Firewall||CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04|
|Network Utilities||dig • host • ip • nmap|
|OpenVPN||CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04|
|Package Manager||apk • apt|
|Processes Management||bg • chroot • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time|
|Searching||grep • whereis • which|
|User Information||groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w|
|WireGuard VPN||CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04|