赞
踩
# 接口、子接口、vlan
1、一个vlan可以包含很多个接口
2、子接口也是真实存在的接口, 同样可以加入到vlan中
3、vlan与vlan之间的通信方式有:
01、vlan接口:vlan接口可以看成是整个vlan的一个网关
02、单臂路由:同一个物理连上连接多个网络。 通过创建子接口实现vlan与vlan之间互通的方式是单臂路由的一种实现。
命令: display interface brief
注: 显示的信息中接口类型采用了缩写, 如:显示的FGE1/0/54,意思是接口类型为FortyGigE, 接口编号是1/0/54
display current-configuration
# 可以对这个命令的结果进行筛选
[H3C]dis cur ?
> Redirect it to a file
>> Redirect it to a file in append mode
configuration The pre-positive and post-positive configuration information
controller Display controller configuration
diff Display the differences between the current configuration and
the next-startup configuration
interface The interface configuration information
| Matching output
<cr>
display ip routing-table
display ip routing-table vpn-instance xxx
# 例
# 查看RIP协议学到的路由
[R1]display ip routing-table protocol rip
<Active> : 活跃,代表正在使用的
<Inactive>:不活跃,代表没有用的,没有放到路由表里面去的
# 命令 display this 例; [H3C]interface FortyGigE 1/0/53 [H3C-FortyGigE1/0/53]dis this # interface FortyGigE1/0/53 port link-mode route ip address 10.0.12.1 255.255.255.0 # return [H3C-FortyGigE1/0/53]rip [H3C-rip-1]dis this # rip 1 version 2 network 1.1.1.0 0.0.0.255 network 10.0.12.0 0.0.0.255 # return [H3C-rip-1]
# 接口的两种模式
如果将工作模式设置为二层模式(bridge),则作为一个二层以太网接口使用,如果将工作模式设置为三层模式(route),则作为一个三层以太网接口使用。
接口模式切换后,除了shutdown命令,该以太网接口下的其它所有命令都将恢复到新模式下的缺省情况。
# 接口模式切换命令
<Sysname> system-view
[Sysname] interface ten-gigabitethernet 1/0/1
[Sysname-Ten-GigabitEthernet1/0/1] port link-mode bridge
# [Sysname-Ten-GigabitEthernet1/0/1] port link-mode bridge
以太网子接口是三层子接口,需要接口工作模式设置为route,才能进行以太网子接口的配置
# 进入以太网接口Ten-GigabitEthernet1/0/1视图。
<H3C>system-view
[H3C]interface FortyGigE 1/0/54
[H3C-FortyGigE1/0/54]
# 创建以太网子接口Ten-GigabitEthernet1/0/1.1并进入该子接口的视图。
<H3C>system-view
[H3C]interface FortyGigE 1/0/54.1
[H3C-FortyGigE1/0/54.1]
# 命令
interface interface-type { interface-number | interface-number.subnumber }
interface-type:指定接口类型。
interface-number:指定接口编号。
interface-number.subnumber:指定子接口编号。其中interface-number为主接口编号;subnumber为子接口编号,取值范围为1~4094。
增加: vlan 10
删除: undo vlan 10
# 创建VPN实例
进入系统视图
system-view
创建VPN实例,并进入VPN实例视图
ip vpn-instance vpn-instance-name
缺省情况下,不存在VPN实例
配置VPN实例的描述信息(可选)
description text
缺省情况下,未配置VPN实例的描述信息
# 例
<H3C>system-view
[H3C]ip vpn-instance ccc
[H3C-vpn-instance-ccc]description ccc123
[H3C-vpn-instance-ccc]quit
注:执行ip binding vpn-instance命令将删除接口上已经配置的IP地址,因此需要重新配置接口的IP地址。
进入系统视图
system-view
进入接口视图
interface interface-type interface-number
配置接口与指定VPN实例关联
ip binding vpn-instance vpn-instance-name
缺省情况下,接口未关联VPN实例,接口属于公网
<H3C>system-view
[H3C]interface FortyGigE 1/0/54.1
[H3C-FortyGigE1/0/54.1]ip binding vpn-instance ccc
[H3C-FortyGigE1/0/54.1]quit
# 路由器上主路由表配置静态路由
ip route-static 114b 10.0.113.1 255.255.255.0 10.0.114.1
# 路由器上VRF配置静态路由
ip route-static vpn-instance 114b 10.0.113.1 255.255.255.0 10.0.114.1
路由之间存在多种协议时,需要对路由进行重发布
路由重发布
描述:路由器1使用ripng协议 、路由器2使用OSPF协议、路由器3在两个路由器之间,是实现两个路由器之间网络的互联,需要在路由器3上注入两个协议
OSPF
import-route rip
rip
import-route ospf
# 查看rip配置 # 命令 display rip [H3C]dis rip Public VPN-instance name: RIP process: 1 RIP version: 1 Preference: 100 Checkzero: Enabled Default cost: 0 Summary: Disabled Host routes: Enabled Maximum number of load balanced routes: 16 Update time : 30 secs Timeout time : 180 secs Suppress time : 120 secs Garbage-collect time : 120 secs Update output delay: 20(ms) Output count: 3 Graceful-restart interval: 60 secs Triggered Interval : 5 50 200 BFD: Disabled Silent interfaces: None Default routes: Disabled Verify-source: Enabled Networks: 3.3.3.3 10.0.23.0 10.0.35.0 Configured peers: None Triggered updates sent: 5 Number of routes changes: 16 Number of replies to queries: 0
# 查看RIP协议学到的路由
[R1]display ip routing-table protocol rip
<Active> : 活跃,代表正在使用的
<Inactive>:不活跃,代表没有用的,没有放到路由表里面去的
# 显示RIP协议数据库(显示动态路由协议到各网段的信息)
[H3C]display rip 1 database
[H3C]interface LoopBack 0
[H3C-LoopBack0]ip address 1.1.1.1 255.255.255.255
[H3C-LoopBack0]quit
[H3C]interface FortyGigE 1/0/54
[H3C-FortyGigE1/0/54]ip address 10.0.12.1 255.255.255.0
[H3C-FortyGigE1/0/54]quit
# 注意, 需要在用户模式下使用reset命令
<H3C>reset rip 1 process
Reset RIP process? [Y/N]:y
[H3C]rip
# 默认开启的进程号为1, 存在vrf的情况下,如果rip 后不指定路由表,默认使用全局路由表。
[H3C-rip-1]version 2
[H3C-rip-1]network 10.0.12.1 255.255.255.0
[H3C-rip-1]dis this
#
rip 1
version 2
network 1.1.1.0 0.0.0.255
network 10.0.12.0 0.0.0.255
#
return
1、bgp的路由更新依赖于路由上的路由,如果以为 LoopBack 为BGP的路由更新源,那么必须保证有到LoopBack 的路由
2、bgp的路由更新依赖于路由上的路由,必须保证peer 指定的地址是可以ping通的, 这一点在配置VRF的时候要重视。
# 查看bgp ipv4路由
display bgp routing-table ipv4
display bgp routing-table ipv4 vpn-instance vpn-instance-name
# 查看bgp ipv6路由
display bgp routing-table ipv6
# 查看bgp peer信息
display bgp peer ipv4
display bgp peer ipv6
display bgp peer ipv4 vpn-instance vpn-instance-name
bgp 200
router-id 2.2.2.2
peer 10.0.232.3 as-number 300
address-family ipv4
# 创建的peer 默认是关闭的需要激活
peer 10.0.231.3 enable
和IBGP配置一样, 知识AS号不相同了
配置完成后在R4上可以 ping通R1。
# 配置可以在优化一下
# R1 # ip route-static 10.0.34.0 255.255.255.0 10.0.12.2
interface FortyGigE 1/0/54
port link-mode route
ip address 10.0.12.1 255.255.255.0
exit
ip route-static 0.0.0.0 0.0.0.0 10.0.12.2
# R2 interface FortyGigE 1/0/54 port link-mode route ip address 10.0.12.2 255.255.255.0 exit interface GigabitEthernet 1/0/1 port link-mode route ip address 10.0.231.2 255.255.255.0 exit interface GigabitEthernet 1/0/2 port link-mode route ip address 10.0.232.2 255.255.255.0 exit interface LoopBack 0 ip address 2.2.2.2 255.255.255.255 exit bgp 200 router-id 2.2.2.2 peer 10.0.231.3 as-number 300 peer 10.0.232.3 as-number 300 address-family ipv4 # 创建的peer 默认是关闭的需要激活 peer 10.0.231.3 enable peer 10.0.232.3 enable network 10.0.12.2 255.255.255.0 network 10.0.231.2 255.255.255.0 network 10.0.232.2 255.255.255.0 exit exit
# R3 interface FortyGigE 1/0/54 port link-mode route ip address 10.0.34.3 255.255.255.0 exit interface GigabitEthernet 1/0/1 port link-mode route ip address 10.0.231.3 255.255.255.0 exit interface GigabitEthernet 1/0/2 port link-mode route ip address 10.0.232.3 255.255.255.0 exit interface LoopBack 0 ip address 3.3.3.3 255.255.255.255 exit bgp 300 router-id 3.3.3.3 peer 10.0.231.2 as-number 200 peer 10.0.232.2 as-number 200 peer 10.0.34.4 as-number 400 address-family ipv4 peer 10.0.231.2 enable peer 10.0.232.2 enable peer 10.0.34.4 enable network 10.0.231.3 255.255.255.0 network 10.0.232.3 255.255.255.0 network 10.0.34.3 255.255.255.0 exit exit
# R4 interface FortyGigE 1/0/54 port link-mode route ip address 10.0.34.4 255.255.255.0 exit interface LoopBack 0 ip address 4.4.4.4 255.255.255.255 exit bgp 400 router-id 4.4.4.4 peer 10.0.34.3 as-number 300 address-family ipv4 peer 10.0.34.3 enable network 10.0.34.4 255.255.255.0 exit exit
1、测试R2和R3之间线路冗余, 手动切断R2和R3之间任意一条线路,在R4上ping 10.0.113.1 都可以ping通
2、bgp分别为200、300、400
# 配置可以在优化一下
# R1 # ip route-static 10.0.34.0 255.255.255.0 10.0.12.2
interface FortyGigE 1/0/54
port link-mode route
ip address 10.0.12.1 255.255.255.0
exit
ip route-static 0.0.0.0 0.0.0.0 10.0.12.2
interface FortyGigE 1/0/54.113
ip address 10.0.113.1 255.255.255.0
exit
interface FortyGigE 1/0/54.114
ip address 10.0.114.1 255.255.255.0
exit
# R2 interface FortyGigE 1/0/54 port link-mode route ip address 10.0.12.2 255.255.255.0 exit ip vpn-instance 113a route-distinguisher 113:1 exit ip vpn-instance 114b route-distinguisher 114:1 exit interface FortyGigE 1/0/54.113 ip binding vpn-instance 113a ip address 10.0.113.2 255.255.255.0 exit interface GigabitEthernet 1/0/1 port link-mode route ip binding vpn-instance 113a ip address 10.0.231.2 255.255.255.0 exit interface FortyGigE 1/0/54.114 ip binding vpn-instance 114b ip address 10.0.114.2 255.255.255.0 exit interface GigabitEthernet 1/0/2 port link-mode route ip binding vpn-instance 114b ip address 10.0.232.2 255.255.255.0 exit interface LoopBack 0 ip address 2.2.2.2 255.255.255.255 exit bgp 200 ip vpn-instance 113a peer 10.0.231.3 as-number 300 peer 10.0.232.3 as-number 300 address-family ipv4 peer 10.0.231.3 enable peer 10.0.232.3 enable network 10.0.113.2 255.255.255.0 exit exit ip vpn-instance 114b peer 10.0.231.3 as-number 300 peer 10.0.232.3 as-number 300 address-family ipv4 peer 10.0.231.3 enable peer 10.0.232.3 enable network 10.0.114.2 255.255.255.0 exit exit exit ip route-static vpn-instance 114b 10.0.113.1 255.255.255.0 10.0.114.1
# R3 interface FortyGigE 1/0/54 port link-mode route ip address 10.0.34.3 255.255.255.0 exit interface GigabitEthernet 1/0/1 port link-mode route ip address 10.0.231.3 255.255.255.0 exit interface GigabitEthernet 1/0/2 port link-mode route ip address 10.0.232.3 255.255.255.0 exit interface LoopBack 0 ip address 3.3.3.3 255.255.255.255 exit bgp 300 router-id 3.3.3.3 peer 10.0.231.2 as-number 200 peer 10.0.232.2 as-number 200 peer 10.0.34.4 as-number 400 address-family ipv4 peer 10.0.231.2 enable peer 10.0.232.2 enable peer 10.0.34.4 enable network 10.0.231.3 255.255.255.0 network 10.0.232.3 255.255.255.0 network 10.0.34.3 255.255.255.0 exit exit
# R4 interface FortyGigE 1/0/54 port link-mode route ip address 10.0.34.4 255.255.255.0 exit interface LoopBack 0 ip address 4.4.4.4 255.255.255.255 exit bgp 400 router-id 4.4.4.4 peer 10.0.34.3 as-number 300 address-family ipv4 peer 10.0.34.3 enable network 10.0.34.4 255.255.255.0 exit exit
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。