Openwrt: Difference between revisions

From chaoswiki
Jump to navigation Jump to search
Line 52: Line 52:
#modprobe bridge
#modprobe bridge
openvpn --mktun --dev tap0
openvpn --mktun --dev tap0

# configure bridge
# configure bridge
brctl addbr br1
brctl addbr br1
brctl stp br1 off
brctl stp br1 off
brctl setfd br1 0
brctl setfd br1 0

brctl addif br1 vlan0
brctl addif br1 vlan0
brctl addif br1 tap0
brctl addif br1 tap0
Line 63: Line 63:
ifconfig vlan0 0.0.0.0 promisc up
ifconfig vlan0 0.0.0.0 promisc up
ifconfig tap0 0.0.0.0 promisc up
ifconfig tap0 0.0.0.0 promisc up

ifconfig br1 192.168.25.172 netmask 0xffffff00 broadcast 192.168.25.255
ifconfig br1 192.168.25.172 netmask 0xffffff00 broadcast 192.168.25.255
echo 1 > /proc/sys/net/ipv4/conf/br1/forwarding
echo 1 > /proc/sys/net/ipv4/conf/br1/forwarding

Revision as of 19:07, 11 September 2005

Openwrt knowledge

NVRAM

NVRAM is the EEPROM of the wrt54g. The Settings stored in the NVRAM is used by openwrt to configure the network interfaces and other settings like timezone and so on.

INfo's about NVRAM settings

OLSR

OLSR means Optimized Link State Routing protocol.

OLSR is a routing protocol for mobile ad-hoc networks. The protocol is pro-active, table driven and utilizes a technique called multipoint relaying for message flooding. You can configure multiple openwrt routers to talk to each other to find the best route from point A to point B.

WDS

WDS (Wireless Distribution System) can be used to mae a special tunnel between two openwrt's. It is also supported by many other Accesspoints. I didn't bring it to work so i had been looking for another solution. MESH networks soltuions can do that. OLSR is one implementation for that. AODV is another one.

Installing the software

Installing the openwrt firmware

I use this script to takeover the wrt54g. Get your firmware and copy it to the same directory as the takeover script.

Whether to use jffs2 or sqashfs is a philosophical question.

Plug in your wrt54g to you linux box. Configure your box in side 192.168.1.0/24 (not 192.168.1.1!)

Code: Installing openwrt on the Linksys wrt54g
wget http://downloads.openwrt.org/whiterussian/rc2/bin/openwrt-wrt54g-jffs2.bin
wget https://aachen.uni-dsl.de/download/wrt/Snapshots/rev121/buildroot-rev121/takeover
chmod +x takeover
cp openwrt-wrt54g-jffs2.bin  openwrt-g-code.bin
./takeover

Wait about 5 minutes. If openwrt is booting the DMZ LED should lightning.

Installing openvpn

Code: Installing openvpn
ipkg update
ipkg install openvpn
Code: /etc/init.d/S60openvpn
#!/bin/sh
# load Bridging-Module
#modprobe bridge      
openvpn --mktun --dev tap0

# configure bridge
brctl addbr br1   
brctl stp   br1 off
brctl setfd br1 0  

brctl addif br1 vlan0
brctl addif br1 tap0 
                    
ifconfig vlan0 0.0.0.0 promisc up
ifconfig tap0 0.0.0.0 promisc up 

ifconfig br1 192.168.25.172 netmask 0xffffff00 broadcast 192.168.25.255
echo 1 >  /proc/sys/net/ipv4/conf/br1/forwarding
                                                                                                                                                                           
openvpn --config /etc/openvpn/server.conf &


Code: /etc/openvpn/server.conf
port 1194
proto tcp-server
dev tap0
ca /etc/openvpn/keys/ca.crt
cert /etc/openvpn/keys/server.crt
key /etc/openvpn/keys/server.key  # This file should be kept secret
dh /etc/openvpn/keys/dh1024.pem

#this will assign connecting clients address between the range of 10 and 50
#openwrt IP is 192.168.25.172
server-bridge 192.168.25.172 255.255.255.0 192.168.25.10 192.168.25.50

#this will allow for people to get the same IP address after a reconnect
ifconfig-pool-persist /etc/openvpn/ipp.txt

push "dhcp-option DNS 192.168.25.179"
keepalive 10 120
max-clients 10
persist-key
persist-tun
Code: /etc/openvpn/server.conf
#the ip address of the openwrt box
remote 10.7.0.1
float
proto tcp-client
dev tap
persist-tun

redirect-gateway

#to set /etc/resolv.conf if necessary
up /etc/openvpn/wlan/client.up
down /etc/openvpn/wlan/client.down

pull
tls-client
cert /etc/openvpn/wlan/keys/client1.crt
ca /etc/openvpn/wlan/keys/ca.crt
key /etc/openvpn/wlan/keys/client1.key

Installing olsrd

Configuring the wrt54g

Configuring the network

Configuring openvpn

Configuring olsrd