I have linux box. and it have two interface(eth0, eth1).
eth0 is upside and eth1 is downside connection.
eth0, eth1 is connected with each switch(s/w0, s/w1).
s/w0 is going out to internet, and s/w1 is connected with one laptop.
And I want eth0 , eth1 two-way forwarding like bridge.
But not using brctl, only using iptables.
So, if iptables rule set is correct, then laptop should be internet enabled.
I've tried this rules, but not working.
echo 1 > /proc/sys/net/ipv4/ip_forward iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT iptables -A FORWARD -i eth0 -o eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
I'd appreciate any help.
my network is like below.
internet - router - switch0 - eth0:linuxBox:eth1 - switch1 - laptop
When make bridge using brctl like below, laptop can use the internet
brctl addbr br0 brctl addif br0 eth0 brctl addif br0 eth1 brctl stp br0 off ifconfig br0 up
My goal is make iptables rules to replace the brctl.