SoftEther is a nice project to establish a VPN a bit easily using both windows and linux enviorment. It has also a vpn azure ddns.
My enviorment is
- A network 192.168.1.0/24 with various host most important are
192.168.1.41 A DNS server and ActiveDirectory Server.
Inside there are adress for a specific client (we access via ipsec vpn)
- jboss.production.office1 10.210.21.34
- jboss.test.office2 10.209.21.34
- jboss4.test.office 10.211.21.34
192.168.1.236 main router DHCP server and a VPN server. The IPsec VPN redirect all packet from 192.168.1.0/24 the lan that goes to 10.100.9.0/24 or 10.210.21.0/24 or 10.211.12.0/24 on VPN tunnel with next hop 10.201.104.30
192.168.1.16 a softether server.
Before I had a win notebook now I have Fedora 29 one.
Softether create a TUN network card for each VPN you want to connect the name is vpn_vpnnicname not managed via NetworkManager (or I don't know how to manage it)
I connect via mobile phone and wireless via NetworkManager I am in a range 192.168.43.0\24 notebook is 192.168.43.2 phone is 192.168.43.1
I can establish a correct connection from softether client to server
- Under win it takes ip addr and configs in automatic mode.
Under linux i have read that i need to request a ip via dhcp.
The Leased IP is 192.168.1.111
dhclient vpn_vpnnicname #THIS retrive a IP
- The next step is to add some row in routing table
Afther this no ping is working host in 192.168.1.x are unreachable. So i used dhcpcd
sudo ip route add 192.168.1.0/24 via 192.168.1.236 dev vpn_vpnnicname #the route to acces inside VPN sudo ip route add 10.0.0.0/8 via 192.168.1.236 dev vpn_vpnnicname #the rule to go to ipsec vpn
This give the trick
sudo dhcpcd -B -G -C resolv.conf vpn_vpnnicname
- I can read who offers the ip 192.168.1.236
- I can read the IP leased 192.168.1.111
- I can read the route adding for 192.168.1.0/24 In routing table i see a row
I miss the second rule how to?
192.168.1.0 | 0.0.0.0 | 255.255.255.0 | U | 0 | 0 | 0 | vpn_vpnnicname
- The next step is to enable 192.168.1.41 dns. Under win I can set it associated to the nic. Under Linux I think is not possible. the solution is to use 192.168.1.41 globally but is not so nice is possible to use a 192.168.1.41 (it can resolve only 20 host on 10.x.x.x network) as primary and 188.8.131.52 as secondary. I have tried a lot of solution also the suggested How do I set my DNS when resolv.conf is being overwritten? the only that work is to write inside resolv.conf
Someone suggest to enable ip forward but is useful?
sudo sysctl -w net.ipv4.ip_forward=1
The qestions are
- How to create a correct dhcp lease
- How to create a correct routing table
- How to create a correct dns