ลองคิดต่อน่ะครับ
โจทย์มี routing
155.1.0.0/24
155.1.1.0/24
155.1.2.0/24
155.1.3.0/24
155.1.4.0/24
155.1.5.0/24
....
155.1.255.0/24
ต้องการเขียน filter เพื่อรับ routing เฉพาะ octet ที่3 เป็นเลขคู่เท่านั้น โดย access-list ที่เขียนใช้จำนวนบรรทัดน้อยที่สุดที่เป็นไปได้
ผลที่ผ่าน acl แล้ว
155.1.0.0/24
155.1.2.0/24
155.1.4.0/24
155.1.6.0/24
155.1.8.0/24
....
155.1.254.0/24
Saturday, June 23, 2007
[Cisco] ลองคิดเล่นๆ #2
Friday, June 22, 2007
[Cisco] ลองคิดเล่นๆ
ต้องการเพิ่ม user เข้าใน router โดยมีข้อมูลดังนี้
username cisco password cisco?
จะต้องทำอย่างไร
Wednesday, June 20, 2007
[Cisco] Event Manager ไว้ต้องการจับ event แล้วให้ทำคำสั่ง
Event Manager:
เวลาเราต้องการให้ router พบ event บางอย่างแล้วให้ action ตาม command ที่กำหนด ตัวอย่างคือ เมื่อ event manager พบ syslog ที่มี pattern neighbor x.x.x.x Up/Down แล้วให้ทำคำสั่ง
#conf t
event manager applet bgp-down
event syslog pattern "neighbor 192.168.10.2 Down" <-- ตรวจจับ event ของ syslog ที่มี pattern "neighbor 192.168.10.2 Down"
action 1.0 cli command "conf t" <--- ให้เริ่มทำคำสั่ง
action 1.1 cli command "int f0/0"
action 1.2 cli command "no ip policy route-map redirect"
action 1.3 cli command "no ip wccp 80 redirect in"
action 1.4 syslog msg "Alert !!!! policy change by BGP-Down" <--- ให้ส่ง message ไป syslog
action 1.5 mail server "20.20.20.1" to "kitti@mail.xx" from "event-mager@router" subject "Alert neighbor BGP down" body "Neighbor 192.168.10.2 Down" <--- ให้ส่ง mail ด้วย
event manager applet bgp-up
event syslog pattern "neighbor 192.168.10.2 Up"
action 1.0 cli command "conf t"
action 1.1 cli command "int f0/0"
action 1.2 cli command "ip policy route-map redirect"
action 1.3 cli command "ip wccp 80 redirect in
action 1.4 syslog msg "Alert !!! Policy change by BGP-Up"
action 1.5 mail server "20.20.20.1" to "kitti@mail.xx" from "event-mager@router" subject "Alert neighbor BGP up" body "Neighbor 192.168.10.2 Up"
Tuesday, June 12, 2007
[Cisco] Config Q-in-Q (dot1q-tunneling)
Network diagram
Physical connections:
[R1 f0/1]<--->[ g1/0/1 SW1 g1/0/23 -24 ]<--trunk-->[ g1/0/21 -22 SW2 g1/0/23 -24 ] <--trunk-->[ g1/0/23-24 SW3 g1/0/1 ] <--> [ f0/1 R2]
[R1]:
interface f0/1
ip add 192.168.10.1 255.255.255.0
no sh
interface f0/1.100
encap dot1q 100
ip add 192.168.100.1 255.255.255.0
>> R1 verify
sh ip rou
C 192.168.10.0/24 is directly connected, FastEthernet0/1
C 192.168.100.0/24 is directly connected, FastEthernet0/1.100
[R2]:
interface f0/1
ip add 192.168.10.2 255.255.255.0
no sh
interface f0/1.100
encap dot1q 100
ip add 192.168.100.1 255.255.255.0
>> R2 verify
sh ip rou
C 192.168.10.0/24 is directly connected, FastEthernet0/1
C 192.168.100.0/24 is directly connected, FastEthernet0/1.100
[SW1]
system mtu 1504 <------ reload
vlan 100
interface g1/0/1
switchport mo dot1q-tunnel
l2protocol-tunnel point-to-point pagp <--- l2protocol-tunnel this command enable for allow protocols pass throught dot1q-tunnelling
l2protocol-tunnel point-to-point lacp
l2protocol-tunnel point-to-point udld
l2protocol-tunnel cdp
l2protocol-tunnel vtp
l2protocol-tunnel stp
swi access vl 100
no sh
interface rang f0/23 -24
swi tru en dot1q
swi mo tru
no sh
>> SW1 verify
sh int g1/0/1 switchport
sh l2protocol-tunnel
sh int trunk
[SW2]
system mtu 1504 <------ reload
vlan 100
interface rang f0/21 -24
swi tru en dot1q
swi mo tru
no sh
[SW3]
system mtu 1504 <------ reload
vlan 100
interface g1/0/1
switchport mo dot1q-tunnel
l2protocol-tunnel point-to-point pagp
l2protocol-tunnel point-to-point lacp
l2protocol-tunnel point-to-point udld
l2protocol-tunnel cdp
l2protocol-tunnel vtp
l2protocol-tunnel stp
swi access vl 100
no sh
interface rang f0/21 -24
swi tru en dot1q
swi mo tru
no sh
R1:
sh cdp nei <-- can see R2 direct connect
ping 192.168.100.2 <-- can reachable
Wednesday, June 6, 2007
[Cisco] TCL script สำหรับ ping ระบุ source จาก ip ทุกๆ interface
โดยดัดแปลงจาก internetworkexpert
router#tclsh
router(tcl)#
set l [llength [ exec "sh ip int brie | e down|unassig|Status" ]]
set x [ exec "sh ip int brie | e down|unassig|Status" ]
foreach dst {
150.1.1.1
150.1.2.2
} {
set c 0
puts "##########################################"
while {$c<=$l} {
set src [lindex $x $c]
if { [regexp "(^\[0-9]+\.\[0-9]+\.\[0-9]+\.\[0-9]+)" $src] } {
puts "========================================"
puts "ping ip $dst source $src repeat 3"
puts ["ping ip $dst source $src repeat 3"]
}
incr c
}
}
Tuesday, June 5, 2007
[Cisco] ต้องการทำ SPAN port เพื่อ sniff packet
ต้องการทำ SPAN port เพื่อ sniff packet พอไป search เห็นจาก web
How to limit traffic spanned
มีวิธีการ config อยู่หลายวิธีนอกจาก command monitor
Example to monitor HTTP traffic.
c6509(config)# access-list 100 permit tcp any any eq 80
c6509(config)# access-list 101 permit ip any any
c6509(config)# vlan access-map MyCap 10
c6509(config-access-map)# match ip address 101
c6509(config-access-map)# action forward
c6509(config)# vlan access-map MyCap 20
c6509(config-access-map)# match ip address 100
c6509(config-access-map)# action forward capture
c6509(config)# vlan filter MyCap vlan-list 200 , 201
c6509(config)# interface gi3/1
c6509(config-if)# switchport capture
===================
Configuration to capture HTTP traffic on VLAN 20 and send to fa0/24.
c3550(config-access-map)#action forward
c3550(config-access-map)#match ip address SA-TRAFFIC
c3550(config-access-map)#vlan filter RSPAN-VACL vlan-list 100
c3550(config)#interface vlan100
c3550(config-if)#description RSPAN Destination VLAN
c3550(config-if)#no ip address
c3550(config-if)#ip access-list extended SA-TRAFFIC
c3550(config-ext-nacl)#permit tcp any any eq 80
c3550(config)#monitor session 1 source vlan 20 rx
c3550(config)#monitor session 1 destination remote vlan 100 reflector-port fa0/24
c3550(config)#vlan access-map RSPAN-VACL 10
====================
Configuration of Http traffic on VLANs 200 and 201 sent to 3/1.
c6509(config)#ip access-list extended SA-Capture
c6509(config-ext-nacl)# permit tcp any any eq 80
c6509(config-ext-nacl)#exit
c6509(config)#int vlan 200
c6509(config-if)#mls ip ids SA-Capture
c6509(config)#int vlan 201
c6509(config-if)#mls ip ids SA-Capture
c6509(config-if)#int gig3/1
c6509(config-if)#switchport capture
Tuesday, May 29, 2007
[Linux] setup jffnms แล้วจะ create postgresql database แล้ว error
แก้ไข
vi /var/lib/pgsql/data/pg_hba.conf
เพิ่ม
local all all trust
host all all 127.0.0.1 255.255.255.255 trust
แล้ว restart
Thursday, May 24, 2007
[Linux] Squid จะต้องการให้มีการ redirect url โดยดูจาก source ip
จะใช้ squid ทำตัวเป็น redirector โดยให้ดูจาก rule ที่กำหนด
#vi /etc/squid/squid.conf
url_rewrite_program /home/kitti/squid_redirect.pl
#vi /home/kitti/squid_redirect.pl
#!/usr/bin/perl
$|=1;
sub print_log
{
local($msg) = @_;
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
$time=sprintf "%4d-%02d-%02d %02d:%02d:%02d",$year+1900,$mon+1,$mday,$hour,$min,$sec;
open(LOG,"+>>$log_file");
print LOG "$time : $msg";
close(LOG);
}
$rules_file = "/etc/squid/rules.conf";
$log_file = "/var/log/squid/redirect.log";
open (RULE,$rules_file);
&print_log("-- redirector start --\n");
while (<>) {
@X = split;
seek(RULE,0,0);
$url = $X[0];
($ip,$fqdn) = split(/\//,$X[1]);
$number=1;
$flag=0;
$line_no=0;
$go_url = $url;
while(
chomp;
$line = $_;
if((!($line =~ /^[\#\;\t ]/))&&($line)){
($src_ip,$dst_url,$action,$redirect) = split(/[ |\t]+/,$line);
if(($url =~ /$redirect/)&&($ip =~ /$src_ip/)) {
$flag = 1;
$go_url = $url;
$action = "direct-to";
}elsif (($url =~ /$dst_url/)&&($ip =~ /$src_ip/)) {
$line_no = $number;
if($action eq 'bypass'){
$go_url = $url;
$flag = 1;
}elsif ($action eq 'redirect-to'){
$go_url = "302:$redirect";
$flag = 1;
}
}
}
$number++;
if($flag){ last; }
}
print "$go_url\n";
#&print_log("squid request: @X\n");
&print_log("ip:$ip, url:$url, rule:$line_no, action:$action, redirect:$go_url\n");
}
close(RULE);
&print_log("-- redirector exit-- \n");
exit(0);
#===============================================================
#vi /etc/squid/rules.conf
# description
;src-ip url action
1.1.1.1 www.domain1.com bypass
127.0.0.1 www.domain2.co.th bypass
.* www.domain3.com bypass
.* domain4.co.th bypass
.* .* redirect-to http://www.default-domain.co.th
Thursday, May 17, 2007
Wednesday, May 16, 2007
[Linux] ใช้ firefox บน ubuntu แล้วเปิด Link ที่เป็น telnet:// ไม่ได้
อันเนื่องมาจากเปิด www.traceroute.org แล้วจะให้ firefox เรียก telnet ขึ้นมาให้เลย
1. ที่ address bar พิมพ์ about:config
2. click ขวา แล้วเลือก new->boolean
network.protocol-handler.external.telnet = true แล้ว Ok
3. click ขวาเพิ่มอีก new->string
network.protocol-handler.app.telnet = /usr/bin/firefox-telnet.sh
4. sudo vi /usr/bin/firefox-telnet.sh
#!/bin/bash
gnome-terminal -e "telnet ${1##telnet://}"
Wednesday, May 2, 2007
[CCIE] วันนี้มาคุยเรื่อง Cisco 7200 Simulator กัน
ขอขอบคุณ
http://www.ipflow.utc.fr/blog/
http://dynagen.org/
http://hacki.at/7200emu/
สำหรับคนที่ต้องการทำ lab ของinternetworkexpert iewb v4. โดยอุปกรณ์ของผมมีดังนี้
- Notebook DELL D620 Core2Duo 1.83 Ram 2G x 1 (OS Linux Ubuntu 7.04 ผมรู้สึกว่ามันเร็วกว่า XP)
- Catalyst 3750 x 4
- Catalyst 2950 x 1
- USB hub 4 port
- USB ethernet x 3 (เวลาไปซื้อเอาที่เป็น chipset realtek rtl8150 )น่ะครับแพงหน่อยประมาณ 500บาท ที่พันธ์ทิพย์ มันจะมียี้ห้อราคาถูกแนะนำว่าอย่าไปซื้อน่ะครับมันเห็นพร้อมกันไม่ได้มาก ที่จริงแล้วควรซื้อมาเท่ากับจำนวนของ router ที่ต่อออกไป switch 4 ตัวผมนับดูแล้วประมาณ 12 ตัวครับ แต่พอดีผมมี 2950 อยู่ก็เลยจะทำ trunk จาก DELL ไปหา 2950 แล้วต่อจาก 2950 ไปหา core switch ทั้ง 4 ตัวเพื่อประหยัด USB ethernet (แต่จะมี R6 ต่อไปหา core switchไม่ผ่าน 2950 ต้องใช้ usb ethernet ต่อกันตรงๆ เพราะว่าจะต้อง enable 802.1q ที่ R6 ด้วย)
จากตัว simulator มันค่อนข้างจะบริโภค CPU กับ RAM ครับ idea ของผมก็คือทุกอย่างที่ run อยู่จะต้องอยู่บน ram เพราะว่าเวลา access จะได้เร็วๆ และก็ใช้ idlepc, ghostios
ถ้าใครมี idea ดีก็บอกด้วยน่ะครับ
- สร้าง ramdisk 384M เพื่อที่จะได้ access ที่ ram จะได้เร็วๆกว่า harddisk (make_ramdisk.sh)
vi /boot/grub/menu.lst
kernel /boot/vmlinuz-2.6.20-15-lowlatency root=UUID=cd4fa939-5e2a-4450-82fb-45a11a435658 ro quiet splash verbose ramdisk_size=384000
แล้วก็ reboot
vi make_ramdisk.sh
#!/bin/sh
dd if=/dev/zero of=/dev/ram0 bs=1k count=384000
mke2fs -vm0 /dev/ram0 384000
mkdir -p /mnt/ramdisk
mount /dev/ram0 /mnt/ramdisk
mkdir -p /mnt/ramdisk/working
เวลา run script
$sudo ./make_ramdisk.sh
- สร้าง interface trunking ระหว่าง linux กับ 2950 (make_if_trunk.sh)
eth2 ทำเป็น mode promiscuous ด้วยไม่งั้นเดี๋ยวมีปัญหาเรื่องรับ packet multicast จุดนี้ผมงงอยู่หลายวัน พอ on ospf R1 กับ SW1 มันไม่ได้ทั้งๆที่เห็น multicast packet ออกจาก SW1 แล้ว ใช้ tcpdump มาจับ packet ดูก็ไม่เห็น ปรากฏว่า tcpdump มันไม่ทำตัวเป็น promisc ตั้งแต่ linux kernel 2.2+ จึงไม่เห็น multicast ที่เข้ามา แต่พอใช้ program ethereal มา sniff packet แล้วสามารถใช้ได้ในช่วงที่ sniff packet เหตุเพราะตัว linux เองมันก็จะ discard packet ที่ destination ไม่ใช่ตัวมันเอง เลยจึงจำเป็นต้องทำเป็น Mode สำส่อนเลย
#!/bin/sh
echo "Loading 802.1q module"
modprobe 8021q
ifconfig eth2 down
ifconfig eth3 down
ifconfig eth4 down
ifconfig eth2 promisc up
ifconfig eth3 promisc up
ifconfig eth4 promisc up
echo "Configuring VLAN_id to interface eth2"
vconfig add eth2 2
vconfig add eth2 3
vconfig add eth2 4
vconfig add eth2 5
vconfig add eth2 6
vconfig add eth2 7
vconfig add eth2 8
vconfig add eth2 9
vconfig add eth2 10
vconfig add eth2 11
echo "Creating interface for each vlans"
ifconfig eth2.2 promisc up
ifconfig eth2.3 promisc up
ifconfig eth2.4 promisc up
ifconfig eth2.5 promisc up
ifconfig eth2.6 promisc up
ifconfig eth2.7 promisc up
ifconfig eth2.8 promisc up
ifconfig eth2.9 promisc up
ifconfig eth2.10 promisc up
ifconfig eth2.11 promisc up
เวลา run script
$sudo ./make_if_trunk.sh
- ทำการ run process dynamips (start-dynamips.sh)
#!/bin/sh
cd /var/log/
sudo nice dynamips -H 3601 &
sudo nice dynamips -H 3602 &
sudo nice dynamips -H 3603 &
sudo nice dynamips -H 3604 &
sudo nice dynamips -H 3605 &
sudo nice dynamips -H 3606 &
sudo nice dynamips -H 3607 &
sudo nice dynamips -H 3608 &
sudo nice dynamips -H 3609 &
sudo nice dynamips -H 3610 &
เวลา run script
$sudo ./start-dynamips.sh
- script สำหรับ run dynagen (start-ccie-x.sh)
#!/bin/sh
cp -f /home/kitti/DATA/Dynamips/iewb4/working/c3600_R[1-6]_nvram /mnt/ramdisk/working/
sudo -u kitti /usr/local/dynagen/dynagen /home/kitti/DATA/Dynamips/iewb4/config/ccie-x.net
echo "Sync data..please wait...."
cp -f /mnt/ramdisk/working/* /home/kitti/DATA/Dynamips/iewb4/working/
เวลา run script
$sudo ./start-ccie-x.sh
- config file ของ dynagen (ccie-x.net)
#------------------------------------------
#Begin Dynagen config file
autostart = False
ghostios = true
sparsemem = true
mmap = false
###############################################################################
#
# Internetwork Expert Routing & Switching topology Version 4.0 mappings for dynamips/dynagen
# by: Brian McGahan, CCIE #8593
# bmcgahan@internetworkexpert.com
#
# For more information:
# Dynamips: http://www.ipflow.utc.fr/index.php/Cisco_7200_Simulator
# Dynagen: http://dyna-gen.sourceforge.net/
# Hacki's Forum: http://hacki.at/7200emu/index.php
# Internetwork Expert's Forum: http://forum.internetworkexpert.com
#
###############################################################################
##################################################
#
# Define global router parameters for instance 1
#
##################################################
[localhost:3601]
udp = 11000
workingdir = /mnt/ramdisk/working
[[3640]]
#
# Specify 3640 IOS image on Windows here:
image = /home/kitti/DATA/Dynamips/iewb4/images/c3640-jk9o3s-m.123-21.bin
ram = 73
disk0 = 0
disk1 = 0
[[Router R1]]
model = 3640
console = 2001
slot0 = NM-1FE-TX
slot1 = NM-4T
F0/0 = NIO_gen_eth:eth2.11
S1/0 = FRSW 1
idlepc = 0x6046e3ec
##################################################
#
# Define global router parameters for instance 2
#
##################################################
[localhost:3602]
udp = 12000
workingdir = /mnt/ramdisk/working
[[3640]]
#
# Specify 3640 IOS image on Windows here:
image = /home/kitti/DATA/Dynamips/iewb4/images/c3640-jk9o3s-m.123-21.bin
ram = 73
disk0 = 0
disk1 = 0
[[Router R2]]
model = 3640
console = 2002
slot0 = NM-1FE-TX
slot1 = NM-4T
F0/0 = NIO_gen_eth:eth2.2
S1/0 = FRSW 2
idlepc = 0x6046e3ec
##################################################
#
# Define global router parameters for instance 3
#
##################################################
[localhost:3603]
udp = 13000
workingdir = /mnt/ramdisk/working
[[3640]]
#
# Specify 3640 IOS image on Windows here:
image = /home/kitti/DATA/Dynamips/iewb4/images/c3640-jk9o3s-m.123-21.bin
ram = 73
disk0 = 0
disk1 = 0
[[Router R3]]
model = 3640
console = 2003
slot0 = NM-4E
slot1 = NM-4T
S1/0 = FRSW 3
S1/1 = FRSW 13
S1/2 = R1 S1/1
S1/3 = R2 S1/1
E0/0 = NIO_gen_eth:eth2.3
E0/1 = NIO_gen_eth:eth2.4
idlepc = 0x6046e3ec
##################################################
#
# Define global router parameters for instance 4
#
##################################################
[localhost:3604]
udp = 14000
workingdir = /mnt/ramdisk/working
[[3640]]
#
# Specify 3640 IOS image on Windows here:
image = /home/kitti/DATA/Dynamips/iewb4/images/c3640-jk9o3s-m.123-21.bin
ram = 73
disk0 = 0
disk1 = 0
[[Router R4]]
model = 3640
console = 2004
slot0 = NM-4E
slot1 = NM-4T
E0/0 = NIO_gen_eth:eth2.5
E0/1 = NIO_gen_eth:eth2.6
S1/0 = FRSW 4
S1/1 = R5 S1/1
idlepc = 0x6046e3ec
##################################################
#
# Define global router parameters for instance 5
#
##################################################
[localhost:3605]
udp = 15000
workingdir = /mnt/ramdisk/working
[[3640]]
#
# Specify 3640 IOS image on Windows here:
image = /home/kitti/DATA/Dynamips/iewb4/images/c3640-jk9o3s-m.123-21.bin
ram = 73
disk0 = 0
disk1 = 0
[[Router R5]]
model = 3640
console = 2005
slot0 = NM-4E
slot1 = NM-4T
E0/0 = NIO_gen_eth:eth2.7
E0/1 = NIO_gen_eth:eth2.8
S1/0 = FRSW 5
idlepc = 0x6046e3ec
##################################################
#
# Define global router parameters for instance 6
#
##################################################
[localhost:3606]
udp = 16000
workingdir = /mnt/ramdisk/working
[[3640]]
#
# Specify 3640 IOS image on Windows here:
image = /home/kitti/DATA/Dynamips/iewb4/images/c3640-jk9o3s-m.123-21.bin
ram = 73
disk0 = 0
disk1 = 0
[[Router R6]]
model = 3640
console = 2006
slot0 = NM-4E
slot1 = NM-4T
E0/0 = NIO_gen_eth:eth3
E0/1 = NIO_gen_eth:eth4
S1/0 = FRSW 6
idlepc = 0x6046e3ec
##################################################
#
# Define global router parameters for instance 11
#
##################################################
[localhost:3607]
udp = 17000
workingdir = /mnt/ramdisk/working
[[3640]]
#
# Specify 3640 IOS image on Windows here:
image = /home/kitti/DATA/Dynamips/iewb4/images/c3640-jk9o3s-m.123-21.bin
ram = 73
disk0 = 0
disk1 = 0
[[Router BB1]]
model = 3640
console = 2007
slot1 = NM-4T
S1/0 = BB3 S1/0
S1/1 = FRSW 21
cnfg = /home/kitti/DATA/Dynamips/iewb4/working/BB1.initial.config.txt
idlepc = 0x6046e3ec
##################################################
#
# Define global router parameters for instance 12
#
##################################################
[localhost:3608]
udp = 18000
workingdir = /mnt/ramdisk/working
[[3640]]
#
# Specify 3640 IOS image on Windows here:
image = /home/kitti/DATA/Dynamips/iewb4/images/c3640-jk9o3s-m.123-21.bin
ram = 73
disk0 = 0
disk1 = 0
[[Router BB2]]
model = 3640
console = 2008
slot0 = NM-4E
E0/0 = NIO_gen_eth:eth2.9
cnfg = /home/kitti/DATA/Dynamips/iewb4/working/BB2.initial.config.txt
idlepc = 0x6046e3ec
##################################################
#
# Define global router parameters for instance 13
#
##################################################
[localhost:3609]
udp = 19000
workingdir = /mnt/ramdisk/working
[[3640]]
#
# Specify 3640 IOS image on Windows here:
image = /home/kitti/DATA/Dynamips/iewb4/images/c3640-jk9o3s-m.123-21.bin
ram = 73
disk0 = 0
disk1 = 0
[[Router BB3]]
model = 3640
console = 2009
slot0 = NM-4E
slot1 = NM-4T
E0/0 = NIO_gen_eth:eth2.10
E0/3 = NIO_gen_eth:eth0
cnfg = /home/kitti/DATA/Dynamips/iewb4/working/BB3.initial.config.txt
idlepc = 0x6046e3ec
##################################################
#
# Define Frame-relay parameter
#
##################################################
[[FRSW FRSW]]
# R1 to FRSW
1:102 = 2:201
1:103 = 3:301
1:113 = 13:311
1:104 = 4:401
1:105 = 5:501
# R2 to FRSW
2:203 = 3:302
2:213 = 13:312
2:204 = 4:402
2:205 = 5:502
# R3 to FRSW
3:304 = 4:403
3:305 = 5:503
13:314 = 4:413
13:315 = 5:513
# R4 to FRSW
4:405 = 5:504
# R6 to FRSW
6:51 = 21:51
6:100 = 21:100
6:101 = 21:101
6:201 = 21:201
6:301 = 21:301
6:401 = 21:401
#End Dynagen config file
#------------------------------------------
- สุดท้ายก็ IOS ของ router ที่จะใช้ครับ
Wednesday, April 25, 2007
[Linux] config vlan trunking ต่อเข้ากับ Cisco catalyst2950
มาเริ่มทำเลยดีกว่า (อ้างอิง Ubuntu linux 7.04)
$sudo apt-get install vlan
ทำการ load module 802.1q
$sudo modprobe 8021q
ทำการ add tag 2 กับ physical interface eth2
$sudo vconfig add eth2 2
ทำการ create logical insterface eth2.2
$sudo ifconfig eth2.2 192.168.2.2 netmask 255.255.255.0 up
-- Switch Cisco catalyst2950
interface f0/1
des ## connect to linux box eth2 ##
no shut
switchport mode trunk
interface f0/2
switchport mode access
switchport access vlan 2
no shut
Monday, April 23, 2007
[Linux] ต้องการ install ผ่าน network โดย boot ผ่าน PXE
เรื่องมีอยู่ว่าผมจะ install CentOS แต่ Download มาเป็น DVD แต่ว่าตัว server ดันไม่มี dvd drive เลยต้องลำบากหาวิธีที่จะ install เห็นมี install ผ่าน network โดยให้ server มัน boot ผ่าน PXE แล้ว install ผ่าน http (ไม่รู้ว่างานนี้ทำเวอร์เกินไปหรือเปล่า?)
ต้องมี
Notebook ผมเก็บตัว installer ต้อง enable service ดังนี้
interface eth0
$sudo ifconfig eth0 10.10.10.1 netmask 255.255.255.0 up
Web server (lighttpd)
$sudo apt-get install lighttpd
$sudo /etc/init.d/lighttpd start
download image ของ CentOS ชื่อ /tmp/CentOS-5.0-i386-bin-DVD.iso
$sudo mkdir -p /var/www/installer
$sudo mount -t iso9660 -o loop /tmp/CentOS-5.0-i386-bin-DVD.iso /var/www/installer
DHCP Service
$sudo apt-get install dhcpd3-server
$sudo vi /etc/dhcp3/dhcpd.conf
ddns-update-style none;
subnet 10.10.10.0 netmask 255.255.255.0 {
range 10.10.10.100 10.10.10.200;
option routers 10.10.10.1;
filename="pxeboot/pxelinux.0";
}
$sudo /etc/init.d/dhcp3-server start
PXE Service
$sudo apt-get install pxe
$sudo /etc/init.d/pxe start
SYSLINUX
$sudo apt-get install syslinux
TFTP Service
$sudo apt-get install atftpd
$sudo mkdir -p /tftpboot/pxeboot
$sudo mkdir -p /tftpboot/pxeboot/CentOS_5.0_i386
$sudo cp /var/www/installer/images/pxeboot/vmlinuz /tftpboot/pxeboot/CentOS_5.0_i386
$sudo cp /var/www/installer/images/pxeboot/initrd.img /tftpboot/pxeboot/CentOS_5.0_i386
$sudo cp /usr/lib/syslinux/pxelinux.0 /tftpboot/pxeboot/ <-- file นี้เอามาจาก syslinux พอดีเครื่องผมใช้ ubuntu
$sudo mkdir -p /tftpboot/pxeboot/pxelinux.cfg
# config file สำหรับเลือก boot แยกแต่ล่ะ mac address หรือค่า default
$sudo vi /tftpboot/pxeboot/pxelinux.cfg/00-E0-4C-03-1D-08 <--- mac address ของ server
หรือ
$sudo vi /tftpboot/pxeboot/pxelinux.cfg/default
default CentOS_5.0_i386
timeout 10
prompt 1
display display.msg
label CentOS_5.0_i386
kernel CentOS_50_i386/vmlinuz
append initrd=CentOS_50_i386/initrd.img
หรือถ้ามี script kickstart
# append initrd=CentOS_50_i386/initrd.img ks=http://10.10.10.1/installer/anaconda.cfg
$sudo vi /tftpboot/pxeboot/display.msg
Linux installer via PXE boot:
CentOS_5.0_i386
$sudo chown -R nobody:nobody /tftpboot
$sudo /etc/init.d/atftpd start
ตอนนี้จัดเตรียมตัว install ไว้แล้ว
จากนั้นก็เอา server มาต่อ สาย lan แล้วให้ boot จาก lan card โดยให้ set ที่ bios
status มันก็จะ request DHCP แล้วก็จะได้ ip กลับไป
Linux installer via PXE boot:
CentOS_5.0_i386
boot:
ให้พิมพ์ดังนี้
boot: CentOS_5.0_i386 แล้ว enter
มันก็จะ boot แล้วเข้าสู่กระบวนการ install แล้วให้เราเลือก source ที่จะใช้ ผมเลือกใช้ http
มันจะถาม ip ของ web server และ directory
ip or name server: 10.10.10.1
directory: /installer/
แล้ว OK
Friday, April 20, 2007
[Cisco] ทำ frame-relay traffic shaping
interface Serial0/0
no ip address
encapsulation frame-relay
no fair-queue
frame-relay traffic-shaping
!
interface Serial0/0.1 point-to-point
ip address 10.1.1.2 255.255.255.0
frame-relay interface-dlci 16
frame-relay class cisco
!
map-class frame-relay cisco
frame-relay cir 64000
frame-relay mincir 32000
frame-relay adaptive-shaping becn
frame-relay bc 8000
อ้างจากรูป
เพื่อเข้าใจง่ายขึ้นเรื่อง CIR,Bc,Be
CIR = Commit Information Rate
Bc = Burst commit คือใน 1 Tc จะสามารถส่ง data ได้กี่บิต
Be = Burst excess
AR = Access Rate
Tc = Time interval (default 125ms)
Bc = CIR * Tc (หรือ Bc = CIR/8 กรณีที่ Tc ค่า default 125ms)
Be = (AR-CIR) * Tc
Friday, April 13, 2007
[FreeBSD] พอ install OS แล้วผมก็เตรียมพร้อมสำหรับโหลดบิต
ต้องทำให้เครื่อง pentium3 แรงๆเพื่อจะได้โหลดบิต (ทำแบบมั่วๆ search ใน google เรื่อง optimize, tunning บ้างมารวมๆกัน)
