| 1 | == ip L2TP Connectivity To I2 == |
| 2 | |
| 3 | === Installing the Prerequisite Software === |
| 4 | |
| 5 | We're using the ip l2tp tunnels that have been part of the linux kernels since verion 2.6.35. To use it you must load the l2tp_eth module (manually) as this support is not loaded automatically. Tunnels are built in a 2 stage process that uses ''/etc/network/interfaces'' and the script that brings the interfaces up (''tunnel.sh''). |
| 6 | |
| 7 | ''/etc/network/interfaces'' should look like: |
| 8 | {{{ |
| 9 | # This file describes the network interfaces available on your system |
| 10 | # and how to activate them. For more information, see interfaces(5). |
| 11 | |
| 12 | # The loopback network interface |
| 13 | auto lo |
| 14 | iface lo inet loopback |
| 15 | |
| 16 | # The primary network interface - this is the outbound interface (static assignment) |
| 17 | auto eth0 |
| 18 | iface eth0 inet static |
| 19 | address XXX.YYY.ZZZ.111 |
| 20 | netmask 255.255.255.224 |
| 21 | gateway XXX.YYY.ZZZ.1 |
| 22 | dns-nameservers 8.8.8.8 |
| 23 | |
| 24 | auto eth1 |
| 25 | iface eth1 inet manual |
| 26 | }}} |
| 27 | |
| 28 | The convention we've adopted is that '''eth0 is the externally route-able interface''' and '''eth1''' is local subnet interface (please note that it doesn't need an IP address at this stage). The tunnel script (''tunnel.sh'') looks like: |
| 29 | |
| 30 | {{{ |
| 31 | #!/bin/bash |
| 32 | |
| 33 | modprobe l2tp_eth |
| 34 | ifconfig eth1 up |
| 35 | |
| 36 | ip l2tp add tunnel remote 128.6.192.147 local XXX.YYY.ZZZ.1111 \ |
| 37 | tunnel_id 1 peer_tunnel_id 1 udp_sport 3000 udp_dport 3000 encap udp |
| 38 | |
| 39 | ip l2tp add session name l2tpsess1 \ |
| 40 | tunnel_id 1 session_id 1 peer_session_id 1 |
| 41 | |
| 42 | ip link set l2tpsess1 up mtu 1446 |
| 43 | ip link add brvlan1 type bridge |
| 44 | ip link set l2tpsess1 master brvlan1 |
| 45 | ip link set eth1 master brvlan1 |
| 46 | ifconfig brvlan1 up |
| 47 | }}} |
| 48 | |
| 49 | This script preforms the following actions: |
| 50 | 1. Loads the l2tp kernel module |
| 51 | 1. Brings up the local interfaces |
| 52 | 1. Brings up the tunnel |
| 53 | 1. Creates the session for the interface |
| 54 | 1. Creates the bridge |
| 55 | 1. Connects the session interface to the local (i.e. bridge the two interfaces) |
| 56 | 1. Brings the bridge up. |
| 57 | |
| 58 | You can check the newly created bridge functionality after running the script by executing: |
| 59 | {{{ |
| 60 | root@landing1:/root# brctl show brvlan1 |
| 61 | bridge name bridge id STP enabled interfaces |
| 62 | brvlan1 8000.003048b19da9 no eth1 |
| 63 | l2tpsess1 |
| 64 | }}} |
| 65 | |
| 66 | |