I need to make a solution which will work as a network switch with two ports: one port located in one country and second port is in another country.
+------------ Virtual switch ----------------+
+---------+ | +-------+ +----------+ +-------+ | +--------+
|Client A |<--+-->| BOX 1 |<-->|VPN server|<-->| BOX 2 |<--+-->|Client B|
+---------+ | +-------+ +----------+ +-------+ | +--------+
+--------------------------------------------+
Client A and Client B shoud feel it like usual layer 2 switch. VPN connection between two boxes is OpenVPN. So I need to forward Ethernet frames somehow over the VPN tunnel between two boxes. Box 1 and 2 running Debian jessie. I hope not to write my own software for it :) Can anyone suggest possible solutions?
P.S. It is needed to connect two pieces of hardware which is designed to work only in LAN.
UPD: I've installed 4 VMs to simulate such setup (vpnserver was omitted):
- All machines are debian boxes
- Box 1 and Box 2 have GRE tap tunnel between them (Ethernet over IP)
- On Client A local interface bridged with gretap interface: bridge has address 10.0.0.253
- On Client B local interface bridged with gretap interface: bridge has address 10.0.0.254
- Client A has static IP 192.168.1.1
- Client B has static IP 192.168.1.2
From Client A I'm sending ICMP Echo request to 192.168.1.2 and I can see ARP request "Who has 192.168.1.2 tell 192.168.1.1" on bridge on Box 1, on bridge on Box 2 and on Client B. But ARP response is visible only on Client B. So ARP response not going back to Box2 somehow. And all networking between 10.0.0.253 and 10.0.0.254 works well. So, I suppose that problem caused by bridging.
UPD2: Now I removed GRE tap tunneling and established regular network between Box 1 and Box 2. When I created bridges, ping started working. What could cause problem when doing GRE tunnel?
Solution: I finally configured everything in VMs with GRE-TAP. I've used GRE-TAP tunnel over regular network between Box 1 And Box 2. And then I bridged tunneling interface with local interfacec on each Box. Below is my steps:
Box 1
ip link add tunnel0 type gretap remote 192.168.0.2 local 192.168.0.1
brctl addbr br0
brctl addif br0 eth2 # eth2 - is a local interface on Box 1
brctl addif br0 tunnel
ip addr add 10.0.0.253 dev tunnel0
ip link set br0 up
ip link set tunnel0 up
Box 2
ip link add tunnel0 type gretap remote 192.168.0.1 local 192.168.0.2
brctl addbr br0
brctl addif br0 eth2 # eth2 - is a local interface on Box 2
brctl addif br0 tunnel
ip addr add 10.0.0.254 dev tunnel0
ip link set br0 up
ip link set tunnel0 up
Thanks to all!