Hello there!
I have an some Linux routing question, not related to OpenWrt, but soon will be.
So - in general i have one server with various servers VPNs - WG, OpenVpn and PPTP (poptop).
I also have one client that connect to PPTP to this server. Client is with DD-WRT, but soon will replace it with OpenWrt as soon as stabilize things.
I have second client (macOS) that can connect to server.
Technically both clients connect to server and on server i can ping them each other.
I wasn't able to ping client1 from client2 and vice versa. I was fix this with:
iptables -t nat -A POSTROUTING -j MASQUERADE
now clients can ping each other and can see their services (HTTP).
But here is mine problem. I want to change routing on client2 so default gateway to be client1. I do this but packets are outgoing from server.
Here is mine routing on server:
route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.0.1 0.0.0.0 UG 203 0 0 eth0
0.0.0.0 192.168.0.1 0.0.0.0 UG 304 0 0 wlan0
10.8.0.0 0.0.0.0 255.255.255.0 U 0 0 0 tun0
10.10.10.2 0.0.0.0 255.255.255.255 UH 0 0 0 wg0
10.10.10.3 0.0.0.0 255.255.255.255 UH 0 0 0 wg0
10.10.10.4 0.0.0.0 255.255.255.255 UH 0 0 0 wg0
10.20.30.10 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
10.147.17.0 0.0.0.0 255.255.255.0 U 0 0 0 ztr2q34d7m
169.254.0.0 0.0.0.0 255.255.0.0 U 205 0 0 ztr2q34d7m
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 wlan0
192.168.0.0 0.0.0.0 255.255.255.0 U 203 0 0 eth0
192.168.0.0 0.0.0.0 255.255.255.0 U 304 0 0 wlan0
iptables -L -v -n
Chain INPUT (policy ACCEPT 74242 packets, 15M bytes)
pkts bytes target prot opt in out source destination
18638 2188K f2b-sshd tcp -- * * 0.0.0.0/0 0.0.0.0/0 multiport dports 22
Chain FORWARD (policy ACCEPT 8 packets, 608 bytes)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- wg0 * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT all -- * wg0 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT all -- wg0 * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT all -- * wg0 0.0.0.0/0 0.0.0.0/0
Chain OUTPUT (policy ACCEPT 143K packets, 22M bytes)
pkts bytes target prot opt in out source destination
Chain f2b-sshd (1 references)
pkts bytes target prot opt in out source destination
18638 2188K RETURN all -- * * 0.0.0.0/0 0.0.0.0/0
iptables -t nat -L -n -v
Chain PREROUTING (policy ACCEPT 3332 packets, 335K bytes)
pkts bytes target prot opt in out source destination
Chain INPUT (policy ACCEPT 1654 packets, 135K bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 3271 packets, 198K bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 1432 packets, 84698 bytes)
pkts bytes target prot opt in out source destination
0 0 MASQUERADE all -- * eth0 10.8.0.0/24 0.0.0.0/0
1843 114K MASQUERADE all -- * eth0 0.0.0.0/0 0.0.0.0/0
ifconfig
dummy0: flags=195<UP,BROADCAST,RUNNING,NOARP> mtu 1500
inet6 fe80::8173:6f8f:706b:4a10 prefixlen 64 scopeid 0x20<link>
ether 26:83:2f:6b:b3:88 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 188 bytes 73328 (71.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.123 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::c095:e8ea:8b76:f6da prefixlen 64 scopeid 0x20<link>
ether 02:42:fd:27:35:d9 txqueuelen 1000 (Ethernet)
RX packets 47618 bytes 9676246 (9.2 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 82802 bytes 12960441 (12.3 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 39
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 17458 bytes 3274455 (3.1 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 17458 bytes 3274455 (3.1 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ppp0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1432
inet 10.20.30.1 netmask 255.255.255.255 destination 10.20.30.10
ppp txqueuelen 3 (Point-to-Point Protocol)
RX packets 10 bytes 340 (340.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 10 bytes 322 (322.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500
inet 10.8.0.1 netmask 255.255.255.0 destination 10.8.0.1
inet6 fe80::a995:13f5:5e9d:ddb5 prefixlen 64 scopeid 0x20<link>
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 100 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 12 bytes 576 (576.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wg0: flags=209<UP,POINTOPOINT,RUNNING,NOARP> mtu 1420
inet 10.10.10.1 netmask 255.255.255.255 destination 10.10.10.1
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 1000 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 17442 dropped 0 overruns 0 carrier 0 collisions 0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.111 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::1d6d:e843:f14d:9fd9 prefixlen 64 scopeid 0x20<link>
ether 12:42:fd:27:35:d9 txqueuelen 1000 (Ethernet)
RX packets 21844 bytes 4170073 (3.9 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 31420 bytes 5060600 (4.8 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ztr2q34d7m: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 2800
inet 10.147.17.2 netmask 255.255.255.0 broadcast 10.147.17.255
inet6 fe80::4f50:93d9:7dd8:5d28 prefixlen 64 scopeid 0x20<link>
inet6 fe80::4011:3dff:fe88:3165 prefixlen 64 scopeid 0x20<link>
ether 1a:c3:96:b3:e0:65 txqueuelen 1000 (Ethernet)
RX packets 72 bytes 6934 (6.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 203 bytes 74672 (72.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
And i'm clueless what is wrong there.