Configuring L2TP client with static ip adress of ethernet port

From DD-WRT Wiki

Jump to: navigation, search

Introduction

I didn't find a way to configure from the GUI DD-WRT firmware to connect to L2TP server , if there is no valid DHCP server in the network. Here is my solution of that problem.

Setup

So, you have a static ip, netmask && default route && dns servers, as well as ip adress of L2TP server. In order to be able to access VPN server, I created vlan1:0 alias, then add static route to L2TP server, and finally add it to startup commands.

Here it is :

L2TP server adress : 10.200.0.1, gateway 10.23.128.***

My statis IP configuration from inet provider: 10.23.128.*** netmask 255.255.255.***


I noticed that there is a DHCP server in the network, but it gives me strange and unusable ip adress, 192.168.1.* and also sets my default route to 192.168.1.1. I had to delete it manually.

That is the final list of commands added to startup (Administration-Commands-Startup):

ifconfig vlan1:0 inet 10.23.128.*** netmask 255.255.255.***

route add 10.200.0.1 gw 10.23.128.***

while true; do route del 10.200.0.1 gw `netstat -rn | grep "10.200.0.1" | grep "192.168" | awk '{print $2}'` ; sleep 10; done


In the Connection Type in Setup section enter L2TP, enter server ip adress, your username&&password. That's all, it should work.