/ppp secret
add local-address=<some random address not used anywhere else> name=<username> password=<password> remote-address=x.x.x.11
/interface l2tp-server server
set ipsec-secret=<secret> use-ipsec=yes
/ip arp
add address=x.x.x.11 interface=<WAN> published=yes
/ip route
add dst-address=0.0.0.0/0 gateway=<IP on CHR's end of tunnel> routing-mark=vpn
/ip firewall mangle
add action=mark-routing chain=prerouting new-routing-mark=vpn src-address=<server's public IP>
/interface ipip
add allow-fast-path=no ipsec-secret=<secret> local-address=217.144.x.119 name=ipip-tunnel remote-address=<home router>
/ip address
add address=217.144.x.119/24 interface=<WAN>
add address=172.16.1.2/30 interface=ipip-tunnel
/ip arp
add address=217.144.x.108 interface=<WAN> published=yes
/ip route
add dst-address=217.144.x.108/32 gateway=172.16.1.1
/interface ipip
add allow-fast-path=no ipsec-secret=<secret> local-address=<home router> name=ipip-tunnel remote-address=217.144.x.119
/ip address
add address=172.16.1.1/30 interface=ipip-tunnel
add address=192.168.x.x/32 interface=<LAN> network=217.144.x.108
/ip firewall mangle
add action=mark-connection chain=prerouting connection-mark=no-mark dst-address=217.144.x.108 in-interface=ipip-tunnel new-connection-mark=server-public passthrough=no
add action=mark-connection chain=prerouting connection-mark=no-mark new-connection-mark=server-public passthrough=yes src-address=217.144.x.108
add action=mark-routing chain=prerouting connection-mark=server-public in-interface=<LAN> new-routing-mark=to-chr passthrough=no
/ip route
add dst-address=0.0.0.0/0 gateway=172.16.1.2 routing-mark=to-chr
ip addr add 217.144.x.108 peer 192.168.x.x dev <interface>
ip route add default via 192.168.x.x
/interface ipip
add allow-fast-path=no ipsec-secret=*********** local-address=94.xxx.xxx.150 name=ipip-tunnel remote-address=46.xxx.xxx.162
/ip address
add address=172.16.1.2/30 interface=ipip-tunnel
/ip arp
add address=195.xxx.xxx.6 interface=ether1-gateway published=yes
/ip route
add dst-address=195.xxx.xxx.6/32 gateway=172.16.1.1
/interface ipip
add allow-fast-path=no ipsec-secret=************ local-address=46.xxx.xxx.162 name=ipip-tunnel remote-address=94.xxx.xxx.150
/ip address
add address=172.16.1.1/30 interface=ipip-tunnel
add address=172.30.4.1/32 interface=ether2-master network=195.xxx.xxx.6
/ip firewall mangle
add action=mark-connection chain=prerouting connection-mark=no-mark dst-address=195.xxx.xxx.6 in-interface=ipip-tunnel new-connection-mark=server-public passthrough=no
add action=mark-connection chain=prerouting connection-mark=no-mark new-connection-mark=server-public passthrough=yes src-address=195.xxx.xxx.6
add action=mark-routing chain=prerouting connection-mark=server-public in-interface=ether2-master new-routing-mark=to-chr passthrough=no
/ip route
add dst-address=0.0.0.0/0 gateway=172.16.1.2 routing-mark=to-chr
# /etc/network/interces
interface eth0 inet static
address 195.xxx.xxx.6
netmask 255.255.255.255
gateway 172.30.4.1
/ip firewall nat
add action=src-nat chain=srcnat comment="Hetzner SNAT -- 195.xxx.xxx.6 via ether1-gateway (used with ipip tunnel)" out-interface=ether1-gateway src-address=195.xxx.xxx.6 to-addresses=195.xxx.xxx.6
Ok, I tested it and this works:
CHR:Home router:Code: Select all/interface ipip add allow-fast-path=no ipsec-secret=<secret> local-address=217.144.x.119 name=ipip-tunnel remote-address=<home router> /ip address add address=217.144.x.119/24 interface=<WAN> add address=172.16.1.2/30 interface=ipip-tunnel /ip arp add address=217.144.x.108 interface=<WAN> published=yes /ip route add dst-address=217.144.x.108/32 gateway=172.16.1.1
Server config:Code: Select all/interface ipip add allow-fast-path=no ipsec-secret=<secret> local-address=<home router> name=ipip-tunnel remote-address=217.144.x.119 /ip address add address=172.16.1.1/30 interface=ipip-tunnel add address=192.168.x.x/32 interface=<LAN> network=217.144.x.108 /ip firewall mangle add action=mark-connection chain=prerouting connection-mark=no-mark dst-address=217.144.x.108 in-interface=ipip-tunnel new-connection-mark=server-public passthrough=no add action=mark-connection chain=prerouting connection-mark=no-mark new-connection-mark=server-public passthrough=yes src-address=217.144.x.108 add action=mark-routing chain=prerouting connection-mark=server-public in-interface=<LAN> new-routing-mark=to-chr passthrough=no /ip route add dst-address=0.0.0.0/0 gateway=172.16.1.2 routing-mark=to-chr
IP address: 217.144.X.108/32 (mask 255.255.255.255)
GW: 192.168.x.x
The 192.168.x.x can be either same address as assigned to router's LAN interface (if server is connected there), or some other address, it doesn't really matter (only that the same address is used on router and as gateway on server).
Server configuration depends on used OS. In Windows, it would be as written above. For Linux it depends on used distribution (they all seem to have different ways how to configure network), but manual config can be done using:Code: Select allip addr add 217.144.x.108 peer 192.168.x.x dev <interface> ip route add default via 192.168.x.x
Does Hetzner give public (IPv4) subnets on VPS? (Dedicated, yes)I am using a Hetzner Cloud VPS and ive found using a single vCPU, you can get around 400MBits, which ant bad at all. Adding an additional CPU produces around 800Mits. It seems to be CPU limited due to encryption so im looking at tweaking it a bit and see if can get a bit more out of it.
Thanks, spot on, I had a srcnat rule on the 150 address, now all sorted, thank you.Wrong source address, if I understand correctly that it's 94.xxx.xxx.150, it must be caused by another srcnat/masquerade rule. Instead of adding another srcnat, it's better to use accept rule, to exclude 195.xxx.xxx.6 from srcnat completely. It doesn't need any, it already has correct address.
IPv6 depends on how you get it. If a subnet would be routed to CHR, then you can just route part of it further over appropriate tunnel type, nice and clean. If not and it would be a subnet on WAN side of CHR, where you can only connect other hosts, then currently the only way would be to bridge everything all the way from CHR WAN to server. It should also be possible using some ND proxy, but RouterOS doesn't have that.
Hi @Joni,Does Hetzner give public subnets on VPS? (Dedicated, yes)I am using a Hetzner Cloud VPS and ive found using a single vCPU, you can get around 400MBits, which ant bad at all. Adding an additional CPU produces around 800Mits. It seems to be CPU limited due to encryption so im looking at tweaking it a bit and see if can get a bit more out of it.
Which VPS series are you running? CX series surely doesn't have even additional IPs.
Aye, confirmed myself with multiple addresses, works like a dream, thank you.One address or twelve, there's not much difference, you can use the same method, it will work.
/interface ipip
add allow-fast-path=no ipsec-secret=*********** local-address=94.xxx.xxx.150 name=ipip-tunnel remote-address=46.xxx.xxx.162
/ip address
add address=172.16.1.2/30 interface=ipip-tunnel
/ip arp
add address=195.xxx.xxx.6 interface=ether1-gateway published=yes
/ip route
add dst-address=195.xxx.xxx.6/32 gateway=172.16.1.1
/interface ipip
add allow-fast-path=no ipsec-secret=************ local-address=46.xxx.xxx.162 name=ipip-tunnel remote-address=94.xxx.xxx.150
/ip address
add address=172.16.1.1/30 interface=ipip-tunnel
add address=172.30.4.1/32 interface=ether2-master network=195.xxx.xxx.6
+++ /routing table
add disabled=no fib name=to-chr
/ip firewall mangle
add action=mark-connection chain=prerouting connection-mark=no-mark dst-address=195.xxx.xxx.6 in-interface=ipip-tunnel new-connection-mark=server-public passthrough=no
add action=mark-connection chain=prerouting connection-mark=no-mark new-connection-mark=server-public passthrough=yes src-address=195.xxx.xxx.6
add action=mark-routing chain=prerouting connection-mark=server-public in-interface=ether2-master new-routing-mark=to-chr passthrough=no
--- /ip route add dst-address=0.0.0.0/0 gateway=172.16.1.2 routing-mark=to-chr
+++ /ip route add dst-address=0.0.0.0/0 gateway=%ipip-tunnel routing-table=to-chr