March 31, 2015

ebtables to setup Forwarding and ethernet level NAT!

Forums: 

I would like to use ebtables to perform the following 2 things:

SCENARIO I: I would like to forward all the packets received from eth0 interface onto the eth1 interface. Similarly would like to forward all the reverse packets received from eth1 interface onto the eth0 interface without changing anything.

SCENARIO II:

I would like to setup a NAT where eth0 is the external interface and eth1 is the internal interface where all the packets received on eth1 is forwarded to the external eth0 interface with the eth0 mac address replacing the internal network mac address and vice versa.

At IP level i can do the same like shown below:

/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

/sbin/iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT

/sbin/iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT

I would like to achieve this same scenario at ethernet level?

Kindly help me out for both the above scenarios.

Click Here!