[SOLVED] forward to same IP over diferent interface
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm not sure what i'm attempting is possible but from what i've read so far it's plausable
what i'm attempting is to route all traffic going out on port 62010 via eth2 and all traffic to out on port 34010 on eth3. The destination ip is the same (10.71.241.121) (and reachable by both interfaces if you set the route)
What i've done is setup a routing table as follows
IP rules
[root@hyperion ~]# cat /etc/iproute2/rt_tables
#
# reserved values
#
255 local
254 main
253 default
0 unspec
#
# local
#
#1 inr.ruhep
2 eth2OUT
3 eth3OUT
[root@hyperion ~]# ip rule list
0: from all lookup local
32762: from all fwmark 0x2 lookup eth3OUT
32763: from all fwmark 0x1 lookup eth2OUT
32766: from all lookup main
32767: from all lookup default
[root@hyperion ~]# ip route show table eth3OUT
10.71.241.121 via 10.71.241.254 dev eth3
default via 10.71.241.254 dev eth3
[root@hyperion ~]# ip route show table eth2OUT
10.71.241.121 via 10.71.231.222 dev eth2
default via 10.71.231.222 dev eth2
IPtables
789 iptables -A OUTPUT -p tcp --dport 62010 -t mangle -j MARK --set-mark 1
790 iptables -A OUTPUT -p tcp --dport 34010 -t mangle -j MARK --set-mark 2
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
MARK tcp -- anywhere anywhere tcp dpt:62010 MARK set 0x1
MARK tcp -- anywhere anywhere tcp dpt:34010 MARK set 0x2
Can I ask a question, what do you plan on accomplishing with this setup? You should never have 2 interfaces on the same network unless they are port-channeled somehow. the switch spanning-tree should shut one of those ports off otherwise.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.