2010年7月14日-BOOTCAMP开营,入学知识交流,BOOTCAMP学习,剩者为王
综合拓扑练习:
ISP-Router-MSW-SW1/SW2-PC1/PC2
PC1:
en
conf t
line con 0
logg syn
exec-timeout 0 0
exit
no ip domain lookup
hostname PC1
int f0/0
ip add 10.1.1.1 255.255.255.0
no shut
exit
no ip routing
ip default-gateway 10.1.1.254
end
PC2:
en
conf t
line con 0
logg syn
exec-timeout 0 0
exit
no ip domain lookup
hostname PC2
int f0/0
ip add 10.1.2.1 255.255.255.0
no shut
exit
no ip routing
ip default-gateway 10.1.2.254
end
show ip route
SW1配置:
en
conf t
line con 0
logg syn
exec-timeout 0 0
exit
no ip domain lookup
hostname SW1
no ip routing
vlan 10
exit
int f1/0
switchport mode access
switchport access vlan 10
exit
int f1/15
switchport mode trunk
exit
int vlan 10
ip add 10.1.1.253 255.255.255.0
exit
ip default-gateway 10.1.1.254
end
show vlan-switch
show int trunk
show ip route
SW2配置:
en
conf t
line con 0
logg syn
exec-timeout 0 0
exit
no ip domain lookup
hostname SW2
no ip routing
vlan 20
exit
int f1/0
switchport mode access
switchport access vlan 20
exit
int f1/15
switchport mode trunk
exit
int vlan20
ip add 10.1.2.253 255.255.255.0
exit
ip default-gateway 10.1.2.254
end
show vlan-switch
show int trunk
show ip route
3层交换机配置:
1.创建VLAN
2.将端口划入VLAN,access
3.将端口配置Trunk
4.配置交换机虚拟接口IP(SVI接口 switch virtual interface)及路由
MSW:
en
conf t
line con 0
logg syn
exec-timeout 0 0
exit
no ip domain lookup
hostname MSW
vlan 10
vlan 20
vlan 30
exit
int f1/15
switchport mode access
switchport access vlan 30
exit
int rang f1/1 -2
switchport mode trunk
exit
int vlan 10
ip add 10.1.1.254 255.255.255.0
exit
int vlan 20
ip add 10.1.2.254 255.255.255.0
exit
int vlan 30
ip add 10.1.3.254 255.255.255.0
exit
ip route 0.0.0.0 0.0.0.0 10.1.3.253
end
出口路由器配置:
1.接口IP地址
2.NAT:
2.1 指定inside和outside端口
2.2 指定NAT类型(静态、地址池、端口复用)
2.3 根据NAT添加配置(地址池添加或ACL添加)
3.路由完整性配置(去和回的路)
C2691:
en
conf t
line con 0
logg syn
exec-timeout 0 0
exit
no ip domain lookup
hostname C2691
int f0/0
ip add 10.1.3.253 255.255.255.0
no shut
int f0/1
ip add 211.1.1.1 255.255.255.0
no shut
exit
int f0/0
ip nat inside
exit
int f0/1
ip nat outside
exit
ip nat inside source list 1 int f0/1 overload
access-list 1 permit any
ip route 0.0.0.0 0.0.0.0 211.1.1.254
ip route 10.0.0.0 255.0.0.0 10.1.3.254
end
ISP:
en
conf t
line con 0
logg syn
exec-timeout 0 0
exit
no ip domain lookup
hostname ISP
int f0/0
ip add 211.1.1.254 255.255.255.0
no shut
exit
int loo0
ip add 222.1.1.1 255.255.255.255
exit
2010年7月15日-路由交流
浮动静态路由:
ip route A.B.C.D A.B.C.D ad值
配置SLA实现路由跟踪:
ip route 0.0.0.0 0.0.0.0 12.1.1.2 track 1
track 1 rtr 1
ip sla monitor 1
type echo protocol ipIcmpEcho A.B.C.D source-ipaddr A.B.C.D
timeout 1000
frequency 10
ip sla monitor schedule 1 life forever start-time now
注意:timeout的单位是ms, frequency的单位是s。
原来的静态路由要删除,track的条目才会出现。
使用traceroute x.x.x.x 进行路径跟踪
RIPv2协议:
被动接口及单播更新:
router rip
version 2
no auto-summary
passive-interface x
neighbor A.B.C.D
exit
设置RIP跳数:
router rip
offset-list x in x
exit
access-list 1 permit A.B.C.D A.B.C.D
2010年7月16日-路由交流2
OSPF虚链路配置:
在以下两种情况时需要进行虚链路配置:
1.区域不连续分布
2.区域0被分割
配置在对称的ABR上:
router ospf 1
router-id A.B.C.D(手动指定RID,防止其变化)
area x virtual-link A.B.C.D(对端ABR的RID) x代表过渡区域
路由传递的特点:其他非骨干区域互相传递路由时,需要先经过骨干区域
另外,tunnel技术也可以实现虚链路的功能
OSPF认证:
认证类型包括
1.接口认证
2.区域认证
认证方式包括
1.明文认证
2.密文认证
具体配置略
路由策略:路由条目的过滤策略,通过route-map实现
router ospf 1
redistribute conneted subnets route-map name
exit
route-map name
match ip address acl号码
#match ip address prefix-list name
exit
access-list 号码 permit A.B.C.D A.B.C.D
前缀列表:ip prefix-list name seq 序号 permit A.B.C.D/n
策略路由:优于路由表的查询,根据route-map配置进行选路
它是基于接口进行的,方向都是in的,不需要配置方向
int f0/0
ip policy route-map name
exit
route-map name permit 序号
match ip add acl号码
set ip next-hop A.B.C.D(对端设备的接口IP)
exit
route-map name permit 序号
match ip add 100
set ip next-hop A.B.C.D(对端设备的接口IP)
exit
access-list acl号码 permit A.B.C.D A.B.C.D
access-list acl号码 permit A.B.C.D A.B.C.D
流量如果没有被匹配,则进行正常路由。
命名的ACL:
ip access-list standard name
permit/deny A.B.C.D A.B.C.D
exit
ip access-list extended spoto
permit/deny ip A.B.C.D A.B.C.D A.B.C.D A.B.C.D
exit
show access-lists
查看ACL内容,命名ACL会给每个条目创建序号,可以单独删除ACL下的某个序号的条目。
基于时间的ACL(扩展ACL的一个功能)
ip access-list extended spoto
permit/deny ip A.B.C.D A.B.C.D A.B.C.D A.B.C.D time-range name
exit
time-range name
periodic daily hh:mm to hh:mm
exit
基于时间的ACL仍然是应用在接口下:ip access-group name in/out
为了确保时间的准确性,一般会使用NTP网络时间协议。
时区是不能同步的,需要手动配置。全局模式下:clock timezone beijing 8
时间可以通过NTP进行同步。
路由器作为NTP服务器的配置:ntp master
路由器作为NTP客户端的配置:ntp server A.B.C.D
基于TCP established的扩展ACL
ip access-list extended spoto
permit tcp A.B.C.D A.B.C.D A.B.C.D A.B.C.D established
exit
这种ACL能够实现PC1访问PC2的TCP服务允许,但PC2无法主动访问PC1的TCP服务。实现单向TCP访问。但仅限于TCP。
注意这种ACL在应用的时候的方向性。
自反ACL(略):实现单向通信的ACL
NAT端口映射:
ip nat inside source static tcp 内网服务器IP 端口号 外网IP 端口号
show ip nat translations
NAT轮询
ip nat inside destination list acl号码 pool 内网服务器地址池名称
access-list acl号码 permit A.B.C.D(公网IP)
ip nat pool name A.B.C.D A.B.C.D netmask A.B.C.D
show ip nat translations
clear ip nat translation *
PPP多链路捆绑:
int s1/0
encapsulation ppp
ppp multilink group 1
no shut
exit
int s1/1
encapsulation ppp
ppp multilink group 1
no shut
exit
interface Multilink1
ip address 12.1.1.1 255.255.255.0
ppp multilink group 1
exit
show interface Multilink1 ( BW 3088 Kbit)