Last but not least – a redundant internet connection (Part 4)

Author: stephan  |  Category: Linux, Netzwerk, openwrt

[lang_en]
myNetz
foreword
1.) You need at least 2 Linux Boxes for this. I used my OpenSuse Server with the VDSL Connection and the wrt160NL with Openwrt and UMTS/3G for this. 2 Openwrt Boxes are also suitable
2.) On Openwrt 10.03 I had Problems with Quagga-vtysh so I don’t used it
( On the Suse Box vtysh was working fine)
Main
First you have to install the Quagga Packets. For OpenWRT install

opkg install quagga quagga-libospf quagga-libzebra quagga-ospfd

For the second box please refer to the manual of your distribution.
If you don’t install vtysh , you can access to different consoles with
telnet 127.0.0.1 zebra (2601)
telnet 127.0.0.1 ospfd (2601)

For our case the interesting part is the ospf Configuration
router ospf
router ospf
ospf router-id 192.168.1.254
redistribute kernel
redistribute connected
network 192.168.1.0/24 area 0.0.0.0
neighbor 192.168.1.1
!
!

And the Configuration of the Suse Box

router ospf
ospf router-id 192.168.1.1
redistribute kernel
network 192.168.1.0/24 area 0.0.0.0
neighbor 192.168.1.254
!

Now let us check the routing table on both Boxes
suse# sh ip ro
Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF,
I - ISIS, B - BGP, > - selected route, * - FIB route

O 0.0.0.0/0 [110/200] via 192.168.1.254, eth1, 00:04:37
K>* 0.0.0.0/0 is directly connected, dsl0

openwrt# sh ip ro
Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF,
I - ISIS, B - BGP, H - HSLS, L - OLSR, M - BATMAN, > - selected route, * - FIB route

O 0.0.0.0/0 [110/200] via 192.168.1.1, br-lan, 00:00:48
K>* 0.0.0.0/0 is directly connected, ppp0

Both Router had their own defaultroutes and the Defaultroute of each other via ospf.
Has one router lost its connection , it has still the one of his neighbor

Source
http://www.taunusstein.net/index.php?option=com_content&view=article&id=62:routing&catid=15:linux
[/lang_en]

[lang_de]
myNetzVorwort
1.) Man benötigt mindestens 2 Linuxrechner dafür . Ich habe meinen Linuxserver mit Opensuse und der VDSL Leitung und den wrt160nl mit Openwrt und UMTS verwendet. Mit zwei Openwrtmaschinen funktioniert es aber genau so.
2.) Mit Openwrt 10.03 gab es mit der vtysh Problem, deswegen habe ich sie weggelassen ( Unter OpenSuse gab es keine Probleme mit der vtysh

Haupteil
Als erstes muss Quagga installiert werden. Für OpenWRT muss folgendes installiert werden

opkg install quagga quagga-libospf quagga-libzebra quagga-ospfd

Für die zweite Maschine verweise ich auf die Dokumenation der jeweiligen Distribution
Wenn man vtysh nicht installiert kann man die einzelnen Konsolen folgendermassen erreichen
telnet 127.0.0.1 zebra (2601)
telnet 127.0.0.1 ospfd (2601)

In unserem Fall ist die OSPF Konfiguration das Interessante


router ospf
ospf router-id 192.168.1.1
redistribute kernel
network 192.168.1.0/24 area 0.0.0.0
neighbor 192.168.1.254
!

Und die Konfiguration des zweiten Router
router ospf
router ospf
ospf router-id 192.168.1.254
redistribute kernel
redistribute connected
network 192.168.1.0/24 area 0.0.0.0
neighbor 192.168.1.1
!
!

Nun lasst uns die Routingtable anschauen
suse# sh ip ro
Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF,
I - ISIS, B - BGP, > - selected route, * - FIB route

O 0.0.0.0/0 [110/200] via 192.168.1.254, eth1, 00:04:37
K>* 0.0.0.0/0 is directly connected, dsl0

openwrt# sh ip ro
Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF,
I - ISIS, B - BGP, H - HSLS, L - OLSR, M - BATMAN, > - selected route, * - FIB route

O 0.0.0.0/0 [110/200] via 192.168.1.1, br-lan, 00:00:48
K>* 0.0.0.0/0 is directly connected, ppp0

Beide Router haben ihre eigene Kernel Defaultroute und die jeweils andere Defaultroute via OSPF.
Verliert einer der Router seine eigene Verbindung hat er noch die Defaultroute des Nachbarrouters

Quelle
http://www.taunusstein.net/index.php?option=com_content&view=article&id=62:routing&catid=15:linux

[/lang_de]

Installing 3G/UMTS ( Huawei e220 ) onto WRT 160nl and Openwrt(Part 3)

Author: stephan  |  Category: Linux, Netzwerk, openwrt

[lang_en]

First we need to install a bunch of packets

opkg install kmod-ar9170 kmod-usb-core kmod-usb-serial comgt kmod-usb-uhci kmod-usb2 kmod-ppp huaweiaktbbo

The E220 has two modes . To switch from USB Stick to UMTS you need huaweiaktbbo

root@OpenWrt:~# huaweiAktBbo
Searching modem...found supported modem!
Modem poked!

Its a clever idea to put it into init.d for startup. I used this script by Simon Josefsson


root@OpenWrt:/etc/init.d# cat huaweiAktBbo
#!/bin/sh /etc/rc.common
# Written by Simon Josefsson 2009-03-05. Released into the public domain.

START=70
start() {
huaweiAktBbo
}

Make the script accessible and enable it
And you need the following

root@OpenWrt:/# cat /etc/modules.d/60-usb-serial
usbserial vendor=0x12d1 product=0x1003

Then Reboot the Router

Next step ist to get ppp working. My working scripts ( I had a few tries before I found a working config)

root@OpenWrt:/# cat /etc/chatscripts/3g.chat
ABORT BUSY
ABORT 'NO CARRIER'
ABORT ERROR
REPORT CONNECT
TIMEOUT 10
"" "ATX"
OK "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"
OK 'AT+CGDCONT=1,"IP","$USE_APN","0.0.0.0"'

SAY "Calling UMTS/GPRS"
TIMEOUT 30
#OK "ATD*99***1#"
OK "ATD*99#"
CONNECT ' '


root@OpenWrt:/# cat /etc/ppp/options
115200
logfile /dev/null
noaccomp
nopcomp
nocrtscts
lock
maxfail 0
lcp-echo-failure 0
lcp-echo-interval 0
ipcp-max-failure 30


root@OpenWrt:/# cat /etc/config/network
...
#### UMTS configuration
config interface ppp0
option ifname ppp0
option proto 3g
option device /dev/ttyUSB0
option 'service' 'umts'
option apn internet.eplus.de
option pincode 0000
option 'defaultroute' '1'
option 'peerdns' '1'

With an ifup ppp0 , the 3G modem should start connecting

My Sources
http://www.it-slav.net/blogs/2010/06/12/howto-use-3g-dongle-huawei-e1750-in-openwrt/
http://josefsson.org/openwrt/dongle.html

[/lang_en]
[lang_de]

Zuerst benötigen wir eine Menge Packete

opkg install kmod-ar9170 kmod-usb-core kmod-usb-serial comgt kmod-usb-uhci kmod-usb2 kmod-ppp huaweiaktbbo

Das E220 hat Zwei Modi .
Um vom USB STick zum Modem zu wechseln benötigt man das Program huaweiaktbbo

root@OpenWrt:~# huaweiAktBbo
Searching modem...found supported modem!
Modem poked!

es ist jetzt eine gute Idee , das ganze via Startup zu automatisieren.
Ich verwende hierfür das Script von Simon Josefsson


root@OpenWrt:/etc/init.d# cat huaweiAktBbo
#!/bin/sh /etc/rc.common
# Written by Simon Josefsson 2009-03-05. Released into the public domain.

START=70
start() {
huaweiAktBbo
}

Das Script sollte man nun ausführbar machen und enablen damit es bei jedem Start wieder ausgeführt wird

Und man braucht das folgende

root@OpenWrt:/# cat /etc/modules.d/60-usb-serial
usbserial vendor=0x12d1 product=0x1003

Danach den Router neu starten

Der nächste Schritt ist den PPP zum Laufen zu bekommen . Anbei meine funktionierenden scripte ( Ich habe ein bischen probieren müssen bevor es lief)


root@OpenWrt:/# cat /etc/chatscripts/3g.chat
ABORT BUSY
ABORT 'NO CARRIER'
ABORT ERROR
REPORT CONNECT
TIMEOUT 10
"" "ATX"
OK "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"
OK 'AT+CGDCONT=1,"IP","$USE_APN","0.0.0.0"'

SAY "Calling UMTS/GPRS"
TIMEOUT 30
#OK "ATD*99***1#"
OK "ATD*99#"
CONNECT ' '


root@OpenWrt:/# cat /etc/ppp/options
115200
logfile /dev/null
noaccomp
nopcomp
nocrtscts
lock
maxfail 0
lcp-echo-failure 0
lcp-echo-interval 0
ipcp-max-failure 30


root@OpenWrt:/# cat /etc/config/network
...
#### UMTS configuration
config interface ppp0
option ifname ppp0
option proto 3g
option device /dev/ttyUSB0
option 'service' 'umts'
option apn internet.eplus.de
option pincode 0000
option 'defaultroute' '1'
option 'peerdns' '1'

Mit einem ifup ppp0 ,sollte das UMTS Modem anfangen sich zu verbinden

Meine Quellen
http://www.it-slav.net/blogs/2010/06/12/howto-use-3g-dongle-huawei-e1750-in-openwrt/
http://josefsson.org/openwrt/dongle.html

[/lang_de]