LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-10-2021, 05:12 AM   #1
dr.x
Member
 
Registered: Jan 2013
Posts: 231

Rep: Reputation: Disabled
Route Traffic back to the same interface it came from


To be clear , The traffic incident to the interface can be Established comming back traffic
OR
New traffic being generated and send to interface "koki"


############################################################

ip rule add from all fwmark 100 lookup koki
iptables -t mangle -A INPUT -i koki -j MARK --set-mark 100
iptables -t mangle -A PREROUTING -i koki -j MARK --set-mark 100
#######################################################

ip route show table koki
default via 10.219.203.2 dev koki
###################################


iptables -t mangle -L -n -v
Chain PREROUTING (policy ACCEPT 69M packets, 66G bytes)
pkts bytes target prot opt in out source destination
44053 2417K MARK all -- koki * 0.0.0.0/0 0.0.0.0/0 MARK set 0x64

Chain INPUT (policy ACCEPT 69M packets, 66G bytes)
pkts bytes target prot opt in out source destination
2715 2921K MARK all -- koki * 0.0.0.0/0 0.0.0.0/0 MARK set 0x64

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination

Chain OUTPUT (policy ACCEPT 74M packets, 72G bytes)
pkts bytes target prot opt in out source destination

Chain POSTROUTING (policy ACCEPT 74M packets, 72G bytes)
pkts bytes target prot opt in out source destination


#########################################


BASED ON above , i can see the traffic is marked to 0x64 and the rule 0x64 shoud have default route back over default via 10.219.203.2 dev koki

But in production , We cant see any traffic being routed based on the rule 0x64 .

So basically its matched in the mangle table , But for some reason i may be missing something somewhere else .


Hope to help.

Thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Packet going out of wrong interface due to OS adding cache route - OS trying to route through default route msr1981 Linux - Networking 2 10-11-2017 02:58 PM
Packet going out of wrong interface due to OS adding cache route - OS trying to route through default route msr1981 Red Hat 1 10-09-2017 05:45 AM
Why static routes set using 'ip route add' and 'route add' commands are not used for routing packets within the same network? kanak@tetcos.com Linux - Networking 7 04-25-2017 05:52 AM
I am not able to add a new route to my route table using route command prashanth s j Linux - Networking 2 09-03-2005 04:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration