Subject: Re: [Govpn-devel] build from last tarball

From: [email-masked]
Date: Thu, 28 Jan 2016 17:20:46 +0300

Greetings!

*** Alan Holt <[email-masked]> [Thu, 28 Jan 2016 15:39:57 +0200]:
>Where br0 should be bridge.
>tap_alan for user alan.
>tap_jack for user jack.

The main mistake that bridge is layer 2 thing, so it is not related to
routing. Bridge is like Ethernet switch, like Ethernet hub. Adding
interface to bridge is lake a plugging another Ethernet cable to the
switch. So, if you just want to make two clients "see" each other: then
you just add their TAP interfaces to the bridge and that is all -- no
routing or IPv4/IPv6 address adding is needed.

When I used GNU/Linux for the last time, I did not know about "ip link
set mode" and "ip link set master" commands. That is why I just not sure
about them. I have get some RedHat GNU/Linux and creating tap interfaces
and adding them to the bridge goes like this:

[root@android-55c141cf9c0088ac ~]# brctl addbr br0
[root@android-55c141cf9c0088ac ~]# tunctl
Set 'tap0' persistent and owned by uid 0
[root@android-55c141cf9c0088ac ~]# tunctl
Set 'tap1' persistent and owned by uid 0
[root@android-55c141cf9c0088ac ~]# brctl addif br0 tap0
[root@android-55c141cf9c0088ac ~]# brctl addif br0 tap1
[root@android-55c141cf9c0088ac ~]# brctl show br0
bridge name     bridge id               STP enabled     interfaces
br0             8000.5295922bc262       no              tap0
                                                        tap1
[root@android-55c141cf9c0088ac ~]# ifconfig br0
br0       Link encap:Ethernet  HWaddr 52:95:92:2B:C2:62
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
[root@android-55c141cf9c0088ac ~]# ip link
3: br0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default
    link/ether 52:95:92:2b:c2:62 brd ff:ff:ff:ff:ff:ff
4: tap0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop master br0 state DOWN mode DEFAULT group default qlen 500
    link/ether 52:95:92:2b:c2:62 brd ff:ff:ff:ff:ff:ff
5: tap1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop master br0 state DOWN mode DEFAULT group default qlen 500
    link/ether 8a:65:bf:0c:f6:7f brd ff:ff:ff:ff:ff:ff

Pay attention that neither ifconfig, nor ip link shows that br0 has
tap0/tap1. Maybe I have got an outdated versions, but brctl was the
native tool. I mean that I am not sure that "ip link set master" works
like brctl addif.

So, in your case I would check "brctl show br0" output and be sure that
tap interfaces are bridged. If user_alex set 172.16.0.1 on one side, and
user_jack set 172.16.0.2 on his side, then they should be able to ping
themselves through the server -- and no IP-configuration on it is
needed neither on br0, nor on tap interfaces. This is Layer2, not
Layer3!

If you want to interact with the server too, then you must set an IP
address (ifconfig br0 inet 172.16.0.5/24) only on br0 interface, without
touching tap-interfaces.

Sorry for repeating again :-), but: bridge interfaces are like Ethernet
switches: you just plug interfaces to it, like with physical Internet.
Switch does not know anything about routing, addresses, IP, IPX or
whatever packets, but all plugged cables/interfaces can work and
communicate transparently together.

And I am not sure how routing in that case:

*br0*: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1432
        inet *172.16.0.5*  netmask 255.255.255.255  broadcast 0.0.0.0
*tap_alan*:
        inet *172.16.0.2*  netmask 255.255.255.0  broadcast 0.0.0.0
*tap_jack*: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1432
        inet *172.16.0.1*  netmask 255.255.255.0  broadcast 0.0.0.0

should work. There are three interfaces with the same 172.16.0.0/24
subnet. On what interface should the host send the packet? Any routing
related (addresses) configuration should be done on bridge interface
only.

-- 
Happy hacking, Sergey Matveev