LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 02-28-2014, 03:40 PM   #1
rabbit2345
Member
 
Registered: Apr 2007
Location: SC
Distribution: Kubuntu 20.04 LTS
Posts: 378

Rep: Reputation: 41
bridging 2 eth interfaces transparently


Hi,

I'm trying to setup a bridge between 2 ethernet interfaces, one on-board and one USB. Essentially, I'm trying to intercept packets coming from one source (connected to me) and transparently pass them along to the other interface, which is connected to the real internet. Basically:

Computer1 <----> (eth0) Me (eth1) <----> Internet

(I swear, it's for networking class to demonstrate a possible way a MITM attack is performed. Educational purposes only, guys).

The issue I'm having is I can tcpdump each interface independently and receive data, but I'm not able to "forward" packets from 1 to another.

Here's what I've done:
# ifconfig eth0 mtu 1500 promisc up
# ifconfig eth1 mtu 1500 promisc up
# brctl addbr br0
# brctl addif eth0
# brctl addif eth1
# echo 1 > /proc/sys/net/ipv4/ip_forward
# for x in $(ls /proc/sys/net/bridge); do echo 0 > $x; done

I feel like there's something obvious I'm missing. What am I doing wrong?


Thanks,
-rabbit
 
Old 02-28-2014, 03:54 PM   #2
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,326

Rep: Reputation: 920Reputation: 920Reputation: 920Reputation: 920Reputation: 920Reputation: 920Reputation: 920Reputation: 920
this seems similar:
http://www.linuxquestions.org/questi...lu#post3804866
 
Old 02-28-2014, 04:10 PM   #3
rabbit2345
Member
 
Registered: Apr 2007
Location: SC
Distribution: Kubuntu 20.04 LTS
Posts: 378

Original Poster
Rep: Reputation: 41
Hi,

Thanks for the replay, but my goal isn't to masq. the 2 interfaces together. Doing so would modify packets as they pass through my computer. I specifically need a fully transparent setup, where my computer (the bridge) is practically invisible to both parties.


Thanks,
-rabbit
 
Old 03-03-2014, 12:22 AM   #4
rabbit2345
Member
 
Registered: Apr 2007
Location: SC
Distribution: Kubuntu 20.04 LTS
Posts: 378

Original Poster
Rep: Reputation: 41
I did it! It's actually a fairly simple procedure once you understand everything. Here are the commands I ran, in order:

Code:
iptables -F
iptables -A FORWARD -m physdev --physdev-in eth1 --physdev-out eth0 -j ACCEPT
iptables -A FORWARD -m physdev --physdev-in eth0 --physdev-out eth1 -j ACCEPT
ifconfig eth0 mtu 1500 promisc up
ifconfig eth1 mtu 1500 promisc up
brctl addbr br0
brctl addif eth0
brctl addif br0 eth0
brctl addif br0 eth1
ifconfig br0 up
echo 1 > /proc/sys/net/ipv4/ip_forward
And I'm now a transparent bridge between the two wires. You can tap either end with Wireshark/tcpdump to watch the traffic fly through your computer. Hopefully, I can save someone a lot of frustration and time with this.


-rabbit
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Bridging between interfaces using brctl dojha00 Linux - Wireless Networking 2 07-25-2012 08:05 PM
[SOLVED] bridging two wireless interfaces the white rabbit Linux - Networking 6 03-05-2012 12:54 PM
eth interfaces drop after a while agreenwood Slackware 2 01-31-2006 02:27 PM
Bridging interfaces + ip address Soma Linux - Networking 2 10-27-2003 08:32 PM
Bridging 2 eth infaces lunxer Linux - Networking 0 06-05-2003 12:52 PM

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

All times are GMT -5. The time now is 10:35 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