Thread: Iptables: force real network traffic using two WLAN adapters (no loopback bridging)
dear forum,
laptop has 2 network interfaces,
1 build-in (wlan1) , 1 attached via usb (wlan2).
facing inconvenient situation: performing quite network analysis.
have create real network traffic , mustnot use loopback interface - thats happening.
so far, i've found related forum entries, no real answer. daniel ryde uses self developed code injection program.code:problem: wlan1 -> loopback -> wlan2 request: wlan1 -> medium -> wlan2, medium!=loopback, working variable networks
these tools add functionality choose sender / source interface (ip address), no medium.
reference: http://superuser.com/questions/24117...rent-processes
can request accomplished via interfaces config file, iptables, routing entries (or other known unix tools)?
thanks.
okay, got , still not working.
i've managed send packets correct interface,
on network , receiving correct interface.
can see incoming packets while sniffing @ incoming interface.
packets not answered / dropped, however.
guess kernel options drops packets.
1 option set interfaces in promiscous mode,
cause far handle...
code:# add routing rules main routing table, outgoing interface # , source address chosen correctly sudo /bin/ip route add $interface_1_ip/32 dev $interface_2 src $interface_2_ip sudo /bin/ip route add $interface_2_ip/32 dev $interface_1 src $interface_1_ip # send gratuitous arp reply (-a), tell other communication devices # (e.g. switch) ip / mac combination sudo /usr/bin/arping -c 4 -a -i $interface_1 $interface_1_ip sudo /usr/bin/arping -c 4 -a -i $interface_2 $interface_2_ip # remove locally hosted ip's local routing table - doing # ensures, loopback device not used sudo /bin/ip route del $interface_1_ip table local sudo /bin/ip route del $interface_2_ip table local # arp requests not answered, machine guesses, # not possess ip's - therefore add static arp entries sudo /usr/sbin/arp -s $interface_1_ip $interface_1_mac sudo /usr/sbin/arp -s $interface_2_ip $interface_2_mac # os ignores packets on interface -what now? # first idea: try forward incoming interface loopback # forwarding not work - sniffing on lo shows no packets... sudo /sbin/iptables -t nat -a prerouting --in-interface $interface_1 --destination $interface_1_ip -j dnat --to-destination 127.0.0.1 sudo /sbin/iptables -t nat -a prerouting --in-interface $interface_2 --destination $interface_2_ip -j dnat --to-destination 127.0.0.1
Forum The Ubuntu Forum Community Ubuntu Official Flavours Support Networking & Wireless [ubuntu] Iptables: force real network traffic using two WLAN adapters (no loopback bridging)
Ubuntu
Comments
Post a Comment