0

I have incoming traffic on eth1 (vlan id 201) which is emitted by another machine which is doing

sudo tcpreplay -x 0.01 --loop=0 --intf1=eth12 Wireshark_bidirectional_data.pcap

I would like to rewrite the destination to target other devices e.g. 198.19.5.1... connected on eth1.

i've enabled

net.ipv4.ip_forward=1

and been trying to forward the data by doing:

table ip nat {
        chain postrouting {
                type nat hook postrouting priority srcnat; policy accept;
                masquerade
        }

        chain prerouting {
                type nat hook prerouting priority dstnat; policy accept;
                vlan id 201 ip daddr 198.19.5.1 udp dport { 2000 } dnat to 192.168.2.161:2000
        }
}

Hovewer this only works if have a "matching interface" active.

7: eth1.201@eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 02:00:00:00:00:13 brd ff:ff:ff:ff:ff:ff
    inet 169.254.190.209/16 brd 169.254.255.255 scope global noprefixroute eth1.201
       valid_lft forever preferred_lft forever
    inet 198.19.5.1/32 scope global eth1.201
       valid_lft forever preferred_lft forever
    inet6 fe80::742d:66d4:dd72:78dd/64 scope link
       valid_lft forever preferred_lft forever

So I would like to achive the same without the "matching interface", I guess I should use a tap device instead.

Please help me configure this without "matching interface"

Also, for starters; just a firm confirmation where someone can confirm that this is possible would be encouraging.

Aleksandarf
  • 101
  • 1
  • what is the business related question or issue in here? what research did you? what is the environment? – djdomi May 28 '23 at 19:53
  • Intention is to monitor the traffic as id the traffic was intended to "me". – Aleksandarf May 28 '23 at 20:36
  • Intention is to monitor the traffic as if the traffic was intended to "me" in real time. Pcap replay simulates the source data and my software is located in the other end. If one linux need to sit in between to rewrite the destination address thats fine. If 'nc -u -l 2000' works my software will be happy. I'm trying to avoid writing promiscious socket code and like to see this special environment as specific setup. – Aleksandarf May 28 '23 at 20:42

0 Answers0