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.
Using iptables, I am mirroring all traffic on udp port 1514 from a production CentOS server to a dev CentOS server. As such, the dev server receives a copy of all udp 1514 packets sent to the production server. Here is the command I used:
When capturing these packets on the second server, the destination IP is that of the production server. This is a problem because I want a service to interact with this traffic. How do I "trick" the second server into thinking that the mirrored packets are meant for it? Have been looking into rewriting the destination IP of the packets, but no luck so far. Thanks.
Yes, that was a typo. I know that rule works because I'm seeing all of the redirected packets running tcdump on the second server. I used this command:
iptables -t mangle -A PREROUTING -i ens160 -p udp --dport 1514 -j TEE --gateway 10.88.72.40
You would need to do this on the host where you have the other rules to send the traffic to the second system.
I would think a new chain would be best. Traffic comes in and then is pushed to the chain where you could change the ip address and then send it off to the second system.
On second thought you might be able to do this on the second seerver. The server would see that the packet is for itself and then do what you want it to do.
I have discovered that, on the second machine, I cannot use iptables to route packets addressed to other IPs to localhost. I'm running Centos7, which doesn't support kernel 3.6, which is needed to do this.
So my plan is to add a second interface on the original server. Then:
iptables -t mangle -A PREROUTING -i ens160 -p udp --dport 1514 -j TEE --gateway 10.88.72.43
where 10.88.72.43 is the second NIC of the same server. The problem is that I cannot detect any packets reaching this interface. Please advise on how I can redirect TEE packets to a different interface on the same host.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.