M
M
Michael2018-11-12 16:56:41
VPN
Michael, 2018-11-12 16:56:41

Network access to L2TP server clients in Docker?

There is a Docker container in which the L2TP / IPSec server is spinning.
Clients connect to it and go to the Internet remarkably.
Actually, initially I wanted it that way, but as it usually happens, I wanted more.
Namely, so that clients can interact with each other.
But something does not come out a stone flower. I feel that the solution is as simple as three pennies, but somewhere I am insanely stupid.
route -n (from container):

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.168.1   0.0.0.0         UG    0      0        0 eth0
192.168.42.10   0.0.0.0         255.255.255.255 UH    0      0        0 ppp0
192.168.42.11   0.0.0.0         255.255.255.255 UH    0      0        0 ppp1
192.168.168.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0

iptables -t nat -L -v (from container):
Chain PREROUTING (policy ACCEPT 18 packets, 2487 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain INPUT (policy ACCEPT 8 packets, 1852 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    1    67 DOCKER_OUTPUT  all  --  any    any     anywhere             localhost           

Chain POSTROUTING (policy ACCEPT 1 packets, 84 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    9   551 MASQUERADE  all  --  any    eth+    192.168.42.0/24      anywhere            
    0     0 MASQUERADE  all  --  any    eth+    192.168.43.0/24      anywhere             policy match dir out pol none
    1    67 DOCKER_POSTROUTING  all  --  any    any     anywhere             localhost           

Chain DOCKER_OUTPUT (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 DNAT       tcp  --  any    any     anywhere             localhost            tcp dpt:53 to:127.0.0.11:32821
    1    67 DNAT       udp  --  any    any     anywhere             localhost            udp dpt:53 to:127.0.0.11:59079

Chain DOCKER_POSTROUTING (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 SNAT       tcp  --  any    any     localhost            anywhere             tcp spt:32821 to::53
    0     0 SNAT       udp  --  any    any     localhost            anywhere             udp spt:59079 to::53

ifconfig (from container):
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.168.9  netmask 255.255.255.0  broadcast 192.168.168.255
        ether 02:42:c0:a8:a8:09  txqueuelen 0  (Ethernet)
        RX packets 663  bytes 92359 (90.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 741  bytes 93853 (91.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 19  bytes 1429 (1.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 19  bytes 1429 (1.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ppp0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1280
        inet 192.168.42.1  netmask 255.255.255.255  destination 192.168.42.10
        ppp  txqueuelen 3  (Point-to-Point Protocol)
        RX packets 127  bytes 6922 (6.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 136  bytes 7758 (7.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question