Is it possible to negate mark in this case? iptables -t mangle -A PREROUTING -i eth0 -p…
- User
Is it possible to negate mark in this case? iptables -t mangle -A PREROUTING -i eth0 -p tcp -m mark --mark 0x111 -j TPROXY --on-ip 127.0.0.1 --on-port 22222
- Assistant
In iptables, using the mangle table to manipulate packet marks is quite flexible, but negating a mark directly in a command like the one you provided isn't straightforward. The
-m markmodule does not support direct negation using something like!in the way you can negate other match options.However, you can handle logic that effectively results in negating a mark by using a combination of rules. Here's a general approach:
-
Clear the mark first if there's any possibility it was set by a previous rule:
iptables -t mangle -A PREROUTING -i eth0 -p tcp -j MARK --set-mark 0x0 -
Use marking logic: Instead of trying to "negate" a mark directly, you can skip applying TPROXY if a specific mark is set by simply chaining rules together, applying TPROXY action before or after these sets of checks.
-
- User
ip route add local default dev lo vs ip route add default dev lo?
- Assistant
The commands
ip route add local default dev loandip route add default dev loare used to manipulate the routing table, but they have different meanings and implications:-
ip route add local default dev lo:- This command specifies that all packets for addresses not matched by any other route in the routing table should be locally delivered as if they are destined for the machine's own interfaces.
- It creates a "local" route, which is used for special handling of packets. This is generally used for advanced routing scenarios, such as when you need packets to be processed by local services, even if they are addressed to other interfaces.
-
- User
What "local" change in comparison of routing without "local"? You explained nothing about it.
- Assistant
- User
thx
- Assistant
You're welcome! If you have any more questions or need further clarification on networking or anything else, feel free to ask. Happy to help!
- User
What's sniffing in xray cinfig file?
- Assistant
- User
I don't understand what happens if sniffing": { "enabled": true, "destOverride": ["http", "tls"] will or will not be specified?
- Assistant
- User
I don't understand it in practice. If I set route rules to block some traffic by ip or domain locality, do I need to set sniffing for it or not? If not, give me example where it is practically needed with corresponding route settings.
- Assistant