quagga یک نوع نرم افزار مسیریابی تحت لینوکس می باشد که از zebra منشعب شده و پروتکل های مسیریابی همچون RIPv1,RIPv2,OSPFv2,OSPFv3,BGP-4و +BGP-4را پشتیبانی میکند.(معرفی این پروتکل ها خارج از بحث ما میباشد برای شناخت بهتر به کتابهای CCNAو BCMSN شرکت سیسکو که از طریق سایت Persianadmins میتوانید تهیه کنید.)شیوه تنظیمات quagga شبیه به IOS شرکت سیسکو میباشد که همین عامل باعث جذب افراد آشنا به محصولات سیسکو که طیف وسیعی را تشکیل میدهند به این نرم افزار میشود.
در فدورا و دبین از quagga بجای zebra استفاده میشود و همراه با cd و dvd های آنها عرضه میشود(من در اینجا سیستم را دبین در نظر گرفتم که تنها تفاوت با سیستم های دیگر در نصب میباشد که براحتی میتوانید این مسئله را حل کنید)
مراحل نصب :
#apt-get install quagga
فایل تنظیمات در etc/quagga/ ذخیره میشود که در فدورا طی نصب این فایل ها ساخته میشود ولی در دبین اینطور که من نصب کردم باید خودتان این فایل ها را بسازید.تنها 2 فایل در این دایرکتوری قرار دارد
daemons :
# This file tells the quagga package which daemons to start.
# Entries are in the format:=(yes|no|priority)
# 0, "no" = disabled
# 1, "yes" = highest priority
# 2 .. 10 = lower priorities
#
zebra=no
bgpd=no
ospfd=no
ospf6d=no
ripd=no
ripngd=no
isisd=no
debian.conf :# If this option is set the /etc/init.d/quagga script automatically loads
# the config via "vtysh -b" when the servers are started.
#
vtysh_enable=yes
zebra_options=" –daemon -A 127.0.0.1"
bgpd_options=" –daemon -A 127.0.0.1"
ospfd_options=" –daemon -A 127.0.0.1"
ospf6d_options="–daemon -A ::1"
ripd_options=" –daemon -A 127.0.0.1"
ripngd_options="–daemon -A ::1"
isisd_options=" –daemon -A 127.0.0.1"
behroozi:~# grep zebra /etc/services
zebrasrv 2600/tcp # zebra service
zebra 2601/tcp # zebra vty
ripd 2602/tcp # ripd vty (zebra)
ripngd 2603/tcp # ripngd vty (zebra)
ospfd 2604/tcp # ospfd vty (zebra)
bgpd 2605/tcp # bgpd vty (zebra)
ospf6d 2606/tcp # ospf6d vty (zebra)
isisd 2608/tcp # ISISd vty (zebra)
اول از هر چیز باید مشخص کنیم چکار میخوایم انجام بدیم که من چون اکثر ما روتر سیسکو برای تست نداریم با روتر نرم افزاری ویندوز 2003 این کارو انجام میدم
در ادامه ما با یک ارتباط rip دو شبکه مشخص شده در دیاگرام زیر را بهم وصل میکنیم
zebra=yes
bgpd=no
ospfd=no
ospf6d=no
ripd=yes
ripngd=no
isisd=no
#cp /usr/share/doc/quagga/examples/zebra.conf.sample /etc/quagga/zebra.conf
#cp /usr/share/doc/quagga/examples/ripd.conf.sample /etc/quagga/ripd.conf
behroozi:~# /etc/init.d/quagga restart
Stopping Quagga daemons (prio:0): (waiting) .. ripd (waiting) .. zebra (bgpd) (ripngd) (ospfd) (ospf6d).
Removing all routes made by zebra.
Nothing to flush.
Loading capability module if not yet done.
Starting Quagga daemons (prio:10): zebra ripd.
behroozi:~#
behroozi:~# telnet 127.0.0.1 2601
Trying 127.0.0.1…
Connected to 127.0.0.1.
Escape character is '^]'.Hello, this is Quagga (version 0.98.3).
Copyright 1996-2005 Kunihiro Ishiguro, et al.User Access Verification
Password: (zebra)
Router> en
Password: (zebra)
Router#
Router#conf t
Router(config)# password reza
Router(config)# enable password persianadmins
behroozi(config)# hostname persianadmins.com
persianadmins.com(config)#
persianadmins.com(config)# service password-encryption
persianadmins.com(config)# int eth0
persianadmins.com(config-if)# ip address 192.168.0.1/24
persianadmins.com(config-if)# exit
persianadmins.com(config)# int eth1
persianadmins.com(config-if)# ip address 192.168.1.1/24
persianadmins.com(config-if)# exit
persianadmins.com(config)# exit
persianadmins.com# sh runCurrent configuration:
!
hostname persianadmins.com
password 8 ETqePsm6sd5o6
enable password 8 5B5WeM1SCnAag
service password-encryption
!
interface eth0
ip address 192.168.0.1/24
!
interface eth1
ip address 192.168.1.1/24
!
interface lo
!
ipv6 forwarding
!
line vty
!
end
persianadmins.com#
persianadmins.com# write memory
Configuration saved to /etc/quagga/zebra.conf
persianadmins.com#
با استفاده از service password-encryption مشاهده میکنید که پسورد از حالت plain-text بیرون آمده پس حتما از این دستور استفده کنید, 2 نکنته رو باید در تنظمیات بالا توجه کنید که با اضافه کردن ip از این طریق تغییری در ip قبلی بوجود نمیاد و این ip به آنها اضافه میشود…همچنین در انتها باید تنظمیات صورت گرفته را با write memory ذخیره کرد.
behroozi:~# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:5F:60:A2
inet addr:192.168.0.1 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:55323 errors:0 dropped:0 overruns:0 frame:0
TX packets:35346 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6662562 (6.3 MiB) TX bytes:5157684 (4.9 MiB)
Interrupt:18 Base address:0×1080
eth1 Link encap:Ethernet HWaddr 00:0C:29:5F:60:AC
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:131 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:8244 (8.0 KiB) TX bytes:0 (0.0 b)
Interrupt:19 Base address:0×1400
workstation2:~# ping 192.168.2.2
PING 192.168.2.2 (192.168.2.2) 56(84) bytes of data.
From 192.168.0.1 icmp_seq=1 Destination Host Unreachable
From 192.168.0.1 icmp_seq=2 Destination Host Unreachable
From 192.168.0.1 icmp_seq=3 Destination Host Unreachable
From 192.168.0.1 icmp_seq=4 Destination Host Unreachable
behroozi:~# telnet 127.0.0.1 2602
Trying 127.0.0.1…
Connected to 127.0.0.1.
Escape character is '^]'.Hello, this is Quagga (version 0.98.3).
Copyright 1996-2005 Kunihiro Ishiguro, et al.User Access Verification
Password: (zebra)
ripd> en
ripd#
ripd# conf t
ripd(config)# password reza
ripd(config)# enable password persianadmins
ripd(config)#router rip
ripd(config-router)# network 192.168.0.0/24
ripd(config-router)# network 192.168.1.0/24
ripd(config-router)# version 2
ripd(config)#
ripd# sh runCurrent configuration:
!
hostname ripd
password reza
enable password persianadmins
log stdout
!
router rip
version 2
network 192.168.0.0/24
network 192.168.1.0/24
!
line vty
!
end
ripd#
ripd# write memory
Configuration saved to /etc/quagga/ripd.conf
ripd#
حالا باید سرویس رو دوباره راه اندازی کرد
#/etc/init.d/quagga restart
نوبت به تنظیمات ویندوز میرسد که من به صورت تصویری اینجا میزارم
حالا دوباره از workstation2 به workstation1 دستور ping رو اجرا میکنیم
workstation2:~# ping 192.168.2.2
PING 192.168.2.2 (192.168.2.2) 56(84) bytes of data.
64 bytes from 192.168.2.2: icmp_seq=1 ttl=64 time=1.45 ms
64 bytes from 192.168.2.2: icmp_seq=2 ttl=64 time=0.082 ms
64 bytes from 192.168.2.2: icmp_seq=3 ttl=64 time=0.043 ms
64 bytes from 192.168.2.2: icmp_seq=4 ttl=64 time=0.042 ms
64 bytes from 192.168.2.2: icmp_seq=5 ttl=64 time=0.041 ms— 192.168.2.2 ping statistics —
5 packets transmitted, 5 received, 0% packet loss, time 4034ms
rtt min/avg/max/mdev = 0.041/0.332/1.454/0.561 ms
workstation2:~#
مشاهده میکنید که ارتباط برقرار شده …همچنین برای دیدن جدول routing بدین ترتیب عمل میکنیم
در لینوکس
در ویندوز
توجه داشته باشید که مثال بالا بخش کوچکی از دستورات quagga رو به نمایش گذاشت که برای دیدن دستورات و عملکرد کامل اون میتوانید این PDF را دانلود کنید
تامین امنیت :
شاید فکر کنید که هر کس میتونه با راه انداختن یک روتر و تنظیم اون به شبکه ما متصل بشه…برای جلوگیری از این کار فایروال رو بدین ترتیب تنظیم میکنیم
از این اسکریپت استفاده میکنیم
#!/bin/bash
I=/sbin/iptables
#flush all rules
$I –F
#allow packets on the loopback interface
$I -A INPUT -i lo -j ACCEPT
#reject all zebra vtys
$I -A INPUT -p tcp –dport 2601:2602 -i eth+ -j REJECT
#allow the rip neighbors to connect to udp port 520
$I –A INPUT –p udp –-dport 520 –s 192.168.0.2 –j ACCEPT
#reject the rest of the world for the udp port 520
$I –A INPUT –p udp –-dport 520 –j REJECT
برای اینکه فقط از طریق localhost بتوان telnet کرد access-list بدین شکل مینویسیم
behroozi:~# telnet ۱۲۷.۰.۰.۱ ۲۶۰۱
Trying ۱۲۷.۰.۰.۱…
Connected to ۱۲۷.۰.۰.۱.
Escape character is '^]'.Hello, this is Quagga (version ۰.۹۸.۳).Copyright ۱۹۹۶-۲۰۰۵ Kunihiro Ishiguro, et al.
User Access VerificationPassword:
persianadmins.com> en
Password:
persianadmins.com#
persianadmins.com# conf t
persianadmins.com(config)# access-list 1 permit host 127.0.0.1
persianadmins.com(config)# access-list 1 deny any
persianadmins.com(config)# line vty
persianadmins.com(config-line)# access-class 1
persianadmins.com(config-line)# exit
برای تست تنظیمات بالا بوسیله telnet از کامپیوتری دیگر به پورت های 2601 و 520 متصل میشویم
C:\Documents and Settings\reza>telnet 192.168.0.1 2601
Connecting To 192.168.0.1….Could not open connection to the host, on port 2601: Connect failedC:\Documents and Settings\reza>telnet 192.168.0.1 2602
Connecting To 192.168.0.1….Could not open connection to the host, on port 2602: Connect failed
همونطور که پیداست امکان ارتباط وجود نداره پس تنظیمات ما بدرستی اعمال شده است.
رضا بهروزی
www.reza.behroozi.info
reza@behroozi.info
هیچ نظری موجود نیست:
ارسال یک نظر