IPsec/IKEv2-based VPN software for Linux
# sudo brctl addbr br0
# sudo brctl addif eth0 # sudo ip addr add 192.168.0.100/24 brd + dev br0 # sudo ip -6 addr add 2001:db8::100/64 dev br0 # sudo ip route add default via 192.168.0.10 # sudo ip -6 route add default via 2001:db8::10 |
# sudo ip addr add 10.0.0.1/24 brd + dev eth0
# sudo ip -6 addr add 2001:db8:10::1/64 dev eth0 # sudo ip addr add 192.168.0.10/24 brd + dev eth1 # sudo ip -6 addr add 2001:db8::10/64 dev eth1 # sudo sysctl net.ipv4.ip_forward=1 # sudo sysctl net.ipv6.conf.all.forwarding=1 Forward packets destinated to 10.0.0.1:500(Router1) to 192.168.0.100:500(VPN Gateway). # sudo iptables -t nat -A PREROUTING -p udp --dst 10.0.0.1 --dport 500 -j DNAT --to-destination 192.168.0.100:500 Forward packets destinated to 10.0.0.1:4500(Router1) to 192.168.0.100:4500(VPN Gateway). # sudo iptables -t nat -A PREROUTING -p udp --dst 10.0.0.1 --dport 4500 -j DNAT --to-destination 192.168.0.100:4500 Forward packets destinated to [2001:db8:10::1]:500(Router1) to [2001:db8::1]:500(VPN Gateway). # sudo ip6tables -t nat -A PREROUTING -p udp --dst 2001:db8:10::1 --dport 500 -j DNAT --to-destination [2001:db8::100]:500 Forward packets destinated to [2001:db8:10::1]:4500(Router1) to [2001:db8::1]:4500(VPN Gateway). # sudo ip6tables -t nat -A PREROUTING -p udp --dst 2001:db8:10::1 --dport 4500 -j DNAT --to-destination [2001:db8::100]:4500 |
# sudo ip addr add 10.0.0.10/24 brd + dev eth0
# sudo ip -6 addr add 2001:db8:10::10/64 dev eth0 # sudo ip addr add 192.168.2.1/24 brd + dev eth1 # sudo ip -6 addr add 2001:db8:2::1/64 dev eth1 # sudo sysctl net.ipv4.ip_forward=1 # sudo sysctl net.ipv6.conf.all.forwarding=1 Exec NAPT for packets from private network(192.168.2.0/24). # sudo iptables -t -nat -A POSTROUTING -o eth0 -j MASQUERADE --random -s 192.168.2.0/24 Exec NAPT for packets from private network(2001:db8:2::/64). # sudo ip6tables -t -nat -A POSTROUTING -o eth0 -j MASQUERADE --random -s 2001:db8:2::/64 |
# sudo apt-get install radvd
# sudo touch /etc/radvd.conf # sudo vi /etc/radvd.conf |
interface eth1
{ AdvSendAdvert on; MaxRtrAdvInterval 60; prefix 2001:0db8:2::/64 { }; }; |
# sudo /etc/init.d/radvd restart
or # sudo systemctl restart radvd |
# sudo ip addr add 192.168.0.1/24 brd + dev eth0
# sudo ip -6 addr add 2001:db8::1/64 dev eth0 # sudo ip addr add 192.168.1.1/24 brd + dev eth1 # sudo ip -6 addr add 2001:db8:1::1/64 dev eth1 # sudo ip addr add 192.168.x.1/24 brd + dev eth2 # sudo ip -6 addr add 2001:db8:x::1/64 dev eth2 # sudo sysctl net.ipv4.ip_forward=1 # sudo sysctl net.ipv6.conf.all.forwarding=1 |
# sudo apt-get install radvd
# sudo touch /etc/radvd.conf # sudo vi /etc/radvd.conf |
interface eth0
{ AdvSendAdvert on; MaxRtrAdvInterval 60; prefix 2001:0db8::/64 { }; }; |
# sudo /etc/init.d/radvd restart
or # sudo systemctl restart radvd |
# sudo ip addr add 192.168.0.101/24 brd + dev eth0
# sudo ip -6 addr add 2001:db8::101/64 dev eth0 |
auto eth0
iface eth0 inet manual up ip link set dev eth0 promisc on auto br0 iface br0 inet static address 192.168.0.100 network 192.168.0.0 netmask 255.255.255.0 gateway 192.168.0.10 broadcast 192.168.0.255 bridge_ports eth0 bridge_stp off bridge_maxwait 10 iface br0 inet6 static address 2001:db8::100 netmask 64 gateway 2001:db8::10 |
- VPN Configuration[Tab] > Edit VPN Realm(Save, Add, etc.)[Left-Tree]: Click this tree node and show Edit VPN Realm(Save, Add, Remove, or Load) pane.
- Click Add VPN Realm button.
- Add a VPN Realm[Dialog]: Enter the following, then click OK button.
Realm ID: 10
Realm Name: "Example VPN"
Description: "Config for Example VPN."
Mode: Bridge
- VPN Configuration[Tab]
> VPN Realms[Left-Tree]
> 10:Example VPN(Bridge)[Left-Tree]
> VPN Interface[Left-Tree]:
Click this tree node and show VPN
Tunnel/TAP Interface pane.
- Enter or select the following.
Internal Address Type: Unnumbered(for bridging)
Linked Bridge Name: br0
- If Remote Access Client communicates with hosts on other subnets like 192.168.1.0/24, enter the following router's addresses. VPN Gateway will forward decrypted packets destinated to other subnets to the router(192.168.0.1 and 2011:db8::1).
Internal Gateway's Address (optional) > IPv4: 192.168.0.1
Internal Gateway's Address (optional) > IPv6: 2001:db8::1
- VPN Configuration[Tab]
> VPN Realms[Left-Tree]
> 10:Example VPN(Bridge)[Left-Tree]
> Network Interface[Left-Tree]:
Click this tree node and show Network
Interface pane.
- Uncheck Use default route and enter the followings.
Primary interface:
- Name: Select br0 as a source interface
and IPv4 and IPv6.
- Uncheck Destination NAT Address (MOBIKE Responder) and enter the followings.
Primary interface:
Dest NAT IPv4 Address: 10.0.0.1 (Router1's global address[eth0])
Dest NAT IPv6 Address: 2001:db8:10::1 (Router1's global address[eth0])
By the above settings, a remote client is notified of a Router1's global address as a MOBIKE additional address.
- VPN Configuration[Tab]
> VPN Realms[Left-Tree]
> 10:Example VPN(Bridge)[Left-Tree]
> Service[Left-Tree]:
Click this tree node and show Service pane.
- Network Deployment: Select Hub(Concentrator) Node.
- Remote Configuration(IKEv2): Select Remote Configuration Server.
- Authentication Method for remote peers: Check EAP (Extensible Authentication Protocol) Clients. [Version 0.2.b1-021 -]
- EAP Server: Select EAP-MSCHAPv2.
- Default EAP Server: Check Enable.
- VPN Configuration[Tab]
> VPN Realms[Left-Tree]
> 10:Example VPN(Bridge)[Left-Tree]
> Service[Left-Tree]
> Remote Config Server[Left-Tree]:
Click this tree node and show Remote Config Server(IKEv2) pane.
- Remote Config Server(IKEv2)[Pane]
> Internal Address Pool[Tab]:
Click Add Address Pool button.
- Add a New Address Pool[Dialog]:
Enter the following, then click OK button.
Address Type: IPv4 Address Range
IPv4 Address Range: 192.168.0.20 - 192.168.0.30
Similarly, add the following for IPv6.
Address Type: IPv6 Address Range
IPv6 Address Range: 2001:db8::20 - 2001:db8::2a
- Remote Config Server(IKEv2)[Pane]
> Internal Route Map[Tab]:
Check Allow link-local ICMPv6 for Router Solicitation(RS) and Advertisement(RA).
By checking the above setting, traffic selectors allowing link-local ICMPv6(RA/RS) are automatically added for
the Windows VPN client. By receiving RA through a VPN tunnel, the VPN client configures it as a default route.
See also Connecting a Windows 7/8/10 VPN Client with Rockhopper.
- Remote Config Server(IKEv2)[Pane]
> Internal DNS[Tab]:
Enter the following as an Internal DNS server's addresses.
DNS Server's Address > IPv4: 192.168.0.101
DNS Server's Address > IPv6: 2001:db8::101
- VPN Configuration[Tab]
> VPN Realms[Left-Tree]
> 10:Example VPN(Bridge)[Left-Tree]
> My Key Store[Left-Tree]:
Click this tree node and show My Key Store pane.
- Enter the following.
Authentication Method: RSA Signature(RSA-Sig)
My ID Type: auto
Imported Key Format: PKCS#12 - File
PKCS#12 file(*.p12): gateway1.example.com.p12
RSA Private Key's Password: himitsu
- VPN Configuration[Tab]
> VPN Realms[Left-Tree]
> 10:Example VPN(Bridge)[Left-Tree]
> Peers' Key Store[Left-Tree]:
Click this tree node and show Peers Key Store pane.
- Click Add Peer's Key/Password button.
- Add a New Peer's Key[Dialog]: Enter the following, then click "OK" button.
Peer ID Type: EAP-MSCHAPv2: User Name
Peer ID: alice
Pre-Shared Key(PSK)/Password: 1234567890
- VPN Configuration[Tab]
> VPN Realms[Left-Tree]
> 10:Example VPN(Bridge)[Left-Tree]
> Child SA Settings[Left-Tree]:
Click this tree node and show Child SA Detailed Settings pane.
Check Enable ESP's UDP-encapsulation for IPv6 NAT-T after receiving a UDP-encapsulated packet from a remote peer(non-Rockhopper).
See also Connecting a Windows 7/8/10 VPN Client with Rockhopper.
- VPN Configuration[Tab] > Edit VPN Realm(Save, Add, etc.)[Left-Tree]: Click this tree node and show Edit VPN Realm(Save, Add, Remove, or Load) pane.
- Click Save Configuration button.
2001:db8:10::1 gateway1.example.com # (Example VPN)
10.0.0.1 gateway1.example.com # (Example VPN) |