DSL - Router auf Redhat 8.0

Von Kay

Ein paar Dinge vorweg:

Weitestgehend habe ich mich an die Anleitung auf http://www.adsl4linux.de für Redhat 7.3 gehalten.
Aber ich gehe noch zusätzlich auf das aktivieren des routings ein, damit die Windoofrechner Internet haben
Ich gehe davon aus, das die Netzwerkumgebung des Linuxrechners schon fertig eingerichtet ist.

Da bei Redhat 8.0 das [b:ab75fe53fd]/etc/rc.d/init.d/adsl [/b:ab75fe53fd]Script nicht mehr vorhanden ist, habe ich mein altes wieder genommen:

#!/bin/sh
#
# adsl This script starts or stops an ADSL connection
#
# chkconfig: - 345 80 20
# description: Connects to ADSL provider
#
# Based upon original script which comes with rp-pppoe
# Modified by Michael Schlenstedt, Michael@adsl4linux.de
#
# Tested with Red Hat Linux 7.0 and rp-pppoe 2.2, 2.3, 2.4, 2.5
#
# Version 0.3a

# Path to pppd
PPPD=/usr/sbin/pppd

# Path to pppoe
PPPOE=/usr/sbin/pppoe

# Ethernetdevice connected with your ADSL-Modem
ADSL_DEVICE=eth1

# Source function library if it exists
test -r /etc/rc.d/init.d/functions && . /etc/rc.d/init.d/functions

[ -x $PPPD ] || exit 0
[ -x $PPPOE ] || exit 0


RETVAL=0

start() {
if [ ! -f /var/lock/subsys/pppoe ]; then
echo -n "Bringing up ADSL link"
# $PPPD pty "$PPPOE -I $ADSL_DEVICE"
# Is this a router (Masquerading), so you have to use
# this line instead:
$PPPD pty "$PPPOE -I $ADSL_DEVICE -m 1452"
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/pppoe
echo
fi
return $RETVAL
}

stop() {
echo -n "Shutting down ADSL link"
killall $PPPD
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/pppoe
echo
return $RETVAL
}

restart() {
stop
start
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
condrestart)
[ -f /var/lock/subsys/pppoe ] && restart || :
;;
*)
echo "Usage: pppoe {start|stop|restart|condrestart}"
exit 1
esac

exit $RETVAL


Bitte ändert ADSL_DEVICE=eth1 für eure Bedürfnisse ab !! Am besten ihr guckt euch das Script ein bischen an, dann seht ihr auch, daß das Masqerading dem "adsl" - Script mitgegeben wird.
Wenn ihr es reinkopiert habt, macht ihr anschliessend:

chmod 755 adsl
chown root.root adsl
ln -s /etc/rc.d/init.d/adsl /etc/rc.d/rc3.d/S80adsl
ln -s /etc/rc.d/init.d/adsl /etc/rc.d/rc4.d/S80adsl
ln -s /etc/rc.d/init.d/adsl /etc/rc.d/rc5.d/S80adsl
ln -s /etc/rc.d/init.d/adsl /etc/rc.d/rc3.d/K20adsl
ln -s /etc/rc.d/init.d/adsl /etc/rc.d/rc4.d/K20adsl
ln -s /etc/rc.d/init.d/adsl /etc/rc.d/rc5.d/K20adsl

Soo, anschliessend geht in das /etc/ppp/ Verzeichniss. Dort editiert ihr folgende Dateien:

Anschlusskennung: 11111111111
T-Onlinenummer: 222222222222
Mitbenutzer: 0001
Passwort: geHeim (also dein Passwort !!)

[b:ab75fe53fd]/etc/ppp/chap-secrets [/b:ab75fe53fd]

# Secrets for authentication using CHAP
# client server secret IP addresses
"111111111111222222222222#0001@t-online.de" * "geHeim"


und die [b:ab75fe53fd]/etc/ppp/pap-secrets [/b:ab75fe53fd]

# Secrets for authentication using PAP
# client server secret IP addresses
"111111111111222222222222#0001@t-online.de" * "geHeim"


soo, anschliessend kommt die [b:ab75fe53fd]/etc/ppp/options [/b:ab75fe53fd]dran:

# /etc/ppp/options

# Für Dial On Demand muss diese Zeile aktiviert werden
demand

# Das Verbinden wird vom pppoe übernommen, ein Connect-Skript ist also
# nicht nötig
connect /bin/true

# Lokale und Remote-IP-Nummer vom Server wird akzeptiert
ipcp-accept-remote
ipcp-accept-local

# Der Server teilt uns den Nameserver mit
usepeerdns

# Nach 3 Minuten (180 s) Inaktivität wird aufgelegt
idle 180

# Wir haben keine gültige Default-IP, also nehmen wir die vom
# Provider zugewiesene
noipdefault

# Die Defaultroute wird auf diese Verbindung gesetzt
defaultroute

# Unser Login-Name beim Provider - muss exakt uebereinstimmen
# mit /etc/ppp/pap-secrets
user "1111111111111222222222222#0001@t-online.de"
hide-password

# Kompression abschalten!
noaccomp
nopcomp
novj
novjccomp
nobsdcomp
nodeflate
noccp

# Wir haben kein Modem, ein Handshake ist nicht nötig
nocrtscts

local
noauth

# Wird mittlerweile direkt dem pppoe als Option übergeben, daher hier
# deaktiviert
# mru 1492
# mtu 1492

# Alle 10 s nachschauen, ob der Server noch da ist. Bei 3 "Fehlpaketen"
# Verbindung beenden
lcp-echo-interval 10
lcp-echo-failure 3

# Specifies that pppd should use a UUCP-style lock on the serial device
# to ensure exclusive access to the device.
lock

# Nur zu Testzwecken sind die Meldungen im Syslog interessant
#debug

# Nicht in den Hintergrund "rutschen" - nur zu Testzwecken aktivieren!
#nodetach

Bitte tragt auch hier eure Zugangsdaten ein !!!


nun nur noch die [b:ab75fe53fd]etc/ppp/ip-up.local [/b:ab75fe53fd]. Diese Datei exestiert nicht, wird aber automatisch aufgerufen von der ip-up

#!/bin/sh

EXTIF=ppp0

modprobe ip_nat_ftp
modprobe ip_conntrack_ftp

iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -t nat -F PREROUTING
iptables -t nat -F POSTROUTING
iptables -P OUTPUT ACCEPT

iptables -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE


Das wars an Dateien, nur noch die Rechte ändern. Wie das geht, habe ich anhand des ADSL-Scripts beschrieben
options = root.root / 644
ip-up.local = root.root / 755
chap/pap-secrets = root.root / 600

Nun nur noch in das /etc/rc.d Verzeichniss und folgende Datei ändern:
[b:ab75fe53fd]etc/rc.d/rc.local[/b:ab75fe53fd]

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don‘t
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local

#### Routereinstellungen ####

## Kernelpatch für dynamische IP-Adressen
echo 2 > /proc/sys/net/ipv4/ip_dynaddr

## Kernelguard against SYN Flooding
echo 1 > /proc/sys/net/ipv4/tcp_syncookies

## IP-Forwarding im Kernel aktivieren
echo 1 > /proc/sys/net/ipv4/ip_forward


Soo, das wars Wenn ihr den Rechner neustartet und während des Startens keine Fehlermeldungen kommen, dann habt ihr alles richtig gemacht Die fertigen Scripts könnt ihr auch von meinem FTP runterladen.
Soo, ich hoffe ich habe nichts vergessen ;)


Soo, wenn ihr positive oder negative Kritiken habt, dann nur zu und schreibt

Bis denne und viel Erfolg....

 


 

Vielleicht auch interessant:


Über den Autor

Kay ist Experte für die Konfiguration von Gameservern unter Linux. Bleibt ihm neben dem kompilieren des neuesten Kernels noch Zeit, veröffentlicht er Artikel auf planet-rcs.de

Feedback