Nani Infopeer
asked on
Routing traffic on multiple nics
Have 3 nics in system
Eth0
Eth1
Eth2
How can I route
traffic related to x.x.x.x IP on eth0
Traffic to y.y.yy on eth1
Traffic to a.a.a.a on eth1
Traffic to z.z.z.z on eth2
Traffic to q.q.q.q on eth2
Using redhat system
Eth0
Eth1
Eth2
How can I route
traffic related to x.x.x.x IP on eth0
Traffic to y.y.yy on eth1
Traffic to a.a.a.a on eth1
Traffic to z.z.z.z on eth2
Traffic to q.q.q.q on eth2
Using redhat system
Aside: If you're running LXD on your machine, the SNAP update process causes all LXD related bridge adapters to be deleted.
So if you're using LXD, you must arrange for your route commands to regenerate every few seconds.
So if you're using LXD, you must arrange for your route commands to regenerate every few seconds.
ASKER
Can we do that using iptables?
No you use the routing command: route
route add {destinationhost} gw {nexthop}
or
route add -net {destinationnet} gw {nexthop}
{destinationhost} is one IP addressi
{destinationnet} is a network specification like:
{nexthop} the next system that better knowns were to go.
If those work they need to e added to the system configuration...
In the directory: /etc/sysconfig/network-scr ipts/
You create a file / device. for eth1 : route-eth1
Containing:
etc.
route add {destinationhost} gw {nexthop}
or
route add -net {destinationnet} gw {nexthop}
{destinationhost} is one IP addressi
{destinationnet} is a network specification like:
{nexthop} the next system that better knowns were to go.
If those work they need to e added to the system configuration...
In the directory: /etc/sysconfig/network-scr
You create a file / device. for eth1 : route-eth1
Containing:
y.y.y.y via routeryyy dev eth1
a.a.a.a via routeraaa dev eth1
All data needs to be in ipaddress format, not a hostnameetc.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
same for all other addresses. After that one can use:
route add y.y.y.y gw yyyrtr
route add b.b.b.b gw bbbrtr
route add z.z.z.z gw zzzrtr
route add q.q.q.q gw qqqrtr
A route is not needed if the interface is on that network... (bringing up the interface also establishes a route to all addresses there).
So if the address of eth2 happens to be q.q.q.1 then no route is needed. (assuming q.q.q.q is within the network descibed there).
See also:
https://en.wikipedia.org/wiki/IP_routing
https://www.youtube.com/watch?v=8qtKpZGoNdI