Changes

From Amahi Wiki
Jump to: navigation, search
1,476 bytes added ,  20:48, 31 January 2010
no edit summary
The following procedure will change this so that your client will receive an IP address like 192.168.0.x.
* sudo yum install bridge-utils * sudo nano /etc/openvpn/bridge-start<pre><nowiki>#!/bin/bash ################################## Set up Ethernet bridge on Linux# Requires: bridge-utils################################# br="br0"tap="tap0" eth="eth0"eth_ip=`ifconfig | grep -A 1 eth0 | tail -1 | awk -F':' '{printf $2}' | awk '{print $1}'`eth_netmask=`ifconfig | grep -A 1 eth0 | tail -1 | awk -F':' '{printf $4}' | awk '{print $1}'`eth_broadcast= This is a work in progess`ifconfig | grep -A 1 eth0 | tail -1 | awk -F':' '{printf $3}' | awk '{print $1}'` openvpn --mktun --dev $tap brctl addbr $brbrctl addif $br $ethbrctl addif $br $tap ifconfig $tap 0.0.0.0 promisc upifconfig $br $eth_ip netmask $eth_netmask broadcast $eth_broadcastifconfig $eth 0.0.0. It doesn't work yet0 promisc up</nowiki></pre> * sudo nano /etc/openvpn/bridge-stop<pre><nowiki>#! /bin/bash ##################################### Tear Down Ethernet bridge on Linux#################################### br="br0"tap="tap0"eth="eth0"eth_ip=`ifconfig | grep -A 1 br0 | tail -1 | awk -F':' '{printf $2}' | awk '{print $1}'`eth_netmask=`ifconfig | grep -A 1 br0 | tail -1 | awk -F':' '{printf $4}' | awk '{print $1}'`eth_broadcast=`ifconfig | grep -A 1 br0 | tail -1 | awk -F':' '{printf $3}' | awk '{print $1}'` ifconfig $br downbrctl delbr $br for t in $tap; do openvpn --rmtun --dev $tdone
* sudo yum install bridge-utilsif [ "$eth_ip" != "" ]; then ifconfig $eth $eth_ip netmask $eth_netmask broadcast $eth_broadcastfi</nowiki></pre>
* sudo nano chmod +x /usr/share/docetc/openvpn-2.1-1/sample-scripts/bridge-startReplace the values of eth_ip, eth_netmask and eth_broadcast in this file with the values you get from this command:<pre><nowiki>ifconfig | grep -A 1 eth0 | tail -1 | awk -F':' '{print $2,$3,$4}' | awk '{print $1,$5,$3}'<; sudo chmod +x /etc/nowiki><openvpn/pre>bridge-stop
Example* sudo nano /etc/openvpn/openvpn-startupAdd one line at the end of the file: <pre><nowiki>eth_ip="192.168.0.2"eth_netmask ="255.255.255.0"eth_ip="192.168.0.255"/etc/openvpn/bridge-start
</nowiki></pre>
* sudo cp nano /usretc/share/docopenvpn/openvpn-2.1.1/sample-scripts/bridge-start shutdown<pre><nowiki>/etc/openvpn/; sudo chmod +x bridge-stop</etcnowiki></openvpn/bridge-startpre>
* sudo chmod +x /etc/openvpn/bridgeopenvpn-startshutdown
* sudo nano /etc/openvpn/amahi.conf
Remove the line that contains: ''dev tun''
and replace it with those two linesthis:
<pre><nowiki>
mode server
tls-server
dev tap0
</nowiki></pre>
And remove (or comment out) the lines that start with ''server'' and ''ifconfig-pool-persist''.
* Repeat the last step with /etc/openvpn/amahi-dup-cn.conf
* sudo service openvpn restart
 
* In your OpenVPN client configuration, change ''dev tun'' with ''dev tap''. You'll also need to add a line that will make the client IP static:
<pre><nowiki>
ifconfig 192.168.1.2 255.255.255.0
</nowiki></pre>
[[Category: VPN]]